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