depcomp revision 09885543
109885543Smrg#! /bin/sh 209885543Smrg# depcomp - compile a program generating dependencies as side-effects 309885543Smrg 409885543Smrgscriptversion=2005-07-09.11 509885543Smrg 609885543Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 709885543Smrg 809885543Smrg# This program is free software; you can redistribute it and/or modify 909885543Smrg# it under the terms of the GNU General Public License as published by 1009885543Smrg# the Free Software Foundation; either version 2, or (at your option) 1109885543Smrg# any later version. 1209885543Smrg 1309885543Smrg# This program is distributed in the hope that it will be useful, 1409885543Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1509885543Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1609885543Smrg# GNU General Public License for more details. 1709885543Smrg 1809885543Smrg# You should have received a copy of the GNU General Public License 1909885543Smrg# along with this program; if not, write to the Free Software 2009885543Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2109885543Smrg# 02110-1301, USA. 2209885543Smrg 2309885543Smrg# As a special exception to the GNU General Public License, if you 2409885543Smrg# distribute this file as part of a program that contains a 2509885543Smrg# configuration script generated by Autoconf, you may include it under 2609885543Smrg# the same distribution terms that you use for the rest of that program. 2709885543Smrg 2809885543Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 2909885543Smrg 3009885543Smrgcase $1 in 3109885543Smrg '') 3209885543Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 3309885543Smrg exit 1; 3409885543Smrg ;; 3509885543Smrg -h | --h*) 3609885543Smrg cat <<\EOF 3709885543SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 3809885543Smrg 3909885543SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 4009885543Smrgas side-effects. 4109885543Smrg 4209885543SmrgEnvironment variables: 4309885543Smrg depmode Dependency tracking mode. 4409885543Smrg source Source file read by `PROGRAMS ARGS'. 4509885543Smrg object Object file output by `PROGRAMS ARGS'. 4609885543Smrg DEPDIR directory where to store dependencies. 4709885543Smrg depfile Dependency file to output. 4809885543Smrg tmpdepfile Temporary file to use when outputing dependencies. 4909885543Smrg libtool Whether libtool is used (yes/no). 5009885543Smrg 5109885543SmrgReport bugs to <bug-automake@gnu.org>. 5209885543SmrgEOF 5309885543Smrg exit $? 5409885543Smrg ;; 5509885543Smrg -v | --v*) 5609885543Smrg echo "depcomp $scriptversion" 5709885543Smrg exit $? 5809885543Smrg ;; 5909885543Smrgesac 6009885543Smrg 6109885543Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 6209885543Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 6309885543Smrg exit 1 6409885543Smrgfi 6509885543Smrg 6609885543Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 6709885543Smrgdepfile=${depfile-`echo "$object" | 6809885543Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 6909885543Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 7009885543Smrg 7109885543Smrgrm -f "$tmpdepfile" 7209885543Smrg 7309885543Smrg# Some modes work just like other modes, but use different flags. We 7409885543Smrg# parameterize here, but still list the modes in the big case below, 7509885543Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 7609885543Smrg# here, because this file can only contain one case statement. 7709885543Smrgif test "$depmode" = hp; then 7809885543Smrg # HP compiler uses -M and no extra arg. 7909885543Smrg gccflag=-M 8009885543Smrg depmode=gcc 8109885543Smrgfi 8209885543Smrg 8309885543Smrgif test "$depmode" = dashXmstdout; then 8409885543Smrg # This is just like dashmstdout with a different argument. 8509885543Smrg dashmflag=-xM 8609885543Smrg depmode=dashmstdout 8709885543Smrgfi 8809885543Smrg 8909885543Smrgcase "$depmode" in 9009885543Smrggcc3) 9109885543Smrg## gcc 3 implements dependency tracking that does exactly what 9209885543Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 9309885543Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 9409885543Smrg "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 9509885543Smrg stat=$? 9609885543Smrg if test $stat -eq 0; then : 9709885543Smrg else 9809885543Smrg rm -f "$tmpdepfile" 9909885543Smrg exit $stat 10009885543Smrg fi 10109885543Smrg mv "$tmpdepfile" "$depfile" 10209885543Smrg ;; 10309885543Smrg 10409885543Smrggcc) 10509885543Smrg## There are various ways to get dependency output from gcc. Here's 10609885543Smrg## why we pick this rather obscure method: 10709885543Smrg## - Don't want to use -MD because we'd like the dependencies to end 10809885543Smrg## up in a subdir. Having to rename by hand is ugly. 10909885543Smrg## (We might end up doing this anyway to support other compilers.) 11009885543Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 11109885543Smrg## -MM, not -M (despite what the docs say). 11209885543Smrg## - Using -M directly means running the compiler twice (even worse 11309885543Smrg## than renaming). 11409885543Smrg if test -z "$gccflag"; then 11509885543Smrg gccflag=-MD, 11609885543Smrg fi 11709885543Smrg "$@" -Wp,"$gccflag$tmpdepfile" 11809885543Smrg stat=$? 11909885543Smrg if test $stat -eq 0; then : 12009885543Smrg else 12109885543Smrg rm -f "$tmpdepfile" 12209885543Smrg exit $stat 12309885543Smrg fi 12409885543Smrg rm -f "$depfile" 12509885543Smrg echo "$object : \\" > "$depfile" 12609885543Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 12709885543Smrg## The second -e expression handles DOS-style file names with drive letters. 12809885543Smrg sed -e 's/^[^:]*: / /' \ 12909885543Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 13009885543Smrg## This next piece of magic avoids the `deleted header file' problem. 13109885543Smrg## The problem is that when a header file which appears in a .P file 13209885543Smrg## is deleted, the dependency causes make to die (because there is 13309885543Smrg## typically no way to rebuild the header). We avoid this by adding 13409885543Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 13509885543Smrg## this for us directly. 13609885543Smrg tr ' ' ' 13709885543Smrg' < "$tmpdepfile" | 13809885543Smrg## Some versions of gcc put a space before the `:'. On the theory 13909885543Smrg## that the space means something, we add a space to the output as 14009885543Smrg## well. 14109885543Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 14209885543Smrg## correctly. Breaking it into two sed invocations is a workaround. 14309885543Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 14409885543Smrg rm -f "$tmpdepfile" 14509885543Smrg ;; 14609885543Smrg 14709885543Smrghp) 14809885543Smrg # This case exists only to let depend.m4 do its work. It works by 14909885543Smrg # looking at the text of this script. This case will never be run, 15009885543Smrg # since it is checked for above. 15109885543Smrg exit 1 15209885543Smrg ;; 15309885543Smrg 15409885543Smrgsgi) 15509885543Smrg if test "$libtool" = yes; then 15609885543Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 15709885543Smrg else 15809885543Smrg "$@" -MDupdate "$tmpdepfile" 15909885543Smrg fi 16009885543Smrg stat=$? 16109885543Smrg if test $stat -eq 0; then : 16209885543Smrg else 16309885543Smrg rm -f "$tmpdepfile" 16409885543Smrg exit $stat 16509885543Smrg fi 16609885543Smrg rm -f "$depfile" 16709885543Smrg 16809885543Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 16909885543Smrg echo "$object : \\" > "$depfile" 17009885543Smrg 17109885543Smrg # Clip off the initial element (the dependent). Don't try to be 17209885543Smrg # clever and replace this with sed code, as IRIX sed won't handle 17309885543Smrg # lines with more than a fixed number of characters (4096 in 17409885543Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 17509885543Smrg # the IRIX cc adds comments like `#:fec' to the end of the 17609885543Smrg # dependency line. 17709885543Smrg tr ' ' ' 17809885543Smrg' < "$tmpdepfile" \ 17909885543Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 18009885543Smrg tr ' 18109885543Smrg' ' ' >> $depfile 18209885543Smrg echo >> $depfile 18309885543Smrg 18409885543Smrg # The second pass generates a dummy entry for each header file. 18509885543Smrg tr ' ' ' 18609885543Smrg' < "$tmpdepfile" \ 18709885543Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 18809885543Smrg >> $depfile 18909885543Smrg else 19009885543Smrg # The sourcefile does not contain any dependencies, so just 19109885543Smrg # store a dummy comment line, to avoid errors with the Makefile 19209885543Smrg # "include basename.Plo" scheme. 19309885543Smrg echo "#dummy" > "$depfile" 19409885543Smrg fi 19509885543Smrg rm -f "$tmpdepfile" 19609885543Smrg ;; 19709885543Smrg 19809885543Smrgaix) 19909885543Smrg # The C for AIX Compiler uses -M and outputs the dependencies 20009885543Smrg # in a .u file. In older versions, this file always lives in the 20109885543Smrg # current directory. Also, the AIX compiler puts `$object:' at the 20209885543Smrg # start of each line; $object doesn't have directory information. 20309885543Smrg # Version 6 uses the directory in both cases. 20409885543Smrg stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 20509885543Smrg tmpdepfile="$stripped.u" 20609885543Smrg if test "$libtool" = yes; then 20709885543Smrg "$@" -Wc,-M 20809885543Smrg else 20909885543Smrg "$@" -M 21009885543Smrg fi 21109885543Smrg stat=$? 21209885543Smrg 21309885543Smrg if test -f "$tmpdepfile"; then : 21409885543Smrg else 21509885543Smrg stripped=`echo "$stripped" | sed 's,^.*/,,'` 21609885543Smrg tmpdepfile="$stripped.u" 21709885543Smrg fi 21809885543Smrg 21909885543Smrg if test $stat -eq 0; then : 22009885543Smrg else 22109885543Smrg rm -f "$tmpdepfile" 22209885543Smrg exit $stat 22309885543Smrg fi 22409885543Smrg 22509885543Smrg if test -f "$tmpdepfile"; then 22609885543Smrg outname="$stripped.o" 22709885543Smrg # Each line is of the form `foo.o: dependent.h'. 22809885543Smrg # Do two passes, one to just change these to 22909885543Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 23009885543Smrg sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 23109885543Smrg sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 23209885543Smrg else 23309885543Smrg # The sourcefile does not contain any dependencies, so just 23409885543Smrg # store a dummy comment line, to avoid errors with the Makefile 23509885543Smrg # "include basename.Plo" scheme. 23609885543Smrg echo "#dummy" > "$depfile" 23709885543Smrg fi 23809885543Smrg rm -f "$tmpdepfile" 23909885543Smrg ;; 24009885543Smrg 24109885543Smrgicc) 24209885543Smrg # Intel's C compiler understands `-MD -MF file'. However on 24309885543Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 24409885543Smrg # ICC 7.0 will fill foo.d with something like 24509885543Smrg # foo.o: sub/foo.c 24609885543Smrg # foo.o: sub/foo.h 24709885543Smrg # which is wrong. We want: 24809885543Smrg # sub/foo.o: sub/foo.c 24909885543Smrg # sub/foo.o: sub/foo.h 25009885543Smrg # sub/foo.c: 25109885543Smrg # sub/foo.h: 25209885543Smrg # ICC 7.1 will output 25309885543Smrg # foo.o: sub/foo.c sub/foo.h 25409885543Smrg # and will wrap long lines using \ : 25509885543Smrg # foo.o: sub/foo.c ... \ 25609885543Smrg # sub/foo.h ... \ 25709885543Smrg # ... 25809885543Smrg 25909885543Smrg "$@" -MD -MF "$tmpdepfile" 26009885543Smrg stat=$? 26109885543Smrg if test $stat -eq 0; then : 26209885543Smrg else 26309885543Smrg rm -f "$tmpdepfile" 26409885543Smrg exit $stat 26509885543Smrg fi 26609885543Smrg rm -f "$depfile" 26709885543Smrg # Each line is of the form `foo.o: dependent.h', 26809885543Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 26909885543Smrg # Do two passes, one to just change these to 27009885543Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 27109885543Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 27209885543Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 27309885543Smrg # correctly. Breaking it into two sed invocations is a workaround. 27409885543Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 27509885543Smrg sed -e 's/$/ :/' >> "$depfile" 27609885543Smrg rm -f "$tmpdepfile" 27709885543Smrg ;; 27809885543Smrg 27909885543Smrgtru64) 28009885543Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 28109885543Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 28209885543Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 28309885543Smrg # dependencies in `foo.d' instead, so we check for that too. 28409885543Smrg # Subdirectories are respected. 28509885543Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 28609885543Smrg test "x$dir" = "x$object" && dir= 28709885543Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 28809885543Smrg 28909885543Smrg if test "$libtool" = yes; then 29009885543Smrg # With Tru64 cc, shared objects can also be used to make a 29109885543Smrg # static library. This mecanism is used in libtool 1.4 series to 29209885543Smrg # handle both shared and static libraries in a single compilation. 29309885543Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 29409885543Smrg # 29509885543Smrg # With libtool 1.5 this exception was removed, and libtool now 29609885543Smrg # generates 2 separate objects for the 2 libraries. These two 29709885543Smrg # compilations output dependencies in in $dir.libs/$base.o.d and 29809885543Smrg # in $dir$base.o.d. We have to check for both files, because 29909885543Smrg # one of the two compilations can be disabled. We should prefer 30009885543Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 30109885543Smrg # automatically cleaned when .libs/ is deleted, while ignoring 30209885543Smrg # the former would cause a distcleancheck panic. 30309885543Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 30409885543Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 30509885543Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 30609885543Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 30709885543Smrg "$@" -Wc,-MD 30809885543Smrg else 30909885543Smrg tmpdepfile1=$dir$base.o.d 31009885543Smrg tmpdepfile2=$dir$base.d 31109885543Smrg tmpdepfile3=$dir$base.d 31209885543Smrg tmpdepfile4=$dir$base.d 31309885543Smrg "$@" -MD 31409885543Smrg fi 31509885543Smrg 31609885543Smrg stat=$? 31709885543Smrg if test $stat -eq 0; then : 31809885543Smrg else 31909885543Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 32009885543Smrg exit $stat 32109885543Smrg fi 32209885543Smrg 32309885543Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 32409885543Smrg do 32509885543Smrg test -f "$tmpdepfile" && break 32609885543Smrg done 32709885543Smrg if test -f "$tmpdepfile"; then 32809885543Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 32909885543Smrg # That's a tab and a space in the []. 33009885543Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 33109885543Smrg else 33209885543Smrg echo "#dummy" > "$depfile" 33309885543Smrg fi 33409885543Smrg rm -f "$tmpdepfile" 33509885543Smrg ;; 33609885543Smrg 33709885543Smrg#nosideeffect) 33809885543Smrg # This comment above is used by automake to tell side-effect 33909885543Smrg # dependency tracking mechanisms from slower ones. 34009885543Smrg 34109885543Smrgdashmstdout) 34209885543Smrg # Important note: in order to support this mode, a compiler *must* 34309885543Smrg # always write the preprocessed file to stdout, regardless of -o. 34409885543Smrg "$@" || exit $? 34509885543Smrg 34609885543Smrg # Remove the call to Libtool. 34709885543Smrg if test "$libtool" = yes; then 34809885543Smrg while test $1 != '--mode=compile'; do 34909885543Smrg shift 35009885543Smrg done 35109885543Smrg shift 35209885543Smrg fi 35309885543Smrg 35409885543Smrg # Remove `-o $object'. 35509885543Smrg IFS=" " 35609885543Smrg for arg 35709885543Smrg do 35809885543Smrg case $arg in 35909885543Smrg -o) 36009885543Smrg shift 36109885543Smrg ;; 36209885543Smrg $object) 36309885543Smrg shift 36409885543Smrg ;; 36509885543Smrg *) 36609885543Smrg set fnord "$@" "$arg" 36709885543Smrg shift # fnord 36809885543Smrg shift # $arg 36909885543Smrg ;; 37009885543Smrg esac 37109885543Smrg done 37209885543Smrg 37309885543Smrg test -z "$dashmflag" && dashmflag=-M 37409885543Smrg # Require at least two characters before searching for `:' 37509885543Smrg # in the target name. This is to cope with DOS-style filenames: 37609885543Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 37709885543Smrg "$@" $dashmflag | 37809885543Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 37909885543Smrg rm -f "$depfile" 38009885543Smrg cat < "$tmpdepfile" > "$depfile" 38109885543Smrg tr ' ' ' 38209885543Smrg' < "$tmpdepfile" | \ 38309885543Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 38409885543Smrg## correctly. Breaking it into two sed invocations is a workaround. 38509885543Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 38609885543Smrg rm -f "$tmpdepfile" 38709885543Smrg ;; 38809885543Smrg 38909885543SmrgdashXmstdout) 39009885543Smrg # This case only exists to satisfy depend.m4. It is never actually 39109885543Smrg # run, as this mode is specially recognized in the preamble. 39209885543Smrg exit 1 39309885543Smrg ;; 39409885543Smrg 39509885543Smrgmakedepend) 39609885543Smrg "$@" || exit $? 39709885543Smrg # Remove any Libtool call 39809885543Smrg if test "$libtool" = yes; then 39909885543Smrg while test $1 != '--mode=compile'; do 40009885543Smrg shift 40109885543Smrg done 40209885543Smrg shift 40309885543Smrg fi 40409885543Smrg # X makedepend 40509885543Smrg shift 40609885543Smrg cleared=no 40709885543Smrg for arg in "$@"; do 40809885543Smrg case $cleared in 40909885543Smrg no) 41009885543Smrg set ""; shift 41109885543Smrg cleared=yes ;; 41209885543Smrg esac 41309885543Smrg case "$arg" in 41409885543Smrg -D*|-I*) 41509885543Smrg set fnord "$@" "$arg"; shift ;; 41609885543Smrg # Strip any option that makedepend may not understand. Remove 41709885543Smrg # the object too, otherwise makedepend will parse it as a source file. 41809885543Smrg -*|$object) 41909885543Smrg ;; 42009885543Smrg *) 42109885543Smrg set fnord "$@" "$arg"; shift ;; 42209885543Smrg esac 42309885543Smrg done 42409885543Smrg obj_suffix="`echo $object | sed 's/^.*\././'`" 42509885543Smrg touch "$tmpdepfile" 42609885543Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 42709885543Smrg rm -f "$depfile" 42809885543Smrg cat < "$tmpdepfile" > "$depfile" 42909885543Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 43009885543Smrg' | \ 43109885543Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 43209885543Smrg## correctly. Breaking it into two sed invocations is a workaround. 43309885543Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 43409885543Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 43509885543Smrg ;; 43609885543Smrg 43709885543Smrgcpp) 43809885543Smrg # Important note: in order to support this mode, a compiler *must* 43909885543Smrg # always write the preprocessed file to stdout. 44009885543Smrg "$@" || exit $? 44109885543Smrg 44209885543Smrg # Remove the call to Libtool. 44309885543Smrg if test "$libtool" = yes; then 44409885543Smrg while test $1 != '--mode=compile'; do 44509885543Smrg shift 44609885543Smrg done 44709885543Smrg shift 44809885543Smrg fi 44909885543Smrg 45009885543Smrg # Remove `-o $object'. 45109885543Smrg IFS=" " 45209885543Smrg for arg 45309885543Smrg do 45409885543Smrg case $arg in 45509885543Smrg -o) 45609885543Smrg shift 45709885543Smrg ;; 45809885543Smrg $object) 45909885543Smrg shift 46009885543Smrg ;; 46109885543Smrg *) 46209885543Smrg set fnord "$@" "$arg" 46309885543Smrg shift # fnord 46409885543Smrg shift # $arg 46509885543Smrg ;; 46609885543Smrg esac 46709885543Smrg done 46809885543Smrg 46909885543Smrg "$@" -E | 47009885543Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 47109885543Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 47209885543Smrg sed '$ s: \\$::' > "$tmpdepfile" 47309885543Smrg rm -f "$depfile" 47409885543Smrg echo "$object : \\" > "$depfile" 47509885543Smrg cat < "$tmpdepfile" >> "$depfile" 47609885543Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 47709885543Smrg rm -f "$tmpdepfile" 47809885543Smrg ;; 47909885543Smrg 48009885543Smrgmsvisualcpp) 48109885543Smrg # Important note: in order to support this mode, a compiler *must* 48209885543Smrg # always write the preprocessed file to stdout, regardless of -o, 48309885543Smrg # because we must use -o when running libtool. 48409885543Smrg "$@" || exit $? 48509885543Smrg IFS=" " 48609885543Smrg for arg 48709885543Smrg do 48809885543Smrg case "$arg" in 48909885543Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 49009885543Smrg set fnord "$@" 49109885543Smrg shift 49209885543Smrg shift 49309885543Smrg ;; 49409885543Smrg *) 49509885543Smrg set fnord "$@" "$arg" 49609885543Smrg shift 49709885543Smrg shift 49809885543Smrg ;; 49909885543Smrg esac 50009885543Smrg done 50109885543Smrg "$@" -E | 50209885543Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 50309885543Smrg rm -f "$depfile" 50409885543Smrg echo "$object : \\" > "$depfile" 50509885543Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 50609885543Smrg echo " " >> "$depfile" 50709885543Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 50809885543Smrg rm -f "$tmpdepfile" 50909885543Smrg ;; 51009885543Smrg 51109885543Smrgnone) 51209885543Smrg exec "$@" 51309885543Smrg ;; 51409885543Smrg 51509885543Smrg*) 51609885543Smrg echo "Unknown depmode $depmode" 1>&2 51709885543Smrg exit 1 51809885543Smrg ;; 51909885543Smrgesac 52009885543Smrg 52109885543Smrgexit 0 52209885543Smrg 52309885543Smrg# Local Variables: 52409885543Smrg# mode: shell-script 52509885543Smrg# sh-indentation: 2 52609885543Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 52709885543Smrg# time-stamp-start: "scriptversion=" 52809885543Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 52909885543Smrg# time-stamp-end: "$" 53009885543Smrg# End: 531