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