Blame hdspconf/depcomp

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