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