Blame depcomp

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