depcomp revision 5c10afb9
15c10afb9Smrg#! /bin/sh 25c10afb9Smrg 35c10afb9Smrg# depcomp - compile a program generating dependencies as side-effects 45c10afb9Smrg# Copyright 1999, 2000, 2003 Free Software Foundation, Inc. 55c10afb9Smrg 65c10afb9Smrg# This program is free software; you can redistribute it and/or modify 75c10afb9Smrg# it under the terms of the GNU General Public License as published by 85c10afb9Smrg# the Free Software Foundation; either version 2, or (at your option) 95c10afb9Smrg# any later version. 105c10afb9Smrg 115c10afb9Smrg# This program is distributed in the hope that it will be useful, 125c10afb9Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 135c10afb9Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 145c10afb9Smrg# GNU General Public License for more details. 155c10afb9Smrg 165c10afb9Smrg# You should have received a copy of the GNU General Public License 175c10afb9Smrg# along with this program; if not, write to the Free Software 185c10afb9Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 195c10afb9Smrg# 02111-1307, USA. 205c10afb9Smrg 215c10afb9Smrg# As a special exception to the GNU General Public License, if you 225c10afb9Smrg# distribute this file as part of a program that contains a 235c10afb9Smrg# configuration script generated by Autoconf, you may include it under 245c10afb9Smrg# the same distribution terms that you use for the rest of that program. 255c10afb9Smrg 265c10afb9Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 275c10afb9Smrg 285c10afb9Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 295c10afb9Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 305c10afb9Smrg exit 1 315c10afb9Smrgfi 325c10afb9Smrg# `libtool' can also be set to `yes' or `no'. 335c10afb9Smrg 345c10afb9Smrgif test -z "$depfile"; then 355c10afb9Smrg base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` 365c10afb9Smrg dir=`echo "$object" | sed 's,/.*$,/,'` 375c10afb9Smrg if test "$dir" = "$object"; then 385c10afb9Smrg dir= 395c10afb9Smrg fi 405c10afb9Smrg # FIXME: should be _deps on DOS. 415c10afb9Smrg depfile="$dir.deps/$base" 425c10afb9Smrgfi 435c10afb9Smrg 445c10afb9Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 455c10afb9Smrg 465c10afb9Smrgrm -f "$tmpdepfile" 475c10afb9Smrg 485c10afb9Smrg# Some modes work just like other modes, but use different flags. We 495c10afb9Smrg# parameterize here, but still list the modes in the big case below, 505c10afb9Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 515c10afb9Smrg# here, because this file can only contain one case statement. 525c10afb9Smrgif test "$depmode" = hp; then 535c10afb9Smrg # HP compiler uses -M and no extra arg. 545c10afb9Smrg gccflag=-M 555c10afb9Smrg depmode=gcc 565c10afb9Smrgfi 575c10afb9Smrg 585c10afb9Smrgif test "$depmode" = dashXmstdout; then 595c10afb9Smrg # This is just like dashmstdout with a different argument. 605c10afb9Smrg dashmflag=-xM 615c10afb9Smrg depmode=dashmstdout 625c10afb9Smrgfi 635c10afb9Smrg 645c10afb9Smrgcase "$depmode" in 655c10afb9Smrggcc3) 665c10afb9Smrg## gcc 3 implements dependency tracking that does exactly what 675c10afb9Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 685c10afb9Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 695c10afb9Smrg "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 705c10afb9Smrg stat=$? 715c10afb9Smrg if test $stat -eq 0; then : 725c10afb9Smrg else 735c10afb9Smrg rm -f "$tmpdepfile" 745c10afb9Smrg exit $stat 755c10afb9Smrg fi 765c10afb9Smrg mv "$tmpdepfile" "$depfile" 775c10afb9Smrg ;; 785c10afb9Smrg 795c10afb9Smrggcc) 805c10afb9Smrg## There are various ways to get dependency output from gcc. Here's 815c10afb9Smrg## why we pick this rather obscure method: 825c10afb9Smrg## - Don't want to use -MD because we'd like the dependencies to end 835c10afb9Smrg## up in a subdir. Having to rename by hand is ugly. 845c10afb9Smrg## (We might end up doing this anyway to support other compilers.) 855c10afb9Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 865c10afb9Smrg## -MM, not -M (despite what the docs say). 875c10afb9Smrg## - Using -M directly means running the compiler twice (even worse 885c10afb9Smrg## than renaming). 895c10afb9Smrg if test -z "$gccflag"; then 905c10afb9Smrg gccflag=-MD, 915c10afb9Smrg fi 925c10afb9Smrg "$@" -Wp,"$gccflag$tmpdepfile" 935c10afb9Smrg stat=$? 945c10afb9Smrg if test $stat -eq 0; then : 955c10afb9Smrg else 965c10afb9Smrg rm -f "$tmpdepfile" 975c10afb9Smrg exit $stat 985c10afb9Smrg fi 995c10afb9Smrg rm -f "$depfile" 1005c10afb9Smrg echo "$object : \\" > "$depfile" 1015c10afb9Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1025c10afb9Smrg## The second -e expression handles DOS-style file names with drive letters. 1035c10afb9Smrg sed -e 's/^[^:]*: / /' \ 1045c10afb9Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1055c10afb9Smrg## This next piece of magic avoids the `deleted header file' problem. 1065c10afb9Smrg## The problem is that when a header file which appears in a .P file 1075c10afb9Smrg## is deleted, the dependency causes make to die (because there is 1085c10afb9Smrg## typically no way to rebuild the header). We avoid this by adding 1095c10afb9Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 1105c10afb9Smrg## this for us directly. 1115c10afb9Smrg tr ' ' ' 1125c10afb9Smrg' < "$tmpdepfile" | 1135c10afb9Smrg## Some versions of gcc put a space before the `:'. On the theory 1145c10afb9Smrg## that the space means something, we add a space to the output as 1155c10afb9Smrg## well. 1165c10afb9Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 1175c10afb9Smrg## correctly. Breaking it into two sed invocations is a workaround. 1185c10afb9Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 1195c10afb9Smrg rm -f "$tmpdepfile" 1205c10afb9Smrg ;; 1215c10afb9Smrg 1225c10afb9Smrghp) 1235c10afb9Smrg # This case exists only to let depend.m4 do its work. It works by 1245c10afb9Smrg # looking at the text of this script. This case will never be run, 1255c10afb9Smrg # since it is checked for above. 1265c10afb9Smrg exit 1 1275c10afb9Smrg ;; 1285c10afb9Smrg 1295c10afb9Smrgsgi) 1305c10afb9Smrg if test "$libtool" = yes; then 1315c10afb9Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 1325c10afb9Smrg else 1335c10afb9Smrg "$@" -MDupdate "$tmpdepfile" 1345c10afb9Smrg fi 1355c10afb9Smrg stat=$? 1365c10afb9Smrg if test $stat -eq 0; then : 1375c10afb9Smrg else 1385c10afb9Smrg rm -f "$tmpdepfile" 1395c10afb9Smrg exit $stat 1405c10afb9Smrg fi 1415c10afb9Smrg rm -f "$depfile" 1425c10afb9Smrg 1435c10afb9Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1445c10afb9Smrg echo "$object : \\" > "$depfile" 1455c10afb9Smrg 1465c10afb9Smrg # Clip off the initial element (the dependent). Don't try to be 1475c10afb9Smrg # clever and replace this with sed code, as IRIX sed won't handle 1485c10afb9Smrg # lines with more than a fixed number of characters (4096 in 1495c10afb9Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1505c10afb9Smrg # the IRIX cc adds comments like `#:fec' to the end of the 1515c10afb9Smrg # dependency line. 1525c10afb9Smrg tr ' ' ' 1535c10afb9Smrg' < "$tmpdepfile" \ 1545c10afb9Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 1555c10afb9Smrg tr ' 1565c10afb9Smrg' ' ' >> $depfile 1575c10afb9Smrg echo >> $depfile 1585c10afb9Smrg 1595c10afb9Smrg # The second pass generates a dummy entry for each header file. 1605c10afb9Smrg tr ' ' ' 1615c10afb9Smrg' < "$tmpdepfile" \ 1625c10afb9Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 1635c10afb9Smrg >> $depfile 1645c10afb9Smrg else 1655c10afb9Smrg # The sourcefile does not contain any dependencies, so just 1665c10afb9Smrg # store a dummy comment line, to avoid errors with the Makefile 1675c10afb9Smrg # "include basename.Plo" scheme. 1685c10afb9Smrg echo "#dummy" > "$depfile" 1695c10afb9Smrg fi 1705c10afb9Smrg rm -f "$tmpdepfile" 1715c10afb9Smrg ;; 1725c10afb9Smrg 1735c10afb9Smrgaix) 1745c10afb9Smrg # The C for AIX Compiler uses -M and outputs the dependencies 1755c10afb9Smrg # in a .u file. In older versions, this file always lives in the 1765c10afb9Smrg # current directory. Also, the AIX compiler puts `$object:' at the 1775c10afb9Smrg # start of each line; $object doesn't have directory information. 1785c10afb9Smrg # Version 6 uses the directory in both cases. 1795c10afb9Smrg stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 1805c10afb9Smrg tmpdepfile="$stripped.u" 1815c10afb9Smrg if test "$libtool" = yes; then 1825c10afb9Smrg "$@" -Wc,-M 1835c10afb9Smrg else 1845c10afb9Smrg "$@" -M 1855c10afb9Smrg fi 1865c10afb9Smrg stat=$? 1875c10afb9Smrg 1885c10afb9Smrg if test -f "$tmpdepfile"; then : 1895c10afb9Smrg else 1905c10afb9Smrg stripped=`echo "$stripped" | sed 's,^.*/,,'` 1915c10afb9Smrg tmpdepfile="$stripped.u" 1925c10afb9Smrg fi 1935c10afb9Smrg 1945c10afb9Smrg if test $stat -eq 0; then : 1955c10afb9Smrg else 1965c10afb9Smrg rm -f "$tmpdepfile" 1975c10afb9Smrg exit $stat 1985c10afb9Smrg fi 1995c10afb9Smrg 2005c10afb9Smrg if test -f "$tmpdepfile"; then 2015c10afb9Smrg outname="$stripped.o" 2025c10afb9Smrg # Each line is of the form `foo.o: dependent.h'. 2035c10afb9Smrg # Do two passes, one to just change these to 2045c10afb9Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 2055c10afb9Smrg sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 2065c10afb9Smrg sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 2075c10afb9Smrg else 2085c10afb9Smrg # The sourcefile does not contain any dependencies, so just 2095c10afb9Smrg # store a dummy comment line, to avoid errors with the Makefile 2105c10afb9Smrg # "include basename.Plo" scheme. 2115c10afb9Smrg echo "#dummy" > "$depfile" 2125c10afb9Smrg fi 2135c10afb9Smrg rm -f "$tmpdepfile" 2145c10afb9Smrg ;; 2155c10afb9Smrg 2165c10afb9Smrgicc) 2175c10afb9Smrg # Intel's C compiler understands `-MD -MF file'. However on 2185c10afb9Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 2195c10afb9Smrg # ICC 7.0 will fill foo.d with something like 2205c10afb9Smrg # foo.o: sub/foo.c 2215c10afb9Smrg # foo.o: sub/foo.h 2225c10afb9Smrg # which is wrong. We want: 2235c10afb9Smrg # sub/foo.o: sub/foo.c 2245c10afb9Smrg # sub/foo.o: sub/foo.h 2255c10afb9Smrg # sub/foo.c: 2265c10afb9Smrg # sub/foo.h: 2275c10afb9Smrg # ICC 7.1 will output 2285c10afb9Smrg # foo.o: sub/foo.c sub/foo.h 2295c10afb9Smrg # and will wrap long lines using \ : 2305c10afb9Smrg # foo.o: sub/foo.c ... \ 2315c10afb9Smrg # sub/foo.h ... \ 2325c10afb9Smrg # ... 2335c10afb9Smrg 2345c10afb9Smrg "$@" -MD -MF "$tmpdepfile" 2355c10afb9Smrg stat=$? 2365c10afb9Smrg if test $stat -eq 0; then : 2375c10afb9Smrg else 2385c10afb9Smrg rm -f "$tmpdepfile" 2395c10afb9Smrg exit $stat 2405c10afb9Smrg fi 2415c10afb9Smrg rm -f "$depfile" 2425c10afb9Smrg # Each line is of the form `foo.o: dependent.h', 2435c10afb9Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 2445c10afb9Smrg # Do two passes, one to just change these to 2455c10afb9Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 2465c10afb9Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 2475c10afb9Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 2485c10afb9Smrg # correctly. Breaking it into two sed invocations is a workaround. 2495c10afb9Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 2505c10afb9Smrg sed -e 's/$/ :/' >> "$depfile" 2515c10afb9Smrg rm -f "$tmpdepfile" 2525c10afb9Smrg ;; 2535c10afb9Smrg 2545c10afb9Smrgtru64) 2555c10afb9Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 2565c10afb9Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 2575c10afb9Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 2585c10afb9Smrg # dependencies in `foo.d' instead, so we check for that too. 2595c10afb9Smrg # Subdirectories are respected. 2605c10afb9Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2615c10afb9Smrg test "x$dir" = "x$object" && dir= 2625c10afb9Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 2635c10afb9Smrg 2645c10afb9Smrg if test "$libtool" = yes; then 2655c10afb9Smrg tmpdepfile1="$dir.libs/$base.lo.d" 2665c10afb9Smrg tmpdepfile2="$dir.libs/$base.d" 2675c10afb9Smrg "$@" -Wc,-MD 2685c10afb9Smrg else 2695c10afb9Smrg tmpdepfile1="$dir$base.o.d" 2705c10afb9Smrg tmpdepfile2="$dir$base.d" 2715c10afb9Smrg "$@" -MD 2725c10afb9Smrg fi 2735c10afb9Smrg 2745c10afb9Smrg stat=$? 2755c10afb9Smrg if test $stat -eq 0; then : 2765c10afb9Smrg else 2775c10afb9Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 2785c10afb9Smrg exit $stat 2795c10afb9Smrg fi 2805c10afb9Smrg 2815c10afb9Smrg if test -f "$tmpdepfile1"; then 2825c10afb9Smrg tmpdepfile="$tmpdepfile1" 2835c10afb9Smrg else 2845c10afb9Smrg tmpdepfile="$tmpdepfile2" 2855c10afb9Smrg fi 2865c10afb9Smrg if test -f "$tmpdepfile"; then 2875c10afb9Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2885c10afb9Smrg # That's a tab and a space in the []. 2895c10afb9Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 2905c10afb9Smrg else 2915c10afb9Smrg echo "#dummy" > "$depfile" 2925c10afb9Smrg fi 2935c10afb9Smrg rm -f "$tmpdepfile" 2945c10afb9Smrg ;; 2955c10afb9Smrg 2965c10afb9Smrg#nosideeffect) 2975c10afb9Smrg # This comment above is used by automake to tell side-effect 2985c10afb9Smrg # dependency tracking mechanisms from slower ones. 2995c10afb9Smrg 3005c10afb9Smrgdashmstdout) 3015c10afb9Smrg # Important note: in order to support this mode, a compiler *must* 3025c10afb9Smrg # always write the preprocessed file to stdout, regardless of -o. 3035c10afb9Smrg "$@" || exit $? 3045c10afb9Smrg 3055c10afb9Smrg # Remove the call to Libtool. 3065c10afb9Smrg if test "$libtool" = yes; then 3075c10afb9Smrg while test $1 != '--mode=compile'; do 3085c10afb9Smrg shift 3095c10afb9Smrg done 3105c10afb9Smrg shift 3115c10afb9Smrg fi 3125c10afb9Smrg 3135c10afb9Smrg # Remove `-o $object'. 3145c10afb9Smrg IFS=" " 3155c10afb9Smrg for arg 3165c10afb9Smrg do 3175c10afb9Smrg case $arg in 3185c10afb9Smrg -o) 3195c10afb9Smrg shift 3205c10afb9Smrg ;; 3215c10afb9Smrg $object) 3225c10afb9Smrg shift 3235c10afb9Smrg ;; 3245c10afb9Smrg *) 3255c10afb9Smrg set fnord "$@" "$arg" 3265c10afb9Smrg shift # fnord 3275c10afb9Smrg shift # $arg 3285c10afb9Smrg ;; 3295c10afb9Smrg esac 3305c10afb9Smrg done 3315c10afb9Smrg 3325c10afb9Smrg test -z "$dashmflag" && dashmflag=-M 3335c10afb9Smrg # Require at least two characters before searching for `:' 3345c10afb9Smrg # in the target name. This is to cope with DOS-style filenames: 3355c10afb9Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 3365c10afb9Smrg "$@" $dashmflag | 3375c10afb9Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 3385c10afb9Smrg rm -f "$depfile" 3395c10afb9Smrg cat < "$tmpdepfile" > "$depfile" 3405c10afb9Smrg tr ' ' ' 3415c10afb9Smrg' < "$tmpdepfile" | \ 3425c10afb9Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 3435c10afb9Smrg## correctly. Breaking it into two sed invocations is a workaround. 3445c10afb9Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 3455c10afb9Smrg rm -f "$tmpdepfile" 3465c10afb9Smrg ;; 3475c10afb9Smrg 3485c10afb9SmrgdashXmstdout) 3495c10afb9Smrg # This case only exists to satisfy depend.m4. It is never actually 3505c10afb9Smrg # run, as this mode is specially recognized in the preamble. 3515c10afb9Smrg exit 1 3525c10afb9Smrg ;; 3535c10afb9Smrg 3545c10afb9Smrgmakedepend) 3555c10afb9Smrg "$@" || exit $? 3565c10afb9Smrg # Remove any Libtool call 3575c10afb9Smrg if test "$libtool" = yes; then 3585c10afb9Smrg while test $1 != '--mode=compile'; do 3595c10afb9Smrg shift 3605c10afb9Smrg done 3615c10afb9Smrg shift 3625c10afb9Smrg fi 3635c10afb9Smrg # X makedepend 3645c10afb9Smrg shift 3655c10afb9Smrg cleared=no 3665c10afb9Smrg for arg in "$@"; do 3675c10afb9Smrg case $cleared in 3685c10afb9Smrg no) 3695c10afb9Smrg set ""; shift 3705c10afb9Smrg cleared=yes ;; 3715c10afb9Smrg esac 3725c10afb9Smrg case "$arg" in 3735c10afb9Smrg -D*|-I*) 3745c10afb9Smrg set fnord "$@" "$arg"; shift ;; 3755c10afb9Smrg # Strip any option that makedepend may not understand. Remove 3765c10afb9Smrg # the object too, otherwise makedepend will parse it as a source file. 3775c10afb9Smrg -*|$object) 3785c10afb9Smrg ;; 3795c10afb9Smrg *) 3805c10afb9Smrg set fnord "$@" "$arg"; shift ;; 3815c10afb9Smrg esac 3825c10afb9Smrg done 3835c10afb9Smrg obj_suffix="`echo $object | sed 's/^.*\././'`" 3845c10afb9Smrg touch "$tmpdepfile" 3855c10afb9Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 3865c10afb9Smrg rm -f "$depfile" 3875c10afb9Smrg cat < "$tmpdepfile" > "$depfile" 3885c10afb9Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 3895c10afb9Smrg' | \ 3905c10afb9Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 3915c10afb9Smrg## correctly. Breaking it into two sed invocations is a workaround. 3925c10afb9Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 3935c10afb9Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 3945c10afb9Smrg ;; 3955c10afb9Smrg 3965c10afb9Smrgcpp) 3975c10afb9Smrg # Important note: in order to support this mode, a compiler *must* 3985c10afb9Smrg # always write the preprocessed file to stdout. 3995c10afb9Smrg "$@" || exit $? 4005c10afb9Smrg 4015c10afb9Smrg # Remove the call to Libtool. 4025c10afb9Smrg if test "$libtool" = yes; then 4035c10afb9Smrg while test $1 != '--mode=compile'; do 4045c10afb9Smrg shift 4055c10afb9Smrg done 4065c10afb9Smrg shift 4075c10afb9Smrg fi 4085c10afb9Smrg 4095c10afb9Smrg # Remove `-o $object'. 4105c10afb9Smrg IFS=" " 4115c10afb9Smrg for arg 4125c10afb9Smrg do 4135c10afb9Smrg case $arg in 4145c10afb9Smrg -o) 4155c10afb9Smrg shift 4165c10afb9Smrg ;; 4175c10afb9Smrg $object) 4185c10afb9Smrg shift 4195c10afb9Smrg ;; 4205c10afb9Smrg *) 4215c10afb9Smrg set fnord "$@" "$arg" 4225c10afb9Smrg shift # fnord 4235c10afb9Smrg shift # $arg 4245c10afb9Smrg ;; 4255c10afb9Smrg esac 4265c10afb9Smrg done 4275c10afb9Smrg 4285c10afb9Smrg "$@" -E | 4295c10afb9Smrg sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 4305c10afb9Smrg sed '$ s: \\$::' > "$tmpdepfile" 4315c10afb9Smrg rm -f "$depfile" 4325c10afb9Smrg echo "$object : \\" > "$depfile" 4335c10afb9Smrg cat < "$tmpdepfile" >> "$depfile" 4345c10afb9Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 4355c10afb9Smrg rm -f "$tmpdepfile" 4365c10afb9Smrg ;; 4375c10afb9Smrg 4385c10afb9Smrgmsvisualcpp) 4395c10afb9Smrg # Important note: in order to support this mode, a compiler *must* 4405c10afb9Smrg # always write the preprocessed file to stdout, regardless of -o, 4415c10afb9Smrg # because we must use -o when running libtool. 4425c10afb9Smrg "$@" || exit $? 4435c10afb9Smrg IFS=" " 4445c10afb9Smrg for arg 4455c10afb9Smrg do 4465c10afb9Smrg case "$arg" in 4475c10afb9Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 4485c10afb9Smrg set fnord "$@" 4495c10afb9Smrg shift 4505c10afb9Smrg shift 4515c10afb9Smrg ;; 4525c10afb9Smrg *) 4535c10afb9Smrg set fnord "$@" "$arg" 4545c10afb9Smrg shift 4555c10afb9Smrg shift 4565c10afb9Smrg ;; 4575c10afb9Smrg esac 4585c10afb9Smrg done 4595c10afb9Smrg "$@" -E | 4605c10afb9Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 4615c10afb9Smrg rm -f "$depfile" 4625c10afb9Smrg echo "$object : \\" > "$depfile" 4635c10afb9Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 4645c10afb9Smrg echo " " >> "$depfile" 4655c10afb9Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 4665c10afb9Smrg rm -f "$tmpdepfile" 4675c10afb9Smrg ;; 4685c10afb9Smrg 4695c10afb9Smrgnone) 4705c10afb9Smrg exec "$@" 4715c10afb9Smrg ;; 4725c10afb9Smrg 4735c10afb9Smrg*) 4745c10afb9Smrg echo "Unknown depmode $depmode" 1>&2 4755c10afb9Smrg exit 1 4765c10afb9Smrg ;; 4775c10afb9Smrgesac 4785c10afb9Smrg 4795c10afb9Smrgexit 0 480