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