Blame depcomp

Packit 022b05
#! /bin/sh
Packit 022b05
# depcomp - compile a program generating dependencies as side-effects
Packit 022b05
Packit 022b05
scriptversion=2006-10-15.18
Packit 022b05
Packit 022b05
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
Packit 022b05
# Foundation, Inc.
Packit 022b05
Packit 022b05
# This program is free software; you can redistribute it and/or modify
Packit 022b05
# it under the terms of the GNU General Public License as published by
Packit 022b05
# the Free Software Foundation; either version 2, or (at your option)
Packit 022b05
# any later version.
Packit 022b05
Packit 022b05
# This program is distributed in the hope that it will be useful,
Packit 022b05
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 022b05
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 022b05
# GNU General Public License for more details.
Packit 022b05
Packit 022b05
# You should have received a copy of the GNU General Public License
Packit 022b05
# along with this program; if not, write to the Free Software
Packit 022b05
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit 022b05
# 02110-1301, USA.
Packit 022b05
Packit 022b05
# As a special exception to the GNU General Public License, if you
Packit 022b05
# distribute this file as part of a program that contains a
Packit 022b05
# configuration script generated by Autoconf, you may include it under
Packit 022b05
# the same distribution terms that you use for the rest of that program.
Packit 022b05
Packit 022b05
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
Packit 022b05
Packit 022b05
case $1 in
Packit 022b05
  '')
Packit 022b05
     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
Packit 022b05
     exit 1;
Packit 022b05
     ;;
Packit 022b05
  -h | --h*)
Packit 022b05
    cat <<\EOF
Packit 022b05
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Packit 022b05
Packit 022b05
Run PROGRAMS ARGS to compile a file, generating dependencies
Packit 022b05
as side-effects.
Packit 022b05
Packit 022b05
Environment variables:
Packit 022b05
  depmode     Dependency tracking mode.
Packit 022b05
  source      Source file read by `PROGRAMS ARGS'.
Packit 022b05
  object      Object file output by `PROGRAMS ARGS'.
Packit 022b05
  DEPDIR      directory where to store dependencies.
Packit 022b05
  depfile     Dependency file to output.
Packit 022b05
  tmpdepfile  Temporary file to use when outputing dependencies.
Packit 022b05
  libtool     Whether libtool is used (yes/no).
Packit 022b05
Packit 022b05
Report bugs to <bug-automake@gnu.org>.
Packit 022b05
EOF
Packit 022b05
    exit $?
Packit 022b05
    ;;
Packit 022b05
  -v | --v*)
Packit 022b05
    echo "depcomp $scriptversion"
Packit 022b05
    exit $?
Packit 022b05
    ;;
Packit 022b05
esac
Packit 022b05
Packit 022b05
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
Packit 022b05
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
Packit 022b05
  exit 1
Packit 022b05
fi
Packit 022b05
Packit 022b05
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
Packit 022b05
depfile=${depfile-`echo "$object" |
Packit 022b05
  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
Packit 022b05
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
Packit 022b05
Packit 022b05
rm -f "$tmpdepfile"
Packit 022b05
Packit 022b05
# Some modes work just like other modes, but use different flags.  We
Packit 022b05
# parameterize here, but still list the modes in the big case below,
Packit 022b05
# to make depend.m4 easier to write.  Note that we *cannot* use a case
Packit 022b05
# here, because this file can only contain one case statement.
Packit 022b05
if test "$depmode" = hp; then
Packit 022b05
  # HP compiler uses -M and no extra arg.
Packit 022b05
  gccflag=-M
Packit 022b05
  depmode=gcc
Packit 022b05
fi
Packit 022b05
Packit 022b05
if test "$depmode" = dashXmstdout; then
Packit 022b05
   # This is just like dashmstdout with a different argument.
Packit 022b05
   dashmflag=-xM
Packit 022b05
   depmode=dashmstdout
Packit 022b05
fi
Packit 022b05
Packit 022b05
case "$depmode" in
Packit 022b05
gcc3)
Packit 022b05
## gcc 3 implements dependency tracking that does exactly what
Packit 022b05
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
Packit 022b05
## it if -MD -MP comes after the -MF stuff.  Hmm.
Packit 022b05
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
Packit 022b05
## the command line argument order; so add the flags where they
Packit 022b05
## appear in depend2.am.  Note that the slowdown incurred here
Packit 022b05
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
Packit 022b05
  for arg
Packit 022b05
  do
Packit 022b05
    case $arg in
Packit 022b05
    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
Packit 022b05
    *)  set fnord "$@" "$arg" ;;
Packit 022b05
    esac
Packit 022b05
    shift # fnord
Packit 022b05
    shift # $arg
Packit 022b05
  done
Packit 022b05
  "$@"
Packit 022b05
  stat=$?
Packit 022b05
  if test $stat -eq 0; then :
Packit 022b05
  else
Packit 022b05
    rm -f "$tmpdepfile"
Packit 022b05
    exit $stat
Packit 022b05
  fi
Packit 022b05
  mv "$tmpdepfile" "$depfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
gcc)
Packit 022b05
## There are various ways to get dependency output from gcc.  Here's
Packit 022b05
## why we pick this rather obscure method:
Packit 022b05
## - Don't want to use -MD because we'd like the dependencies to end
Packit 022b05
##   up in a subdir.  Having to rename by hand is ugly.
Packit 022b05
##   (We might end up doing this anyway to support other compilers.)
Packit 022b05
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
Packit 022b05
##   -MM, not -M (despite what the docs say).
Packit 022b05
## - Using -M directly means running the compiler twice (even worse
Packit 022b05
##   than renaming).
Packit 022b05
  if test -z "$gccflag"; then
Packit 022b05
    gccflag=-MD,
Packit 022b05
  fi
Packit 022b05
  "$@" -Wp,"$gccflag$tmpdepfile"
Packit 022b05
  stat=$?
Packit 022b05
  if test $stat -eq 0; then :
Packit 022b05
  else
Packit 022b05
    rm -f "$tmpdepfile"
Packit 022b05
    exit $stat
Packit 022b05
  fi
Packit 022b05
  rm -f "$depfile"
Packit 022b05
  echo "$object : \\" > "$depfile"
Packit 022b05
  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Packit 022b05
## The second -e expression handles DOS-style file names with drive letters.
Packit 022b05
  sed -e 's/^[^:]*: / /' \
Packit 022b05
      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
Packit 022b05
## This next piece of magic avoids the `deleted header file' problem.
Packit 022b05
## The problem is that when a header file which appears in a .P file
Packit 022b05
## is deleted, the dependency causes make to die (because there is
Packit 022b05
## typically no way to rebuild the header).  We avoid this by adding
Packit 022b05
## dummy dependencies for each header file.  Too bad gcc doesn't do
Packit 022b05
## this for us directly.
Packit 022b05
  tr ' ' '
Packit 022b05
' < "$tmpdepfile" |
Packit 022b05
## Some versions of gcc put a space before the `:'.  On the theory
Packit 022b05
## that the space means something, we add a space to the output as
Packit 022b05
## well.
Packit 022b05
## Some versions of the HPUX 10.20 sed can't process this invocation
Packit 022b05
## correctly.  Breaking it into two sed invocations is a workaround.
Packit 022b05
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Packit 022b05
  rm -f "$tmpdepfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
hp)
Packit 022b05
  # This case exists only to let depend.m4 do its work.  It works by
Packit 022b05
  # looking at the text of this script.  This case will never be run,
Packit 022b05
  # since it is checked for above.
Packit 022b05
  exit 1
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
sgi)
Packit 022b05
  if test "$libtool" = yes; then
Packit 022b05
    "$@" "-Wp,-MDupdate,$tmpdepfile"
Packit 022b05
  else
Packit 022b05
    "$@" -MDupdate "$tmpdepfile"
Packit 022b05
  fi
Packit 022b05
  stat=$?
Packit 022b05
  if test $stat -eq 0; then :
Packit 022b05
  else
Packit 022b05
    rm -f "$tmpdepfile"
Packit 022b05
    exit $stat
Packit 022b05
  fi
Packit 022b05
  rm -f "$depfile"
Packit 022b05
Packit 022b05
  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
Packit 022b05
    echo "$object : \\" > "$depfile"
Packit 022b05
Packit 022b05
    # Clip off the initial element (the dependent).  Don't try to be
Packit 022b05
    # clever and replace this with sed code, as IRIX sed won't handle
Packit 022b05
    # lines with more than a fixed number of characters (4096 in
Packit 022b05
    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
Packit 022b05
    # the IRIX cc adds comments like `#:fec' to the end of the
Packit 022b05
    # dependency line.
Packit 022b05
    tr ' ' '
Packit 022b05
' < "$tmpdepfile" \
Packit 022b05
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
Packit 022b05
    tr '
Packit 022b05
' ' ' >> $depfile
Packit 022b05
    echo >> $depfile
Packit 022b05
Packit 022b05
    # The second pass generates a dummy entry for each header file.
Packit 022b05
    tr ' ' '
Packit 022b05
' < "$tmpdepfile" \
Packit 022b05
   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
Packit 022b05
   >> $depfile
Packit 022b05
  else
Packit 022b05
    # The sourcefile does not contain any dependencies, so just
Packit 022b05
    # store a dummy comment line, to avoid errors with the Makefile
Packit 022b05
    # "include basename.Plo" scheme.
Packit 022b05
    echo "#dummy" > "$depfile"
Packit 022b05
  fi
Packit 022b05
  rm -f "$tmpdepfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
aix)
Packit 022b05
  # The C for AIX Compiler uses -M and outputs the dependencies
Packit 022b05
  # in a .u file.  In older versions, this file always lives in the
Packit 022b05
  # current directory.  Also, the AIX compiler puts `$object:' at the
Packit 022b05
  # start of each line; $object doesn't have directory information.
Packit 022b05
  # Version 6 uses the directory in both cases.
Packit 022b05
  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
Packit 022b05
  tmpdepfile="$stripped.u"
Packit 022b05
  if test "$libtool" = yes; then
Packit 022b05
    "$@" -Wc,-M
Packit 022b05
  else
Packit 022b05
    "$@" -M
Packit 022b05
  fi
Packit 022b05
  stat=$?
Packit 022b05
Packit 022b05
  if test -f "$tmpdepfile"; then :
Packit 022b05
  else
Packit 022b05
    stripped=`echo "$stripped" | sed 's,^.*/,,'`
Packit 022b05
    tmpdepfile="$stripped.u"
Packit 022b05
  fi
Packit 022b05
Packit 022b05
  if test $stat -eq 0; then :
Packit 022b05
  else
Packit 022b05
    rm -f "$tmpdepfile"
Packit 022b05
    exit $stat
Packit 022b05
  fi
Packit 022b05
Packit 022b05
  if test -f "$tmpdepfile"; then
Packit 022b05
    outname="$stripped.o"
Packit 022b05
    # Each line is of the form `foo.o: dependent.h'.
Packit 022b05
    # Do two passes, one to just change these to
Packit 022b05
    # `$object: dependent.h' and one to simply `dependent.h:'.
Packit 022b05
    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
Packit 022b05
    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
Packit 022b05
  else
Packit 022b05
    # The sourcefile does not contain any dependencies, so just
Packit 022b05
    # store a dummy comment line, to avoid errors with the Makefile
Packit 022b05
    # "include basename.Plo" scheme.
Packit 022b05
    echo "#dummy" > "$depfile"
Packit 022b05
  fi
Packit 022b05
  rm -f "$tmpdepfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
icc)
Packit 022b05
  # Intel's C compiler understands `-MD -MF file'.  However on
Packit 022b05
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
Packit 022b05
  # ICC 7.0 will fill foo.d with something like
Packit 022b05
  #    foo.o: sub/foo.c
Packit 022b05
  #    foo.o: sub/foo.h
Packit 022b05
  # which is wrong.  We want:
Packit 022b05
  #    sub/foo.o: sub/foo.c
Packit 022b05
  #    sub/foo.o: sub/foo.h
Packit 022b05
  #    sub/foo.c:
Packit 022b05
  #    sub/foo.h:
Packit 022b05
  # ICC 7.1 will output
Packit 022b05
  #    foo.o: sub/foo.c sub/foo.h
Packit 022b05
  # and will wrap long lines using \ :
Packit 022b05
  #    foo.o: sub/foo.c ... \
Packit 022b05
  #     sub/foo.h ... \
Packit 022b05
  #     ...
Packit 022b05
Packit 022b05
  "$@" -MD -MF "$tmpdepfile"
Packit 022b05
  stat=$?
Packit 022b05
  if test $stat -eq 0; then :
Packit 022b05
  else
Packit 022b05
    rm -f "$tmpdepfile"
Packit 022b05
    exit $stat
Packit 022b05
  fi
Packit 022b05
  rm -f "$depfile"
Packit 022b05
  # Each line is of the form `foo.o: dependent.h',
Packit 022b05
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
Packit 022b05
  # Do two passes, one to just change these to
Packit 022b05
  # `$object: dependent.h' and one to simply `dependent.h:'.
Packit 022b05
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
Packit 022b05
  # Some versions of the HPUX 10.20 sed can't process this invocation
Packit 022b05
  # correctly.  Breaking it into two sed invocations is a workaround.
Packit 022b05
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
Packit 022b05
    sed -e 's/$/ :/' >> "$depfile"
Packit 022b05
  rm -f "$tmpdepfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
hp2)
Packit 022b05
  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
Packit 022b05
  # compilers, which have integrated preprocessors.  The correct option
Packit 022b05
  # to use with these is +Maked; it writes dependencies to a file named
Packit 022b05
  # 'foo.d', which lands next to the object file, wherever that
Packit 022b05
  # happens to be.
Packit 022b05
  # Much of this is similar to the tru64 case; see comments there.
Packit 022b05
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
Packit 022b05
  test "x$dir" = "x$object" && dir=
Packit 022b05
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
Packit 022b05
  if test "$libtool" = yes; then
Packit 022b05
    tmpdepfile1=$dir$base.d
Packit 022b05
    tmpdepfile2=$dir.libs/$base.d
Packit 022b05
    "$@" -Wc,+Maked
Packit 022b05
  else
Packit 022b05
    tmpdepfile1=$dir$base.d
Packit 022b05
    tmpdepfile2=$dir$base.d
Packit 022b05
    "$@" +Maked
Packit 022b05
  fi
Packit 022b05
  stat=$?
Packit 022b05
  if test $stat -eq 0; then :
Packit 022b05
  else
Packit 022b05
     rm -f "$tmpdepfile1" "$tmpdepfile2"
Packit 022b05
     exit $stat
Packit 022b05
  fi
Packit 022b05
Packit 022b05
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
Packit 022b05
  do
Packit 022b05
    test -f "$tmpdepfile" && break
Packit 022b05
  done
Packit 022b05
  if test -f "$tmpdepfile"; then
Packit 022b05
    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
Packit 022b05
    # Add `dependent.h:' lines.
Packit 022b05
    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
Packit 022b05
  else
Packit 022b05
    echo "#dummy" > "$depfile"
Packit 022b05
  fi
Packit 022b05
  rm -f "$tmpdepfile" "$tmpdepfile2"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
tru64)
Packit 022b05
   # The Tru64 compiler uses -MD to generate dependencies as a side
Packit 022b05
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
Packit 022b05
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
Packit 022b05
   # dependencies in `foo.d' instead, so we check for that too.
Packit 022b05
   # Subdirectories are respected.
Packit 022b05
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
Packit 022b05
   test "x$dir" = "x$object" && dir=
Packit 022b05
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
Packit 022b05
Packit 022b05
   if test "$libtool" = yes; then
Packit 022b05
      # With Tru64 cc, shared objects can also be used to make a
Packit 022b05
      # static library.  This mechanism is used in libtool 1.4 series to
Packit 022b05
      # handle both shared and static libraries in a single compilation.
Packit 022b05
      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
Packit 022b05
      #
Packit 022b05
      # With libtool 1.5 this exception was removed, and libtool now
Packit 022b05
      # generates 2 separate objects for the 2 libraries.  These two
Packit 022b05
      # compilations output dependencies in $dir.libs/$base.o.d and
Packit 022b05
      # in $dir$base.o.d.  We have to check for both files, because
Packit 022b05
      # one of the two compilations can be disabled.  We should prefer
Packit 022b05
      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
Packit 022b05
      # automatically cleaned when .libs/ is deleted, while ignoring
Packit 022b05
      # the former would cause a distcleancheck panic.
Packit 022b05
      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
Packit 022b05
      tmpdepfile2=$dir$base.o.d          # libtool 1.5
Packit 022b05
      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
Packit 022b05
      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
Packit 022b05
      "$@" -Wc,-MD
Packit 022b05
   else
Packit 022b05
      tmpdepfile1=$dir$base.o.d
Packit 022b05
      tmpdepfile2=$dir$base.d
Packit 022b05
      tmpdepfile3=$dir$base.d
Packit 022b05
      tmpdepfile4=$dir$base.d
Packit 022b05
      "$@" -MD
Packit 022b05
   fi
Packit 022b05
Packit 022b05
   stat=$?
Packit 022b05
   if test $stat -eq 0; then :
Packit 022b05
   else
Packit 022b05
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
Packit 022b05
      exit $stat
Packit 022b05
   fi
Packit 022b05
Packit 022b05
   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
Packit 022b05
   do
Packit 022b05
     test -f "$tmpdepfile" && break
Packit 022b05
   done
Packit 022b05
   if test -f "$tmpdepfile"; then
Packit 022b05
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
Packit 022b05
      # That's a tab and a space in the [].
Packit 022b05
      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
Packit 022b05
   else
Packit 022b05
      echo "#dummy" > "$depfile"
Packit 022b05
   fi
Packit 022b05
   rm -f "$tmpdepfile"
Packit 022b05
   ;;
Packit 022b05
Packit 022b05
#nosideeffect)
Packit 022b05
  # This comment above is used by automake to tell side-effect
Packit 022b05
  # dependency tracking mechanisms from slower ones.
Packit 022b05
Packit 022b05
dashmstdout)
Packit 022b05
  # Important note: in order to support this mode, a compiler *must*
Packit 022b05
  # always write the preprocessed file to stdout, regardless of -o.
Packit 022b05
  "$@" || exit $?
Packit 022b05
Packit 022b05
  # Remove the call to Libtool.
Packit 022b05
  if test "$libtool" = yes; then
Packit 022b05
    while test $1 != '--mode=compile'; do
Packit 022b05
      shift
Packit 022b05
    done
Packit 022b05
    shift
Packit 022b05
  fi
Packit 022b05
Packit 022b05
  # Remove `-o $object'.
Packit 022b05
  IFS=" "
Packit 022b05
  for arg
Packit 022b05
  do
Packit 022b05
    case $arg in
Packit 022b05
    -o)
Packit 022b05
      shift
Packit 022b05
      ;;
Packit 022b05
    $object)
Packit 022b05
      shift
Packit 022b05
      ;;
Packit 022b05
    *)
Packit 022b05
      set fnord "$@" "$arg"
Packit 022b05
      shift # fnord
Packit 022b05
      shift # $arg
Packit 022b05
      ;;
Packit 022b05
    esac
Packit 022b05
  done
Packit 022b05
Packit 022b05
  test -z "$dashmflag" && dashmflag=-M
Packit 022b05
  # Require at least two characters before searching for `:'
Packit 022b05
  # in the target name.  This is to cope with DOS-style filenames:
Packit 022b05
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
Packit 022b05
  "$@" $dashmflag |
Packit 022b05
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
Packit 022b05
  rm -f "$depfile"
Packit 022b05
  cat < "$tmpdepfile" > "$depfile"
Packit 022b05
  tr ' ' '
Packit 022b05
' < "$tmpdepfile" | \
Packit 022b05
## Some versions of the HPUX 10.20 sed can't process this invocation
Packit 022b05
## correctly.  Breaking it into two sed invocations is a workaround.
Packit 022b05
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Packit 022b05
  rm -f "$tmpdepfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
dashXmstdout)
Packit 022b05
  # This case only exists to satisfy depend.m4.  It is never actually
Packit 022b05
  # run, as this mode is specially recognized in the preamble.
Packit 022b05
  exit 1
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
makedepend)
Packit 022b05
  "$@" || exit $?
Packit 022b05
  # Remove any Libtool call
Packit 022b05
  if test "$libtool" = yes; then
Packit 022b05
    while test $1 != '--mode=compile'; do
Packit 022b05
      shift
Packit 022b05
    done
Packit 022b05
    shift
Packit 022b05
  fi
Packit 022b05
  # X makedepend
Packit 022b05
  shift
Packit 022b05
  cleared=no
Packit 022b05
  for arg in "$@"; do
Packit 022b05
    case $cleared in
Packit 022b05
    no)
Packit 022b05
      set ""; shift
Packit 022b05
      cleared=yes ;;
Packit 022b05
    esac
Packit 022b05
    case "$arg" in
Packit 022b05
    -D*|-I*)
Packit 022b05
      set fnord "$@" "$arg"; shift ;;
Packit 022b05
    # Strip any option that makedepend may not understand.  Remove
Packit 022b05
    # the object too, otherwise makedepend will parse it as a source file.
Packit 022b05
    -*|$object)
Packit 022b05
      ;;
Packit 022b05
    *)
Packit 022b05
      set fnord "$@" "$arg"; shift ;;
Packit 022b05
    esac
Packit 022b05
  done
Packit 022b05
  obj_suffix="`echo $object | sed 's/^.*\././'`"
Packit 022b05
  touch "$tmpdepfile"
Packit 022b05
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
Packit 022b05
  rm -f "$depfile"
Packit 022b05
  cat < "$tmpdepfile" > "$depfile"
Packit 022b05
  sed '1,2d' "$tmpdepfile" | tr ' ' '
Packit 022b05
' | \
Packit 022b05
## Some versions of the HPUX 10.20 sed can't process this invocation
Packit 022b05
## correctly.  Breaking it into two sed invocations is a workaround.
Packit 022b05
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Packit 022b05
  rm -f "$tmpdepfile" "$tmpdepfile".bak
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
cpp)
Packit 022b05
  # Important note: in order to support this mode, a compiler *must*
Packit 022b05
  # always write the preprocessed file to stdout.
Packit 022b05
  "$@" || exit $?
Packit 022b05
Packit 022b05
  # Remove the call to Libtool.
Packit 022b05
  if test "$libtool" = yes; then
Packit 022b05
    while test $1 != '--mode=compile'; do
Packit 022b05
      shift
Packit 022b05
    done
Packit 022b05
    shift
Packit 022b05
  fi
Packit 022b05
Packit 022b05
  # Remove `-o $object'.
Packit 022b05
  IFS=" "
Packit 022b05
  for arg
Packit 022b05
  do
Packit 022b05
    case $arg in
Packit 022b05
    -o)
Packit 022b05
      shift
Packit 022b05
      ;;
Packit 022b05
    $object)
Packit 022b05
      shift
Packit 022b05
      ;;
Packit 022b05
    *)
Packit 022b05
      set fnord "$@" "$arg"
Packit 022b05
      shift # fnord
Packit 022b05
      shift # $arg
Packit 022b05
      ;;
Packit 022b05
    esac
Packit 022b05
  done
Packit 022b05
Packit 022b05
  "$@" -E |
Packit 022b05
    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
Packit 022b05
       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
Packit 022b05
    sed '$ s: \\$::' > "$tmpdepfile"
Packit 022b05
  rm -f "$depfile"
Packit 022b05
  echo "$object : \\" > "$depfile"
Packit 022b05
  cat < "$tmpdepfile" >> "$depfile"
Packit 022b05
  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
Packit 022b05
  rm -f "$tmpdepfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
msvisualcpp)
Packit 022b05
  # Important note: in order to support this mode, a compiler *must*
Packit 022b05
  # always write the preprocessed file to stdout, regardless of -o,
Packit 022b05
  # because we must use -o when running libtool.
Packit 022b05
  "$@" || exit $?
Packit 022b05
  IFS=" "
Packit 022b05
  for arg
Packit 022b05
  do
Packit 022b05
    case "$arg" in
Packit 022b05
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
Packit 022b05
	set fnord "$@"
Packit 022b05
	shift
Packit 022b05
	shift
Packit 022b05
	;;
Packit 022b05
    *)
Packit 022b05
	set fnord "$@" "$arg"
Packit 022b05
	shift
Packit 022b05
	shift
Packit 022b05
	;;
Packit 022b05
    esac
Packit 022b05
  done
Packit 022b05
  "$@" -E |
Packit 022b05
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
Packit 022b05
  rm -f "$depfile"
Packit 022b05
  echo "$object : \\" > "$depfile"
Packit 022b05
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
Packit 022b05
  echo "	" >> "$depfile"
Packit 022b05
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
Packit 022b05
  rm -f "$tmpdepfile"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
none)
Packit 022b05
  exec "$@"
Packit 022b05
  ;;
Packit 022b05
Packit 022b05
*)
Packit 022b05
  echo "Unknown depmode $depmode" 1>&2
Packit 022b05
  exit 1
Packit 022b05
  ;;
Packit 022b05
esac
Packit 022b05
Packit 022b05
exit 0
Packit 022b05
Packit 022b05
# Local Variables:
Packit 022b05
# mode: shell-script
Packit 022b05
# sh-indentation: 2
Packit 022b05
# eval: (add-hook 'write-file-hooks 'time-stamp)
Packit 022b05
# time-stamp-start: "scriptversion="
Packit 022b05
# time-stamp-format: "%:y-%02m-%02d.%02H"
Packit 022b05
# time-stamp-end: "$"
Packit 022b05
# End: