depcomp revision 8f65982a
19aa228fdSmrg#! /bin/sh 29aa228fdSmrg# depcomp - compile a program generating dependencies as side-effects 39aa228fdSmrg 48f65982aSmrgscriptversion=2009-04-28.21; # UTC 59aa228fdSmrg 68f65982aSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 78f65982aSmrg# Software Foundation, Inc. 89aa228fdSmrg 99aa228fdSmrg# This program is free software; you can redistribute it and/or modify 109aa228fdSmrg# it under the terms of the GNU General Public License as published by 119aa228fdSmrg# the Free Software Foundation; either version 2, or (at your option) 129aa228fdSmrg# any later version. 139aa228fdSmrg 149aa228fdSmrg# This program is distributed in the hope that it will be useful, 159aa228fdSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 169aa228fdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 179aa228fdSmrg# GNU General Public License for more details. 189aa228fdSmrg 199aa228fdSmrg# You should have received a copy of the GNU General Public License 208f65982aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 219aa228fdSmrg 229aa228fdSmrg# As a special exception to the GNU General Public License, if you 239aa228fdSmrg# distribute this file as part of a program that contains a 249aa228fdSmrg# configuration script generated by Autoconf, you may include it under 259aa228fdSmrg# the same distribution terms that you use for the rest of that program. 269aa228fdSmrg 279aa228fdSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 289aa228fdSmrg 299aa228fdSmrgcase $1 in 309aa228fdSmrg '') 319aa228fdSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 329aa228fdSmrg exit 1; 339aa228fdSmrg ;; 349aa228fdSmrg -h | --h*) 359aa228fdSmrg cat <<\EOF 369aa228fdSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 379aa228fdSmrg 389aa228fdSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 399aa228fdSmrgas side-effects. 409aa228fdSmrg 419aa228fdSmrgEnvironment variables: 429aa228fdSmrg depmode Dependency tracking mode. 439aa228fdSmrg source Source file read by `PROGRAMS ARGS'. 449aa228fdSmrg object Object file output by `PROGRAMS ARGS'. 459aa228fdSmrg DEPDIR directory where to store dependencies. 469aa228fdSmrg depfile Dependency file to output. 479aa228fdSmrg tmpdepfile Temporary file to use when outputing dependencies. 489aa228fdSmrg libtool Whether libtool is used (yes/no). 499aa228fdSmrg 509aa228fdSmrgReport bugs to <bug-automake@gnu.org>. 519aa228fdSmrgEOF 529aa228fdSmrg exit $? 539aa228fdSmrg ;; 549aa228fdSmrg -v | --v*) 559aa228fdSmrg echo "depcomp $scriptversion" 569aa228fdSmrg exit $? 579aa228fdSmrg ;; 589aa228fdSmrgesac 599aa228fdSmrg 609aa228fdSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 619aa228fdSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 629aa228fdSmrg exit 1 639aa228fdSmrgfi 649aa228fdSmrg 659aa228fdSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 669aa228fdSmrgdepfile=${depfile-`echo "$object" | 679aa228fdSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 689aa228fdSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 699aa228fdSmrg 709aa228fdSmrgrm -f "$tmpdepfile" 719aa228fdSmrg 729aa228fdSmrg# Some modes work just like other modes, but use different flags. We 739aa228fdSmrg# parameterize here, but still list the modes in the big case below, 749aa228fdSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 759aa228fdSmrg# here, because this file can only contain one case statement. 769aa228fdSmrgif test "$depmode" = hp; then 779aa228fdSmrg # HP compiler uses -M and no extra arg. 789aa228fdSmrg gccflag=-M 799aa228fdSmrg depmode=gcc 809aa228fdSmrgfi 819aa228fdSmrg 829aa228fdSmrgif test "$depmode" = dashXmstdout; then 839aa228fdSmrg # This is just like dashmstdout with a different argument. 849aa228fdSmrg dashmflag=-xM 859aa228fdSmrg depmode=dashmstdout 869aa228fdSmrgfi 879aa228fdSmrg 888f65982aSmrgcygpath_u="cygpath -u -f -" 898f65982aSmrgif test "$depmode" = msvcmsys; then 908f65982aSmrg # This is just like msvisualcpp but w/o cygpath translation. 918f65982aSmrg # Just convert the backslash-escaped backslashes to single forward 928f65982aSmrg # slashes to satisfy depend.m4 938f65982aSmrg cygpath_u="sed s,\\\\\\\\,/,g" 948f65982aSmrg depmode=msvisualcpp 958f65982aSmrgfi 968f65982aSmrg 979aa228fdSmrgcase "$depmode" in 989aa228fdSmrggcc3) 999aa228fdSmrg## gcc 3 implements dependency tracking that does exactly what 1009aa228fdSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 1019aa228fdSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 1029aa228fdSmrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1039aa228fdSmrg## the command line argument order; so add the flags where they 1049aa228fdSmrg## appear in depend2.am. Note that the slowdown incurred here 1059aa228fdSmrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1069aa228fdSmrg for arg 1079aa228fdSmrg do 1089aa228fdSmrg case $arg in 1099aa228fdSmrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1109aa228fdSmrg *) set fnord "$@" "$arg" ;; 1119aa228fdSmrg esac 1129aa228fdSmrg shift # fnord 1139aa228fdSmrg shift # $arg 1149aa228fdSmrg done 1159aa228fdSmrg "$@" 1169aa228fdSmrg stat=$? 1179aa228fdSmrg if test $stat -eq 0; then : 1189aa228fdSmrg else 1199aa228fdSmrg rm -f "$tmpdepfile" 1209aa228fdSmrg exit $stat 1219aa228fdSmrg fi 1229aa228fdSmrg mv "$tmpdepfile" "$depfile" 1239aa228fdSmrg ;; 1249aa228fdSmrg 1259aa228fdSmrggcc) 1269aa228fdSmrg## There are various ways to get dependency output from gcc. Here's 1279aa228fdSmrg## why we pick this rather obscure method: 1289aa228fdSmrg## - Don't want to use -MD because we'd like the dependencies to end 1299aa228fdSmrg## up in a subdir. Having to rename by hand is ugly. 1309aa228fdSmrg## (We might end up doing this anyway to support other compilers.) 1319aa228fdSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 1329aa228fdSmrg## -MM, not -M (despite what the docs say). 1339aa228fdSmrg## - Using -M directly means running the compiler twice (even worse 1349aa228fdSmrg## than renaming). 1359aa228fdSmrg if test -z "$gccflag"; then 1369aa228fdSmrg gccflag=-MD, 1379aa228fdSmrg fi 1389aa228fdSmrg "$@" -Wp,"$gccflag$tmpdepfile" 1399aa228fdSmrg stat=$? 1409aa228fdSmrg if test $stat -eq 0; then : 1419aa228fdSmrg else 1429aa228fdSmrg rm -f "$tmpdepfile" 1439aa228fdSmrg exit $stat 1449aa228fdSmrg fi 1459aa228fdSmrg rm -f "$depfile" 1469aa228fdSmrg echo "$object : \\" > "$depfile" 1479aa228fdSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1489aa228fdSmrg## The second -e expression handles DOS-style file names with drive letters. 1499aa228fdSmrg sed -e 's/^[^:]*: / /' \ 1509aa228fdSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1519aa228fdSmrg## This next piece of magic avoids the `deleted header file' problem. 1529aa228fdSmrg## The problem is that when a header file which appears in a .P file 1539aa228fdSmrg## is deleted, the dependency causes make to die (because there is 1549aa228fdSmrg## typically no way to rebuild the header). We avoid this by adding 1559aa228fdSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 1569aa228fdSmrg## this for us directly. 1579aa228fdSmrg tr ' ' ' 1589aa228fdSmrg' < "$tmpdepfile" | 1599aa228fdSmrg## Some versions of gcc put a space before the `:'. On the theory 1609aa228fdSmrg## that the space means something, we add a space to the output as 1619aa228fdSmrg## well. 1629aa228fdSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 1639aa228fdSmrg## correctly. Breaking it into two sed invocations is a workaround. 1649aa228fdSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 1659aa228fdSmrg rm -f "$tmpdepfile" 1669aa228fdSmrg ;; 1679aa228fdSmrg 1689aa228fdSmrghp) 1699aa228fdSmrg # This case exists only to let depend.m4 do its work. It works by 1709aa228fdSmrg # looking at the text of this script. This case will never be run, 1719aa228fdSmrg # since it is checked for above. 1729aa228fdSmrg exit 1 1739aa228fdSmrg ;; 1749aa228fdSmrg 1759aa228fdSmrgsgi) 1769aa228fdSmrg if test "$libtool" = yes; then 1779aa228fdSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 1789aa228fdSmrg else 1799aa228fdSmrg "$@" -MDupdate "$tmpdepfile" 1809aa228fdSmrg fi 1819aa228fdSmrg stat=$? 1829aa228fdSmrg if test $stat -eq 0; then : 1839aa228fdSmrg else 1849aa228fdSmrg rm -f "$tmpdepfile" 1859aa228fdSmrg exit $stat 1869aa228fdSmrg fi 1879aa228fdSmrg rm -f "$depfile" 1889aa228fdSmrg 1899aa228fdSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1909aa228fdSmrg echo "$object : \\" > "$depfile" 1919aa228fdSmrg 1929aa228fdSmrg # Clip off the initial element (the dependent). Don't try to be 1939aa228fdSmrg # clever and replace this with sed code, as IRIX sed won't handle 1949aa228fdSmrg # lines with more than a fixed number of characters (4096 in 1959aa228fdSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1969aa228fdSmrg # the IRIX cc adds comments like `#:fec' to the end of the 1979aa228fdSmrg # dependency line. 1989aa228fdSmrg tr ' ' ' 1999aa228fdSmrg' < "$tmpdepfile" \ 2009aa228fdSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 2019aa228fdSmrg tr ' 2028f65982aSmrg' ' ' >> "$depfile" 2038f65982aSmrg echo >> "$depfile" 2049aa228fdSmrg 2059aa228fdSmrg # The second pass generates a dummy entry for each header file. 2069aa228fdSmrg tr ' ' ' 2079aa228fdSmrg' < "$tmpdepfile" \ 2089aa228fdSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2098f65982aSmrg >> "$depfile" 2109aa228fdSmrg else 2119aa228fdSmrg # The sourcefile does not contain any dependencies, so just 2129aa228fdSmrg # store a dummy comment line, to avoid errors with the Makefile 2139aa228fdSmrg # "include basename.Plo" scheme. 2149aa228fdSmrg echo "#dummy" > "$depfile" 2159aa228fdSmrg fi 2169aa228fdSmrg rm -f "$tmpdepfile" 2179aa228fdSmrg ;; 2189aa228fdSmrg 2199aa228fdSmrgaix) 2209aa228fdSmrg # The C for AIX Compiler uses -M and outputs the dependencies 2219aa228fdSmrg # in a .u file. In older versions, this file always lives in the 2229aa228fdSmrg # current directory. Also, the AIX compiler puts `$object:' at the 2239aa228fdSmrg # start of each line; $object doesn't have directory information. 2249aa228fdSmrg # Version 6 uses the directory in both cases. 2258f65982aSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2268f65982aSmrg test "x$dir" = "x$object" && dir= 2278f65982aSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 2289aa228fdSmrg if test "$libtool" = yes; then 2298f65982aSmrg tmpdepfile1=$dir$base.u 2308f65982aSmrg tmpdepfile2=$base.u 2318f65982aSmrg tmpdepfile3=$dir.libs/$base.u 2329aa228fdSmrg "$@" -Wc,-M 2339aa228fdSmrg else 2348f65982aSmrg tmpdepfile1=$dir$base.u 2358f65982aSmrg tmpdepfile2=$dir$base.u 2368f65982aSmrg tmpdepfile3=$dir$base.u 2379aa228fdSmrg "$@" -M 2389aa228fdSmrg fi 2399aa228fdSmrg stat=$? 2409aa228fdSmrg 2419aa228fdSmrg if test $stat -eq 0; then : 2429aa228fdSmrg else 2438f65982aSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2449aa228fdSmrg exit $stat 2459aa228fdSmrg fi 2469aa228fdSmrg 2478f65982aSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2488f65982aSmrg do 2498f65982aSmrg test -f "$tmpdepfile" && break 2508f65982aSmrg done 2519aa228fdSmrg if test -f "$tmpdepfile"; then 2529aa228fdSmrg # Each line is of the form `foo.o: dependent.h'. 2539aa228fdSmrg # Do two passes, one to just change these to 2549aa228fdSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2558f65982aSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2568f65982aSmrg # That's a tab and a space in the []. 2578f65982aSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 2589aa228fdSmrg else 2599aa228fdSmrg # The sourcefile does not contain any dependencies, so just 2609aa228fdSmrg # store a dummy comment line, to avoid errors with the Makefile 2619aa228fdSmrg # "include basename.Plo" scheme. 2629aa228fdSmrg echo "#dummy" > "$depfile" 2639aa228fdSmrg fi 2649aa228fdSmrg rm -f "$tmpdepfile" 2659aa228fdSmrg ;; 2669aa228fdSmrg 2679aa228fdSmrgicc) 2689aa228fdSmrg # Intel's C compiler understands `-MD -MF file'. However on 2699aa228fdSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 2709aa228fdSmrg # ICC 7.0 will fill foo.d with something like 2719aa228fdSmrg # foo.o: sub/foo.c 2729aa228fdSmrg # foo.o: sub/foo.h 2739aa228fdSmrg # which is wrong. We want: 2749aa228fdSmrg # sub/foo.o: sub/foo.c 2759aa228fdSmrg # sub/foo.o: sub/foo.h 2769aa228fdSmrg # sub/foo.c: 2779aa228fdSmrg # sub/foo.h: 2789aa228fdSmrg # ICC 7.1 will output 2799aa228fdSmrg # foo.o: sub/foo.c sub/foo.h 2809aa228fdSmrg # and will wrap long lines using \ : 2819aa228fdSmrg # foo.o: sub/foo.c ... \ 2829aa228fdSmrg # sub/foo.h ... \ 2839aa228fdSmrg # ... 2849aa228fdSmrg 2859aa228fdSmrg "$@" -MD -MF "$tmpdepfile" 2869aa228fdSmrg stat=$? 2879aa228fdSmrg if test $stat -eq 0; then : 2889aa228fdSmrg else 2899aa228fdSmrg rm -f "$tmpdepfile" 2909aa228fdSmrg exit $stat 2919aa228fdSmrg fi 2929aa228fdSmrg rm -f "$depfile" 2939aa228fdSmrg # Each line is of the form `foo.o: dependent.h', 2949aa228fdSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 2959aa228fdSmrg # Do two passes, one to just change these to 2969aa228fdSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2979aa228fdSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 2989aa228fdSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 2999aa228fdSmrg # correctly. Breaking it into two sed invocations is a workaround. 3009aa228fdSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 3019aa228fdSmrg sed -e 's/$/ :/' >> "$depfile" 3029aa228fdSmrg rm -f "$tmpdepfile" 3039aa228fdSmrg ;; 3049aa228fdSmrg 3059aa228fdSmrghp2) 3069aa228fdSmrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3079aa228fdSmrg # compilers, which have integrated preprocessors. The correct option 3089aa228fdSmrg # to use with these is +Maked; it writes dependencies to a file named 3099aa228fdSmrg # 'foo.d', which lands next to the object file, wherever that 3109aa228fdSmrg # happens to be. 3119aa228fdSmrg # Much of this is similar to the tru64 case; see comments there. 3129aa228fdSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3139aa228fdSmrg test "x$dir" = "x$object" && dir= 3149aa228fdSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3159aa228fdSmrg if test "$libtool" = yes; then 3169aa228fdSmrg tmpdepfile1=$dir$base.d 3179aa228fdSmrg tmpdepfile2=$dir.libs/$base.d 3189aa228fdSmrg "$@" -Wc,+Maked 3199aa228fdSmrg else 3209aa228fdSmrg tmpdepfile1=$dir$base.d 3219aa228fdSmrg tmpdepfile2=$dir$base.d 3229aa228fdSmrg "$@" +Maked 3239aa228fdSmrg fi 3249aa228fdSmrg stat=$? 3259aa228fdSmrg if test $stat -eq 0; then : 3269aa228fdSmrg else 3279aa228fdSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3289aa228fdSmrg exit $stat 3299aa228fdSmrg fi 3309aa228fdSmrg 3319aa228fdSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3329aa228fdSmrg do 3339aa228fdSmrg test -f "$tmpdepfile" && break 3349aa228fdSmrg done 3359aa228fdSmrg if test -f "$tmpdepfile"; then 3369aa228fdSmrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3379aa228fdSmrg # Add `dependent.h:' lines. 3388f65982aSmrg sed -ne '2,${ 3398f65982aSmrg s/^ *// 3408f65982aSmrg s/ \\*$// 3418f65982aSmrg s/$/:/ 3428f65982aSmrg p 3438f65982aSmrg }' "$tmpdepfile" >> "$depfile" 3449aa228fdSmrg else 3459aa228fdSmrg echo "#dummy" > "$depfile" 3469aa228fdSmrg fi 3479aa228fdSmrg rm -f "$tmpdepfile" "$tmpdepfile2" 3489aa228fdSmrg ;; 3499aa228fdSmrg 3509aa228fdSmrgtru64) 3519aa228fdSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 3529aa228fdSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 3539aa228fdSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 3549aa228fdSmrg # dependencies in `foo.d' instead, so we check for that too. 3559aa228fdSmrg # Subdirectories are respected. 3569aa228fdSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3579aa228fdSmrg test "x$dir" = "x$object" && dir= 3589aa228fdSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3599aa228fdSmrg 3609aa228fdSmrg if test "$libtool" = yes; then 3619aa228fdSmrg # With Tru64 cc, shared objects can also be used to make a 3629aa228fdSmrg # static library. This mechanism is used in libtool 1.4 series to 3639aa228fdSmrg # handle both shared and static libraries in a single compilation. 3649aa228fdSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 3659aa228fdSmrg # 3669aa228fdSmrg # With libtool 1.5 this exception was removed, and libtool now 3679aa228fdSmrg # generates 2 separate objects for the 2 libraries. These two 3689aa228fdSmrg # compilations output dependencies in $dir.libs/$base.o.d and 3699aa228fdSmrg # in $dir$base.o.d. We have to check for both files, because 3709aa228fdSmrg # one of the two compilations can be disabled. We should prefer 3719aa228fdSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 3729aa228fdSmrg # automatically cleaned when .libs/ is deleted, while ignoring 3739aa228fdSmrg # the former would cause a distcleancheck panic. 3749aa228fdSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 3759aa228fdSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 3769aa228fdSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 3779aa228fdSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 3789aa228fdSmrg "$@" -Wc,-MD 3799aa228fdSmrg else 3809aa228fdSmrg tmpdepfile1=$dir$base.o.d 3819aa228fdSmrg tmpdepfile2=$dir$base.d 3829aa228fdSmrg tmpdepfile3=$dir$base.d 3839aa228fdSmrg tmpdepfile4=$dir$base.d 3849aa228fdSmrg "$@" -MD 3859aa228fdSmrg fi 3869aa228fdSmrg 3879aa228fdSmrg stat=$? 3889aa228fdSmrg if test $stat -eq 0; then : 3899aa228fdSmrg else 3909aa228fdSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3919aa228fdSmrg exit $stat 3929aa228fdSmrg fi 3939aa228fdSmrg 3949aa228fdSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3959aa228fdSmrg do 3969aa228fdSmrg test -f "$tmpdepfile" && break 3979aa228fdSmrg done 3989aa228fdSmrg if test -f "$tmpdepfile"; then 3999aa228fdSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 4009aa228fdSmrg # That's a tab and a space in the []. 4019aa228fdSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 4029aa228fdSmrg else 4039aa228fdSmrg echo "#dummy" > "$depfile" 4049aa228fdSmrg fi 4059aa228fdSmrg rm -f "$tmpdepfile" 4069aa228fdSmrg ;; 4079aa228fdSmrg 4089aa228fdSmrg#nosideeffect) 4099aa228fdSmrg # This comment above is used by automake to tell side-effect 4109aa228fdSmrg # dependency tracking mechanisms from slower ones. 4119aa228fdSmrg 4129aa228fdSmrgdashmstdout) 4139aa228fdSmrg # Important note: in order to support this mode, a compiler *must* 4149aa228fdSmrg # always write the preprocessed file to stdout, regardless of -o. 4159aa228fdSmrg "$@" || exit $? 4169aa228fdSmrg 4179aa228fdSmrg # Remove the call to Libtool. 4189aa228fdSmrg if test "$libtool" = yes; then 4198f65982aSmrg while test "X$1" != 'X--mode=compile'; do 4209aa228fdSmrg shift 4219aa228fdSmrg done 4229aa228fdSmrg shift 4239aa228fdSmrg fi 4249aa228fdSmrg 4259aa228fdSmrg # Remove `-o $object'. 4269aa228fdSmrg IFS=" " 4279aa228fdSmrg for arg 4289aa228fdSmrg do 4299aa228fdSmrg case $arg in 4309aa228fdSmrg -o) 4319aa228fdSmrg shift 4329aa228fdSmrg ;; 4339aa228fdSmrg $object) 4349aa228fdSmrg shift 4359aa228fdSmrg ;; 4369aa228fdSmrg *) 4379aa228fdSmrg set fnord "$@" "$arg" 4389aa228fdSmrg shift # fnord 4399aa228fdSmrg shift # $arg 4409aa228fdSmrg ;; 4419aa228fdSmrg esac 4429aa228fdSmrg done 4439aa228fdSmrg 4449aa228fdSmrg test -z "$dashmflag" && dashmflag=-M 4459aa228fdSmrg # Require at least two characters before searching for `:' 4469aa228fdSmrg # in the target name. This is to cope with DOS-style filenames: 4479aa228fdSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 4489aa228fdSmrg "$@" $dashmflag | 4499aa228fdSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 4509aa228fdSmrg rm -f "$depfile" 4519aa228fdSmrg cat < "$tmpdepfile" > "$depfile" 4529aa228fdSmrg tr ' ' ' 4539aa228fdSmrg' < "$tmpdepfile" | \ 4549aa228fdSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 4559aa228fdSmrg## correctly. Breaking it into two sed invocations is a workaround. 4569aa228fdSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 4579aa228fdSmrg rm -f "$tmpdepfile" 4589aa228fdSmrg ;; 4599aa228fdSmrg 4609aa228fdSmrgdashXmstdout) 4619aa228fdSmrg # This case only exists to satisfy depend.m4. It is never actually 4629aa228fdSmrg # run, as this mode is specially recognized in the preamble. 4639aa228fdSmrg exit 1 4649aa228fdSmrg ;; 4659aa228fdSmrg 4669aa228fdSmrgmakedepend) 4679aa228fdSmrg "$@" || exit $? 4689aa228fdSmrg # Remove any Libtool call 4699aa228fdSmrg if test "$libtool" = yes; then 4708f65982aSmrg while test "X$1" != 'X--mode=compile'; do 4719aa228fdSmrg shift 4729aa228fdSmrg done 4739aa228fdSmrg shift 4749aa228fdSmrg fi 4759aa228fdSmrg # X makedepend 4769aa228fdSmrg shift 4778f65982aSmrg cleared=no eat=no 4788f65982aSmrg for arg 4798f65982aSmrg do 4809aa228fdSmrg case $cleared in 4819aa228fdSmrg no) 4829aa228fdSmrg set ""; shift 4839aa228fdSmrg cleared=yes ;; 4849aa228fdSmrg esac 4858f65982aSmrg if test $eat = yes; then 4868f65982aSmrg eat=no 4878f65982aSmrg continue 4888f65982aSmrg fi 4899aa228fdSmrg case "$arg" in 4909aa228fdSmrg -D*|-I*) 4919aa228fdSmrg set fnord "$@" "$arg"; shift ;; 4929aa228fdSmrg # Strip any option that makedepend may not understand. Remove 4939aa228fdSmrg # the object too, otherwise makedepend will parse it as a source file. 4948f65982aSmrg -arch) 4958f65982aSmrg eat=yes ;; 4969aa228fdSmrg -*|$object) 4979aa228fdSmrg ;; 4989aa228fdSmrg *) 4999aa228fdSmrg set fnord "$@" "$arg"; shift ;; 5009aa228fdSmrg esac 5019aa228fdSmrg done 5028f65982aSmrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 5039aa228fdSmrg touch "$tmpdepfile" 5049aa228fdSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 5059aa228fdSmrg rm -f "$depfile" 5069aa228fdSmrg cat < "$tmpdepfile" > "$depfile" 5079aa228fdSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 5089aa228fdSmrg' | \ 5099aa228fdSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 5109aa228fdSmrg## correctly. Breaking it into two sed invocations is a workaround. 5119aa228fdSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 5129aa228fdSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 5139aa228fdSmrg ;; 5149aa228fdSmrg 5159aa228fdSmrgcpp) 5169aa228fdSmrg # Important note: in order to support this mode, a compiler *must* 5179aa228fdSmrg # always write the preprocessed file to stdout. 5189aa228fdSmrg "$@" || exit $? 5199aa228fdSmrg 5209aa228fdSmrg # Remove the call to Libtool. 5219aa228fdSmrg if test "$libtool" = yes; then 5228f65982aSmrg while test "X$1" != 'X--mode=compile'; do 5239aa228fdSmrg shift 5249aa228fdSmrg done 5259aa228fdSmrg shift 5269aa228fdSmrg fi 5279aa228fdSmrg 5289aa228fdSmrg # Remove `-o $object'. 5299aa228fdSmrg IFS=" " 5309aa228fdSmrg for arg 5319aa228fdSmrg do 5329aa228fdSmrg case $arg in 5339aa228fdSmrg -o) 5349aa228fdSmrg shift 5359aa228fdSmrg ;; 5369aa228fdSmrg $object) 5379aa228fdSmrg shift 5389aa228fdSmrg ;; 5399aa228fdSmrg *) 5409aa228fdSmrg set fnord "$@" "$arg" 5419aa228fdSmrg shift # fnord 5429aa228fdSmrg shift # $arg 5439aa228fdSmrg ;; 5449aa228fdSmrg esac 5459aa228fdSmrg done 5469aa228fdSmrg 5479aa228fdSmrg "$@" -E | 5489aa228fdSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 5499aa228fdSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 5509aa228fdSmrg sed '$ s: \\$::' > "$tmpdepfile" 5519aa228fdSmrg rm -f "$depfile" 5529aa228fdSmrg echo "$object : \\" > "$depfile" 5539aa228fdSmrg cat < "$tmpdepfile" >> "$depfile" 5549aa228fdSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 5559aa228fdSmrg rm -f "$tmpdepfile" 5569aa228fdSmrg ;; 5579aa228fdSmrg 5589aa228fdSmrgmsvisualcpp) 5599aa228fdSmrg # Important note: in order to support this mode, a compiler *must* 5608f65982aSmrg # always write the preprocessed file to stdout. 5619aa228fdSmrg "$@" || exit $? 5628f65982aSmrg 5638f65982aSmrg # Remove the call to Libtool. 5648f65982aSmrg if test "$libtool" = yes; then 5658f65982aSmrg while test "X$1" != 'X--mode=compile'; do 5668f65982aSmrg shift 5678f65982aSmrg done 5688f65982aSmrg shift 5698f65982aSmrg fi 5708f65982aSmrg 5719aa228fdSmrg IFS=" " 5729aa228fdSmrg for arg 5739aa228fdSmrg do 5749aa228fdSmrg case "$arg" in 5758f65982aSmrg -o) 5768f65982aSmrg shift 5778f65982aSmrg ;; 5788f65982aSmrg $object) 5798f65982aSmrg shift 5808f65982aSmrg ;; 5819aa228fdSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 5829aa228fdSmrg set fnord "$@" 5839aa228fdSmrg shift 5849aa228fdSmrg shift 5859aa228fdSmrg ;; 5869aa228fdSmrg *) 5879aa228fdSmrg set fnord "$@" "$arg" 5889aa228fdSmrg shift 5899aa228fdSmrg shift 5909aa228fdSmrg ;; 5919aa228fdSmrg esac 5929aa228fdSmrg done 5938f65982aSmrg "$@" -E 2>/dev/null | 5948f65982aSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 5959aa228fdSmrg rm -f "$depfile" 5969aa228fdSmrg echo "$object : \\" > "$depfile" 5978f65982aSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 5989aa228fdSmrg echo " " >> "$depfile" 5998f65982aSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 6009aa228fdSmrg rm -f "$tmpdepfile" 6019aa228fdSmrg ;; 6029aa228fdSmrg 6038f65982aSmrgmsvcmsys) 6048f65982aSmrg # This case exists only to let depend.m4 do its work. It works by 6058f65982aSmrg # looking at the text of this script. This case will never be run, 6068f65982aSmrg # since it is checked for above. 6078f65982aSmrg exit 1 6088f65982aSmrg ;; 6098f65982aSmrg 6109aa228fdSmrgnone) 6119aa228fdSmrg exec "$@" 6129aa228fdSmrg ;; 6139aa228fdSmrg 6149aa228fdSmrg*) 6159aa228fdSmrg echo "Unknown depmode $depmode" 1>&2 6169aa228fdSmrg exit 1 6179aa228fdSmrg ;; 6189aa228fdSmrgesac 6199aa228fdSmrg 6209aa228fdSmrgexit 0 6219aa228fdSmrg 6229aa228fdSmrg# Local Variables: 6239aa228fdSmrg# mode: shell-script 6249aa228fdSmrg# sh-indentation: 2 6259aa228fdSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 6269aa228fdSmrg# time-stamp-start: "scriptversion=" 6279aa228fdSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6288f65982aSmrg# time-stamp-time-zone: "UTC" 6298f65982aSmrg# time-stamp-end: "; # UTC" 6309aa228fdSmrg# End: 631