Blame depcomp

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