depcomp revision c43cc173
11.55Srillig#! /bin/sh 21.10Schristos# depcomp - compile a program generating dependencies as side-effects 31.1Scgd 41.13Schristosscriptversion=2006-10-15.18 51.13Schristos 61.20Sagc# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software 71.20Sagc# Foundation, Inc. 81.20Sagc 91.20Sagc# This program is free software; you can redistribute it and/or modify 101.20Sagc# it under the terms of the GNU General Public License as published by 111.20Sagc# the Free Software Foundation; either version 2, or (at your option) 121.20Sagc# any later version. 131.20Sagc 141.20Sagc# This program is distributed in the hope that it will be useful, 151.20Sagc# but WITHOUT ANY WARRANTY; without even the implied warranty of 161.20Sagc# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 171.20Sagc# GNU General Public License for more details. 181.20Sagc 191.20Sagc# You should have received a copy of the GNU General Public License 201.20Sagc# along with this program; if not, write to the Free Software 211.20Sagc# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 221.20Sagc# 02110-1301, USA. 231.20Sagc 241.20Sagc# As a special exception to the GNU General Public License, if you 251.20Sagc# distribute this file as part of a program that contains a 261.20Sagc# configuration script generated by Autoconf, you may include it under 271.20Sagc# the same distribution terms that you use for the rest of that program. 281.20Sagc 291.20Sagc# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 301.20Sagc 311.20Sagccase $1 in 321.20Sagc '') 331.20Sagc echo "$0: No command. Try \`$0 --help' for more information." 1>&2 341.20Sagc exit 1; 351.20Sagc ;; 361.1Scgd -h | --h*) 371.1Scgd cat <<\EOF 381.1ScgdUsage: depcomp [--help] [--version] PROGRAM [ARGS] 391.1Scgd 401.1ScgdRun PROGRAMS ARGS to compile a file, generating dependencies 411.1Scgdas side-effects. 421.1Scgd 431.1ScgdEnvironment variables: 441.1Scgd depmode Dependency tracking mode. 451.1Scgd source Source file read by `PROGRAMS ARGS'. 461.1Scgd object Object file output by `PROGRAMS ARGS'. 471.1Scgd DEPDIR directory where to store dependencies. 481.1Scgd depfile Dependency file to output. 491.1Scgd tmpdepfile Temporary file to use when outputing dependencies. 501.1Scgd libtool Whether libtool is used (yes/no). 511.1Scgd 521.1ScgdReport bugs to <bug-automake@gnu.org>. 531.1ScgdEOF 541.1Scgd exit $? 551.1Scgd ;; 561.1Scgd -v | --v*) 571.1Scgd echo "depcomp $scriptversion" 581.1Scgd exit $? 591.1Scgd ;; 601.1Scgdesac 611.1Scgd 621.1Scgdif test -z "$depmode" || test -z "$source" || test -z "$object"; then 631.1Scgd echo "depcomp: Variables source, object and depmode must be set" 1>&2 641.1Scgd exit 1 651.1Scgdfi 661.1Scgd 671.1Scgd# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 681.1Scgddepfile=${depfile-`echo "$object" | 691.1Scgd sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 701.1Scgdtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 711.22Sross 721.55Srilligrm -f "$tmpdepfile" 731.15Slukem 741.14Schristos# Some modes work just like other modes, but use different flags. We 751.1Scgd# parameterize here, but still list the modes in the big case below, 761.10Schristos# to make depend.m4 easier to write. Note that we *cannot* use a case 771.10Schristos# here, because this file can only contain one case statement. 781.10Schristosif test "$depmode" = hp; then 791.55Srillig # HP compiler uses -M and no extra arg. 801.10Schristos gccflag=-M 811.1Scgd depmode=gcc 821.15Slukemfi 831.1Scgd 841.1Scgdif test "$depmode" = dashXmstdout; then 851.1Scgd # This is just like dashmstdout with a different argument. 861.1Scgd dashmflag=-xM 871.1Scgd depmode=dashmstdout 881.1Scgdfi 891.1Scgd 901.1Scgdcase "$depmode" in 911.1Scgdgcc3) 921.1Scgd## gcc 3 implements dependency tracking that does exactly what 931.1Scgd## we want. Yay! Note: for some reason libtool 1.4 doesn't like 941.1Scgd## it if -MD -MP comes after the -MF stuff. Hmm. 951.19Schristos## Unfortunately, FreeBSD c89 acceptance of flags depends upon 961.1Scgd## the command line argument order; so add the flags where they 971.28Schristos## appear in depend2.am. Note that the slowdown incurred here 981.18Swiz## affects only configure: in makefiles, %FASTDEP% shortcuts this. 991.1Scgd for arg 1001.1Scgd do 1011.1Scgd case $arg in 1021.1Scgd -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1031.1Scgd *) set fnord "$@" "$arg" ;; 1041.1Scgd esac 1051.36Sgson shift # fnord 1061.1Scgd shift # $arg 1071.1Scgd done 1081.28Schristos "$@" 1091.1Scgd stat=$? 1101.1Scgd if test $stat -eq 0; then : 1111.1Scgd else 1121.1Scgd rm -f "$tmpdepfile" 1131.1Scgd exit $stat 1141.1Scgd fi 1151.1Scgd mv "$tmpdepfile" "$depfile" 1161.1Scgd ;; 1171.1Scgd 1181.1Scgdgcc) 1191.1Scgd## There are various ways to get dependency output from gcc. Here's 1201.28Schristos## why we pick this rather obscure method: 1211.1Scgd## - Don't want to use -MD because we'd like the dependencies to end 1221.45Srillig## up in a subdir. Having to rename by hand is ugly. 1231.1Scgd## (We might end up doing this anyway to support other compilers.) 1241.1Scgd## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 1251.1Scgd## -MM, not -M (despite what the docs say). 1261.1Scgd## - Using -M directly means running the compiler twice (even worse 1271.1Scgd## than renaming). 1281.1Scgd if test -z "$gccflag"; then 1291.1Scgd gccflag=-MD, 1301.1Scgd fi 1311.53Srillig "$@" -Wp,"$gccflag$tmpdepfile" 1321.53Srillig stat=$? 1331.53Srillig if test $stat -eq 0; then : 1341.26Serh else 1351.1Scgd rm -f "$tmpdepfile" 1361.21Ssjg exit $stat 1371.53Srillig fi 1381.53Srillig rm -f "$depfile" 1391.53Srillig echo "$object : \\" > "$depfile" 1401.1Scgd alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1411.1Scgd## The second -e expression handles DOS-style file names with drive letters. 1421.53Srillig sed -e 's/^[^:]*: / /' \ 1431.53Srillig -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1441.1Scgd## This next piece of magic avoids the `deleted header file' problem. 1451.55Srillig## The problem is that when a header file which appears in a .P file 1461.55Srillig## is deleted, the dependency causes make to die (because there is 1471.55Srillig## typically no way to rebuild the header). We avoid this by adding 1481.55Srillig## dummy dependencies for each header file. Too bad gcc doesn't do 1491.55Srillig## this for us directly. 1501.55Srillig tr ' ' ' 1511.55Srillig' < "$tmpdepfile" | 1521.55Srillig## Some versions of gcc put a space before the `:'. On the theory 1531.55Srillig## that the space means something, we add a space to the output as 1541.55Srillig## well. 1551.4Scgd## Some versions of the HPUX 10.20 sed can't process this invocation 1561.4Scgd## correctly. Breaking it into two sed invocations is a workaround. 1571.4Scgd sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 1581.1Scgd rm -f "$tmpdepfile" 1591.41Srillig ;; 1601.55Srillig 1611.55Srillighp) 1621.1Scgd # This case exists only to let depend.m4 do its work. It works by 1631.55Srillig # looking at the text of this script. This case will never be run, 1641.55Srillig # since it is checked for above. 1651.35Ssjg exit 1 1661.35Ssjg ;; 1671.1Scgd 1681.41Srilligsgi) 1691.1Scgd if test "$libtool" = yes; then 1701.55Srillig "$@" "-Wp,-MDupdate,$tmpdepfile" 1711.55Srillig else 1721.55Srillig "$@" -MDupdate "$tmpdepfile" 1731.55Srillig fi 1741.41Srillig stat=$? 1751.41Srillig if test $stat -eq 0; then : 1761.41Srillig else 1771.1Scgd rm -f "$tmpdepfile" 1781.1Scgd exit $stat 1791.17Schristos fi 1801.1Scgd rm -f "$depfile" 1811.4Scgd 1821.1Scgd if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1831.1Scgd echo "$object : \\" > "$depfile" 1841.17Schristos 1851.6Sjtc # Clip off the initial element (the dependent). Don't try to be 1861.4Scgd # clever and replace this with sed code, as IRIX sed won't handle 1871.6Sjtc # lines with more than a fixed number of characters (4096 in 1881.41Srillig # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1891.30Schristos # the IRIX cc adds comments like `#:fec' to the end of the 1901.41Srillig # dependency line. 1911.41Srillig tr ' ' ' 1921.30Schristos' < "$tmpdepfile" \ 1931.41Srillig | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 1941.41Srillig tr ' 1951.25Schristos' ' ' >> $depfile 1961.6Sjtc echo >> $depfile 1971.6Sjtc 1981.6Sjtc # The second pass generates a dummy entry for each header file. 1991.8Sjtc tr ' ' ' 2001.41Srillig' < "$tmpdepfile" \ 2011.41Srillig | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2021.41Srillig >> $depfile 2031.8Sjtc else 2041.1Scgd # The sourcefile does not contain any dependencies, so just 2051.1Scgd # store a dummy comment line, to avoid errors with the Makefile 2061.1Scgd # "include basename.Plo" scheme. 2071.8Sjtc echo "#dummy" > "$depfile" 2081.1Scgd fi 2091.1Scgd rm -f "$tmpdepfile" 2101.41Srillig ;; 2111.1Scgd 2121.1Scgdaix) 2131.1Scgd # The C for AIX Compiler uses -M and outputs the dependencies 2141.1Scgd # in a .u file. In older versions, this file always lives in the 2151.41Srillig # current directory. Also, the AIX compiler puts `$object:' at the 2161.1Scgd # start of each line; $object doesn't have directory information. 2171.1Scgd # Version 6 uses the directory in both cases. 2181.41Srillig stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 2191.8Sjtc tmpdepfile="$stripped.u" 2201.8Sjtc if test "$libtool" = yes; then 2211.41Srillig "$@" -Wc,-M 2221.41Srillig else 2231.41Srillig "$@" -M 2241.41Srillig fi 2251.41Srillig stat=$? 2261.1Scgd 2271.41Srillig if test -f "$tmpdepfile"; then : 2281.41Srillig else 2291.31Schristos stripped=`echo "$stripped" | sed 's,^.*/,,'` 2301.31Schristos tmpdepfile="$stripped.u" 2311.41Srillig fi 2321.41Srillig 2331.53Srillig if test $stat -eq 0; then : 2341.31Schristos else 2351.31Schristos rm -f "$tmpdepfile" 2361.1Scgd exit $stat 2371.31Schristos fi 2381.1Scgd 2391.1Scgd if test -f "$tmpdepfile"; then 2401.8Sjtc outname="$stripped.o" 2411.41Srillig # Each line is of the form `foo.o: dependent.h'. 2421.41Srillig # Do two passes, one to just change these to 2431.41Srillig # `$object: dependent.h' and one to simply `dependent.h:'. 2441.41Srillig sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 2451.41Srillig sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 2461.26Serh else 2471.41Srillig # The sourcefile does not contain any dependencies, so just 2481.8Sjtc # store a dummy comment line, to avoid errors with the Makefile 2491.8Sjtc # "include basename.Plo" scheme. 2501.13Schristos echo "#dummy" > "$depfile" 2511.41Srillig fi 2521.1Scgd rm -f "$tmpdepfile" 2531.1Scgd ;; 2541.1Scgd 2551.1Scgdicc) 2561.41Srillig # Intel's C compiler understands `-MD -MF file'. However on 2571.1Scgd # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 2581.1Scgd # ICC 7.0 will fill foo.d with something like 2591.1Scgd # foo.o: sub/foo.c 2601.1Scgd # foo.o: sub/foo.h 2611.1Scgd # which is wrong. We want: 2621.1Scgd # sub/foo.o: sub/foo.c 2631.1Scgd # sub/foo.o: sub/foo.h 2641.1Scgd # sub/foo.c: 2651.1Scgd # sub/foo.h: 2661.1Scgd # ICC 7.1 will output 2671.1Scgd # foo.o: sub/foo.c sub/foo.h 2681.1Scgd # and will wrap long lines using \ : 2691.1Scgd # foo.o: sub/foo.c ... \ 2701.1Scgd # sub/foo.h ... \ 2711.1Scgd # ... 2721.1Scgd 2731.1Scgd "$@" -MD -MF "$tmpdepfile" 2741.1Scgd stat=$? 2751.1Scgd if test $stat -eq 0; then : 2761.41Srillig else 2771.41Srillig rm -f "$tmpdepfile" 2781.41Srillig exit $stat 2791.1Scgd fi 2801.41Srillig rm -f "$depfile" 2811.53Srillig # Each line is of the form `foo.o: dependent.h', 2821.53Srillig # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 2831.41Srillig # Do two passes, one to just change these to 2841.1Scgd # `$object: dependent.h' and one to simply `dependent.h:'. 2851.1Scgd sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 2861.1Scgd # Some versions of the HPUX 10.20 sed can't process this invocation 2871.1Scgd # correctly. Breaking it into two sed invocations is a workaround. 2881.13Schristos sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 2891.18Swiz sed -e 's/$/ :/' >> "$depfile" 2901.18Swiz rm -f "$tmpdepfile" 2911.18Swiz ;; 2921.18Swiz 2931.1Scgdhp2) 2941.1Scgd # The "hp" stanza above does not work with aCC (C++) and HP's ia64 2951.1Scgd # compilers, which have integrated preprocessors. The correct option 2961.1Scgd # to use with these is +Maked; it writes dependencies to a file named 2971.13Schristos # 'foo.d', which lands next to the object file, wherever that 2981.1Scgd # happens to be. 2991.1Scgd # Much of this is similar to the tru64 case; see comments there. 3001.1Scgd dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3011.19Schristos test "x$dir" = "x$object" && dir= 3021.1Scgd base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3031.19Schristos if test "$libtool" = yes; then 3041.1Scgd tmpdepfile1=$dir$base.d 3051.1Scgd tmpdepfile2=$dir.libs/$base.d 3061.1Scgd "$@" -Wc,+Maked 3071.1Scgd else 3081.1Scgd tmpdepfile1=$dir$base.d 3091.1Scgd tmpdepfile2=$dir$base.d 3101.1Scgd "$@" +Maked 3111.44Srillig fi 3121.1Scgd stat=$? 3131.1Scgd if test $stat -eq 0; then : 3141.1Scgd else 3151.1Scgd rm -f "$tmpdepfile1" "$tmpdepfile2" 3161.1Scgd exit $stat 3171.19Schristos fi 3181.1Scgd 3191.1Scgd for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3201.1Scgd do 3211.1Scgd test -f "$tmpdepfile" && break 3221.1Scgd done 3231.19Schristos if test -f "$tmpdepfile"; then 3241.1Scgd sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3251.1Scgd # Add `dependent.h:' lines. 3261.1Scgd sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" 3271.51Srillig else 3281.13Schristos echo "#dummy" > "$depfile" 3291.49Srillig fi 3301.13Schristos rm -f "$tmpdepfile" "$tmpdepfile2" 3311.49Srillig ;; 3321.49Srillig 3331.49Srilligtru64) 3341.51Srillig # The Tru64 compiler uses -MD to generate dependencies as a side 3351.34Sdholland # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 3361.1Scgd # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 3371.1Scgd # dependencies in `foo.d' instead, so we check for that too. 3381.51Srillig # Subdirectories are respected. 3391.51Srillig dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3401.1Scgd test "x$dir" = "x$object" && dir= 3411.1Scgd base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3421.1Scgd 3431.1Scgd if test "$libtool" = yes; then 3441.1Scgd # With Tru64 cc, shared objects can also be used to make a 3451.1Scgd # static library. This mechanism is used in libtool 1.4 series to 3461.1Scgd # handle both shared and static libraries in a single compilation. 3471.51Srillig # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 3481.51Srillig # 3491.51Srillig # With libtool 1.5 this exception was removed, and libtool now 3501.51Srillig # generates 2 separate objects for the 2 libraries. These two 3511.51Srillig # compilations output dependencies in $dir.libs/$base.o.d and 3521.1Scgd # in $dir$base.o.d. We have to check for both files, because 3531.51Srillig # one of the two compilations can be disabled. We should prefer 3541.51Srillig # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 3551.1Scgd # automatically cleaned when .libs/ is deleted, while ignoring 3561.51Srillig # the former would cause a distcleancheck panic. 3571.51Srillig tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 3581.51Srillig tmpdepfile2=$dir$base.o.d # libtool 1.5 3591.51Srillig tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 3601.51Srillig tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 3611.51Srillig "$@" -Wc,-MD 3621.51Srillig else 3631.51Srillig tmpdepfile1=$dir$base.o.d 3641.51Srillig tmpdepfile2=$dir$base.d 3651.51Srillig tmpdepfile3=$dir$base.d 3661.1Scgd tmpdepfile4=$dir$base.d 3671.51Srillig "$@" -MD 3681.1Scgd fi 3691.51Srillig 3701.51Srillig stat=$? 3711.51Srillig if test $stat -eq 0; then : 3721.1Scgd else 3731.51Srillig rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3741.1Scgd exit $stat 3751.51Srillig fi 3761.51Srillig 3771.51Srillig for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3781.51Srillig do 3791.1Scgd test -f "$tmpdepfile" && break 3801.51Srillig done 3811.51Srillig if test -f "$tmpdepfile"; then 3821.51Srillig sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 3831.37Ssjg # That's a tab and a space in the []. 3841.1Scgd sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 3851.51Srillig else 3861.51Srillig echo "#dummy" > "$depfile" 3871.38Ssjg fi 3881.51Srillig rm -f "$tmpdepfile" 3891.38Ssjg ;; 3901.51Srillig 3911.1Scgd#nosideeffect) 3921.51Srillig # This comment above is used by automake to tell side-effect 3931.51Srillig # dependency tracking mechanisms from slower ones. 3941.51Srillig 3951.51Srilligdashmstdout) 3961.1Scgd # Important note: in order to support this mode, a compiler *must* 3971.51Srillig # always write the preprocessed file to stdout, regardless of -o. 3981.1Scgd "$@" || exit $? 3991.51Srillig 4001.1Scgd # Remove the call to Libtool. 4011.51Srillig if test "$libtool" = yes; then 4021.1Scgd while test $1 != '--mode=compile'; do 4031.51Srillig shift 4041.51Srillig done 4051.51Srillig shift 4061.51Srillig fi 4071.51Srillig 4081.51Srillig # Remove `-o $object'. 4091.1Scgd IFS=" " 4101.1Scgd for arg 4111.51Srillig do 4121.1Scgd case $arg in 4131.51Srillig -o) 4141.51Srillig shift 4151.1Scgd ;; 4161.51Srillig $object) 4171.51Srillig shift 4181.51Srillig ;; 4191.51Srillig *) 4201.1Scgd set fnord "$@" "$arg" 4211.51Srillig shift # fnord 4221.51Srillig shift # $arg 4231.51Srillig ;; 4241.51Srillig esac 4251.51Srillig done 4261.51Srillig 4271.51Srillig test -z "$dashmflag" && dashmflag=-M 4281.1Scgd # Require at least two characters before searching for `:' 4291.4Scgd # in the target name. This is to cope with DOS-style filenames: 430 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 431 "$@" $dashmflag | 432 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 433 rm -f "$depfile" 434 cat < "$tmpdepfile" > "$depfile" 435 tr ' ' ' 436' < "$tmpdepfile" | \ 437## Some versions of the HPUX 10.20 sed can't process this invocation 438## correctly. Breaking it into two sed invocations is a workaround. 439 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 440 rm -f "$tmpdepfile" 441 ;; 442 443dashXmstdout) 444 # This case only exists to satisfy depend.m4. It is never actually 445 # run, as this mode is specially recognized in the preamble. 446 exit 1 447 ;; 448 449makedepend) 450 "$@" || exit $? 451 # Remove any Libtool call 452 if test "$libtool" = yes; then 453 while test $1 != '--mode=compile'; do 454 shift 455 done 456 shift 457 fi 458 # X makedepend 459 shift 460 cleared=no 461 for arg in "$@"; do 462 case $cleared in 463 no) 464 set ""; shift 465 cleared=yes ;; 466 esac 467 case "$arg" in 468 -D*|-I*) 469 set fnord "$@" "$arg"; shift ;; 470 # Strip any option that makedepend may not understand. Remove 471 # the object too, otherwise makedepend will parse it as a source file. 472 -*|$object) 473 ;; 474 *) 475 set fnord "$@" "$arg"; shift ;; 476 esac 477 done 478 obj_suffix="`echo $object | sed 's/^.*\././'`" 479 touch "$tmpdepfile" 480 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 481 rm -f "$depfile" 482 cat < "$tmpdepfile" > "$depfile" 483 sed '1,2d' "$tmpdepfile" | tr ' ' ' 484' | \ 485## Some versions of the HPUX 10.20 sed can't process this invocation 486## correctly. Breaking it into two sed invocations is a workaround. 487 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 488 rm -f "$tmpdepfile" "$tmpdepfile".bak 489 ;; 490 491cpp) 492 # Important note: in order to support this mode, a compiler *must* 493 # always write the preprocessed file to stdout. 494 "$@" || exit $? 495 496 # Remove the call to Libtool. 497 if test "$libtool" = yes; then 498 while test $1 != '--mode=compile'; do 499 shift 500 done 501 shift 502 fi 503 504 # Remove `-o $object'. 505 IFS=" " 506 for arg 507 do 508 case $arg in 509 -o) 510 shift 511 ;; 512 $object) 513 shift 514 ;; 515 *) 516 set fnord "$@" "$arg" 517 shift # fnord 518 shift # $arg 519 ;; 520 esac 521 done 522 523 "$@" -E | 524 sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 525 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 526 sed '$ s: \\$::' > "$tmpdepfile" 527 rm -f "$depfile" 528 echo "$object : \\" > "$depfile" 529 cat < "$tmpdepfile" >> "$depfile" 530 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 531 rm -f "$tmpdepfile" 532 ;; 533 534msvisualcpp) 535 # Important note: in order to support this mode, a compiler *must* 536 # always write the preprocessed file to stdout, regardless of -o, 537 # because we must use -o when running libtool. 538 "$@" || exit $? 539 IFS=" " 540 for arg 541 do 542 case "$arg" in 543 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 544 set fnord "$@" 545 shift 546 shift 547 ;; 548 *) 549 set fnord "$@" "$arg" 550 shift 551 shift 552 ;; 553 esac 554 done 555 "$@" -E | 556 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 557 rm -f "$depfile" 558 echo "$object : \\" > "$depfile" 559 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 560 echo " " >> "$depfile" 561 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 562 rm -f "$tmpdepfile" 563 ;; 564 565none) 566 exec "$@" 567 ;; 568 569*) 570 echo "Unknown depmode $depmode" 1>&2 571 exit 1 572 ;; 573esac 574 575exit 0 576 577# Local Variables: 578# mode: shell-script 579# sh-indentation: 2 580# eval: (add-hook 'write-file-hooks 'time-stamp) 581# time-stamp-start: "scriptversion=" 582# time-stamp-format: "%:y-%02m-%02d.%02H" 583# time-stamp-end: "$" 584# End: 585