Blame depcomp

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