Blame depcomp

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