Blame depcomp

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