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