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