Blame build-aux/depcomp

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