depcomp revision 9418810d
19bd41f2cSmrg#! /bin/sh 29bd41f2cSmrg# depcomp - compile a program generating dependencies as side-effects 39bd41f2cSmrg 49418810dSmrgscriptversion=2009-04-28.21; # UTC 59bd41f2cSmrg 69418810dSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 79418810dSmrg# Software Foundation, Inc. 89bd41f2cSmrg 99bd41f2cSmrg# This program is free software; you can redistribute it and/or modify 109bd41f2cSmrg# it under the terms of the GNU General Public License as published by 119bd41f2cSmrg# the Free Software Foundation; either version 2, or (at your option) 129bd41f2cSmrg# any later version. 139bd41f2cSmrg 149bd41f2cSmrg# This program is distributed in the hope that it will be useful, 159bd41f2cSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 169bd41f2cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 179bd41f2cSmrg# GNU General Public License for more details. 189bd41f2cSmrg 199bd41f2cSmrg# You should have received a copy of the GNU General Public License 209418810dSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 219bd41f2cSmrg 229bd41f2cSmrg# As a special exception to the GNU General Public License, if you 239bd41f2cSmrg# distribute this file as part of a program that contains a 249bd41f2cSmrg# configuration script generated by Autoconf, you may include it under 259bd41f2cSmrg# the same distribution terms that you use for the rest of that program. 269bd41f2cSmrg 279bd41f2cSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 289bd41f2cSmrg 299bd41f2cSmrgcase $1 in 309bd41f2cSmrg '') 319bd41f2cSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 329bd41f2cSmrg exit 1; 339bd41f2cSmrg ;; 349bd41f2cSmrg -h | --h*) 359bd41f2cSmrg cat <<\EOF 369bd41f2cSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 379bd41f2cSmrg 389bd41f2cSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 399bd41f2cSmrgas side-effects. 409bd41f2cSmrg 419bd41f2cSmrgEnvironment variables: 429bd41f2cSmrg depmode Dependency tracking mode. 439bd41f2cSmrg source Source file read by `PROGRAMS ARGS'. 449bd41f2cSmrg object Object file output by `PROGRAMS ARGS'. 459bd41f2cSmrg DEPDIR directory where to store dependencies. 469bd41f2cSmrg depfile Dependency file to output. 479bd41f2cSmrg tmpdepfile Temporary file to use when outputing dependencies. 489bd41f2cSmrg libtool Whether libtool is used (yes/no). 499bd41f2cSmrg 509bd41f2cSmrgReport bugs to <bug-automake@gnu.org>. 519bd41f2cSmrgEOF 529bd41f2cSmrg exit $? 539bd41f2cSmrg ;; 549bd41f2cSmrg -v | --v*) 559bd41f2cSmrg echo "depcomp $scriptversion" 569bd41f2cSmrg exit $? 579bd41f2cSmrg ;; 589bd41f2cSmrgesac 599bd41f2cSmrg 609bd41f2cSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 619bd41f2cSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 629bd41f2cSmrg exit 1 639bd41f2cSmrgfi 649bd41f2cSmrg 659bd41f2cSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 669bd41f2cSmrgdepfile=${depfile-`echo "$object" | 679bd41f2cSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 689bd41f2cSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 699bd41f2cSmrg 709bd41f2cSmrgrm -f "$tmpdepfile" 719bd41f2cSmrg 729bd41f2cSmrg# Some modes work just like other modes, but use different flags. We 739bd41f2cSmrg# parameterize here, but still list the modes in the big case below, 749bd41f2cSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 759bd41f2cSmrg# here, because this file can only contain one case statement. 769bd41f2cSmrgif test "$depmode" = hp; then 779bd41f2cSmrg # HP compiler uses -M and no extra arg. 789bd41f2cSmrg gccflag=-M 799bd41f2cSmrg depmode=gcc 809bd41f2cSmrgfi 819bd41f2cSmrg 829bd41f2cSmrgif test "$depmode" = dashXmstdout; then 839bd41f2cSmrg # This is just like dashmstdout with a different argument. 849bd41f2cSmrg dashmflag=-xM 859bd41f2cSmrg depmode=dashmstdout 869bd41f2cSmrgfi 879bd41f2cSmrg 889418810dSmrgcygpath_u="cygpath -u -f -" 899418810dSmrgif test "$depmode" = msvcmsys; then 909418810dSmrg # This is just like msvisualcpp but w/o cygpath translation. 919418810dSmrg # Just convert the backslash-escaped backslashes to single forward 929418810dSmrg # slashes to satisfy depend.m4 939418810dSmrg cygpath_u="sed s,\\\\\\\\,/,g" 949418810dSmrg depmode=msvisualcpp 959418810dSmrgfi 969418810dSmrg 979bd41f2cSmrgcase "$depmode" in 989bd41f2cSmrggcc3) 999bd41f2cSmrg## gcc 3 implements dependency tracking that does exactly what 1009bd41f2cSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 1019bd41f2cSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 1029418810dSmrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1039418810dSmrg## the command line argument order; so add the flags where they 1049418810dSmrg## appear in depend2.am. Note that the slowdown incurred here 1059418810dSmrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1069418810dSmrg for arg 1079418810dSmrg do 1089418810dSmrg case $arg in 1099418810dSmrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1109418810dSmrg *) set fnord "$@" "$arg" ;; 1119418810dSmrg esac 1129418810dSmrg shift # fnord 1139418810dSmrg shift # $arg 1149418810dSmrg done 1159418810dSmrg "$@" 1169bd41f2cSmrg stat=$? 1179bd41f2cSmrg if test $stat -eq 0; then : 1189bd41f2cSmrg else 1199bd41f2cSmrg rm -f "$tmpdepfile" 1209bd41f2cSmrg exit $stat 1219bd41f2cSmrg fi 1229bd41f2cSmrg mv "$tmpdepfile" "$depfile" 1239bd41f2cSmrg ;; 1249bd41f2cSmrg 1259bd41f2cSmrggcc) 1269bd41f2cSmrg## There are various ways to get dependency output from gcc. Here's 1279bd41f2cSmrg## why we pick this rather obscure method: 1289bd41f2cSmrg## - Don't want to use -MD because we'd like the dependencies to end 1299bd41f2cSmrg## up in a subdir. Having to rename by hand is ugly. 1309bd41f2cSmrg## (We might end up doing this anyway to support other compilers.) 1319bd41f2cSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 1329bd41f2cSmrg## -MM, not -M (despite what the docs say). 1339bd41f2cSmrg## - Using -M directly means running the compiler twice (even worse 1349bd41f2cSmrg## than renaming). 1359bd41f2cSmrg if test -z "$gccflag"; then 1369bd41f2cSmrg gccflag=-MD, 1379bd41f2cSmrg fi 1389bd41f2cSmrg "$@" -Wp,"$gccflag$tmpdepfile" 1399bd41f2cSmrg stat=$? 1409bd41f2cSmrg if test $stat -eq 0; then : 1419bd41f2cSmrg else 1429bd41f2cSmrg rm -f "$tmpdepfile" 1439bd41f2cSmrg exit $stat 1449bd41f2cSmrg fi 1459bd41f2cSmrg rm -f "$depfile" 1469bd41f2cSmrg echo "$object : \\" > "$depfile" 1479bd41f2cSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1489bd41f2cSmrg## The second -e expression handles DOS-style file names with drive letters. 1499bd41f2cSmrg sed -e 's/^[^:]*: / /' \ 1509bd41f2cSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1519bd41f2cSmrg## This next piece of magic avoids the `deleted header file' problem. 1529bd41f2cSmrg## The problem is that when a header file which appears in a .P file 1539bd41f2cSmrg## is deleted, the dependency causes make to die (because there is 1549bd41f2cSmrg## typically no way to rebuild the header). We avoid this by adding 1559bd41f2cSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 1569bd41f2cSmrg## this for us directly. 1579bd41f2cSmrg tr ' ' ' 1589bd41f2cSmrg' < "$tmpdepfile" | 1599bd41f2cSmrg## Some versions of gcc put a space before the `:'. On the theory 1609bd41f2cSmrg## that the space means something, we add a space to the output as 1619bd41f2cSmrg## well. 1629bd41f2cSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 1639bd41f2cSmrg## correctly. Breaking it into two sed invocations is a workaround. 1649bd41f2cSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 1659bd41f2cSmrg rm -f "$tmpdepfile" 1669bd41f2cSmrg ;; 1679bd41f2cSmrg 1689bd41f2cSmrghp) 1699bd41f2cSmrg # This case exists only to let depend.m4 do its work. It works by 1709bd41f2cSmrg # looking at the text of this script. This case will never be run, 1719bd41f2cSmrg # since it is checked for above. 1729bd41f2cSmrg exit 1 1739bd41f2cSmrg ;; 1749bd41f2cSmrg 1759bd41f2cSmrgsgi) 1769bd41f2cSmrg if test "$libtool" = yes; then 1779bd41f2cSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 1789bd41f2cSmrg else 1799bd41f2cSmrg "$@" -MDupdate "$tmpdepfile" 1809bd41f2cSmrg fi 1819bd41f2cSmrg stat=$? 1829bd41f2cSmrg if test $stat -eq 0; then : 1839bd41f2cSmrg else 1849bd41f2cSmrg rm -f "$tmpdepfile" 1859bd41f2cSmrg exit $stat 1869bd41f2cSmrg fi 1879bd41f2cSmrg rm -f "$depfile" 1889bd41f2cSmrg 1899bd41f2cSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1909bd41f2cSmrg echo "$object : \\" > "$depfile" 1919bd41f2cSmrg 1929bd41f2cSmrg # Clip off the initial element (the dependent). Don't try to be 1939bd41f2cSmrg # clever and replace this with sed code, as IRIX sed won't handle 1949bd41f2cSmrg # lines with more than a fixed number of characters (4096 in 1959bd41f2cSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1969bd41f2cSmrg # the IRIX cc adds comments like `#:fec' to the end of the 1979bd41f2cSmrg # dependency line. 1989bd41f2cSmrg tr ' ' ' 1999bd41f2cSmrg' < "$tmpdepfile" \ 2009bd41f2cSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 2019bd41f2cSmrg tr ' 2029418810dSmrg' ' ' >> "$depfile" 2039418810dSmrg echo >> "$depfile" 2049bd41f2cSmrg 2059bd41f2cSmrg # The second pass generates a dummy entry for each header file. 2069bd41f2cSmrg tr ' ' ' 2079bd41f2cSmrg' < "$tmpdepfile" \ 2089bd41f2cSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2099418810dSmrg >> "$depfile" 2109bd41f2cSmrg else 2119bd41f2cSmrg # The sourcefile does not contain any dependencies, so just 2129bd41f2cSmrg # store a dummy comment line, to avoid errors with the Makefile 2139bd41f2cSmrg # "include basename.Plo" scheme. 2149bd41f2cSmrg echo "#dummy" > "$depfile" 2159bd41f2cSmrg fi 2169bd41f2cSmrg rm -f "$tmpdepfile" 2179bd41f2cSmrg ;; 2189bd41f2cSmrg 2199bd41f2cSmrgaix) 2209bd41f2cSmrg # The C for AIX Compiler uses -M and outputs the dependencies 2219bd41f2cSmrg # in a .u file. In older versions, this file always lives in the 2229bd41f2cSmrg # current directory. Also, the AIX compiler puts `$object:' at the 2239bd41f2cSmrg # start of each line; $object doesn't have directory information. 2249bd41f2cSmrg # Version 6 uses the directory in both cases. 2259418810dSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2269418810dSmrg test "x$dir" = "x$object" && dir= 2279418810dSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 2289bd41f2cSmrg if test "$libtool" = yes; then 2299418810dSmrg tmpdepfile1=$dir$base.u 2309418810dSmrg tmpdepfile2=$base.u 2319418810dSmrg tmpdepfile3=$dir.libs/$base.u 2329bd41f2cSmrg "$@" -Wc,-M 2339bd41f2cSmrg else 2349418810dSmrg tmpdepfile1=$dir$base.u 2359418810dSmrg tmpdepfile2=$dir$base.u 2369418810dSmrg tmpdepfile3=$dir$base.u 2379bd41f2cSmrg "$@" -M 2389bd41f2cSmrg fi 2399bd41f2cSmrg stat=$? 2409bd41f2cSmrg 2419bd41f2cSmrg if test $stat -eq 0; then : 2429bd41f2cSmrg else 2439418810dSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2449bd41f2cSmrg exit $stat 2459bd41f2cSmrg fi 2469bd41f2cSmrg 2479418810dSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2489418810dSmrg do 2499418810dSmrg test -f "$tmpdepfile" && break 2509418810dSmrg done 2519bd41f2cSmrg if test -f "$tmpdepfile"; then 2529bd41f2cSmrg # Each line is of the form `foo.o: dependent.h'. 2539bd41f2cSmrg # Do two passes, one to just change these to 2549bd41f2cSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2559418810dSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2569418810dSmrg # That's a tab and a space in the []. 2579418810dSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 2589bd41f2cSmrg else 2599bd41f2cSmrg # The sourcefile does not contain any dependencies, so just 2609bd41f2cSmrg # store a dummy comment line, to avoid errors with the Makefile 2619bd41f2cSmrg # "include basename.Plo" scheme. 2629bd41f2cSmrg echo "#dummy" > "$depfile" 2639bd41f2cSmrg fi 2649bd41f2cSmrg rm -f "$tmpdepfile" 2659bd41f2cSmrg ;; 2669bd41f2cSmrg 2679bd41f2cSmrgicc) 2689bd41f2cSmrg # Intel's C compiler understands `-MD -MF file'. However on 2699bd41f2cSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 2709bd41f2cSmrg # ICC 7.0 will fill foo.d with something like 2719bd41f2cSmrg # foo.o: sub/foo.c 2729bd41f2cSmrg # foo.o: sub/foo.h 2739bd41f2cSmrg # which is wrong. We want: 2749bd41f2cSmrg # sub/foo.o: sub/foo.c 2759bd41f2cSmrg # sub/foo.o: sub/foo.h 2769bd41f2cSmrg # sub/foo.c: 2779bd41f2cSmrg # sub/foo.h: 2789bd41f2cSmrg # ICC 7.1 will output 2799bd41f2cSmrg # foo.o: sub/foo.c sub/foo.h 2809bd41f2cSmrg # and will wrap long lines using \ : 2819bd41f2cSmrg # foo.o: sub/foo.c ... \ 2829bd41f2cSmrg # sub/foo.h ... \ 2839bd41f2cSmrg # ... 2849bd41f2cSmrg 2859bd41f2cSmrg "$@" -MD -MF "$tmpdepfile" 2869bd41f2cSmrg stat=$? 2879bd41f2cSmrg if test $stat -eq 0; then : 2889bd41f2cSmrg else 2899bd41f2cSmrg rm -f "$tmpdepfile" 2909bd41f2cSmrg exit $stat 2919bd41f2cSmrg fi 2929bd41f2cSmrg rm -f "$depfile" 2939bd41f2cSmrg # Each line is of the form `foo.o: dependent.h', 2949bd41f2cSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 2959bd41f2cSmrg # Do two passes, one to just change these to 2969bd41f2cSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2979bd41f2cSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 2989bd41f2cSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 2999bd41f2cSmrg # correctly. Breaking it into two sed invocations is a workaround. 3009bd41f2cSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 3019bd41f2cSmrg sed -e 's/$/ :/' >> "$depfile" 3029bd41f2cSmrg rm -f "$tmpdepfile" 3039bd41f2cSmrg ;; 3049bd41f2cSmrg 3059418810dSmrghp2) 3069418810dSmrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3079418810dSmrg # compilers, which have integrated preprocessors. The correct option 3089418810dSmrg # to use with these is +Maked; it writes dependencies to a file named 3099418810dSmrg # 'foo.d', which lands next to the object file, wherever that 3109418810dSmrg # happens to be. 3119418810dSmrg # Much of this is similar to the tru64 case; see comments there. 3129418810dSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3139418810dSmrg test "x$dir" = "x$object" && dir= 3149418810dSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3159418810dSmrg if test "$libtool" = yes; then 3169418810dSmrg tmpdepfile1=$dir$base.d 3179418810dSmrg tmpdepfile2=$dir.libs/$base.d 3189418810dSmrg "$@" -Wc,+Maked 3199418810dSmrg else 3209418810dSmrg tmpdepfile1=$dir$base.d 3219418810dSmrg tmpdepfile2=$dir$base.d 3229418810dSmrg "$@" +Maked 3239418810dSmrg fi 3249418810dSmrg stat=$? 3259418810dSmrg if test $stat -eq 0; then : 3269418810dSmrg else 3279418810dSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3289418810dSmrg exit $stat 3299418810dSmrg fi 3309418810dSmrg 3319418810dSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3329418810dSmrg do 3339418810dSmrg test -f "$tmpdepfile" && break 3349418810dSmrg done 3359418810dSmrg if test -f "$tmpdepfile"; then 3369418810dSmrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3379418810dSmrg # Add `dependent.h:' lines. 3389418810dSmrg sed -ne '2,${ 3399418810dSmrg s/^ *// 3409418810dSmrg s/ \\*$// 3419418810dSmrg s/$/:/ 3429418810dSmrg p 3439418810dSmrg }' "$tmpdepfile" >> "$depfile" 3449418810dSmrg else 3459418810dSmrg echo "#dummy" > "$depfile" 3469418810dSmrg fi 3479418810dSmrg rm -f "$tmpdepfile" "$tmpdepfile2" 3489418810dSmrg ;; 3499418810dSmrg 3509bd41f2cSmrgtru64) 3519bd41f2cSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 3529bd41f2cSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 3539bd41f2cSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 3549bd41f2cSmrg # dependencies in `foo.d' instead, so we check for that too. 3559bd41f2cSmrg # Subdirectories are respected. 3569bd41f2cSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3579bd41f2cSmrg test "x$dir" = "x$object" && dir= 3589bd41f2cSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3599bd41f2cSmrg 3609bd41f2cSmrg if test "$libtool" = yes; then 3619bd41f2cSmrg # With Tru64 cc, shared objects can also be used to make a 3629418810dSmrg # static library. This mechanism is used in libtool 1.4 series to 3639bd41f2cSmrg # handle both shared and static libraries in a single compilation. 3649bd41f2cSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 3659bd41f2cSmrg # 3669bd41f2cSmrg # With libtool 1.5 this exception was removed, and libtool now 3679bd41f2cSmrg # generates 2 separate objects for the 2 libraries. These two 3689418810dSmrg # compilations output dependencies in $dir.libs/$base.o.d and 3699bd41f2cSmrg # in $dir$base.o.d. We have to check for both files, because 3709bd41f2cSmrg # one of the two compilations can be disabled. We should prefer 3719bd41f2cSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 3729bd41f2cSmrg # automatically cleaned when .libs/ is deleted, while ignoring 3739bd41f2cSmrg # the former would cause a distcleancheck panic. 3749bd41f2cSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 3759bd41f2cSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 3769bd41f2cSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 3779bd41f2cSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 3789bd41f2cSmrg "$@" -Wc,-MD 3799bd41f2cSmrg else 3809bd41f2cSmrg tmpdepfile1=$dir$base.o.d 3819bd41f2cSmrg tmpdepfile2=$dir$base.d 3829bd41f2cSmrg tmpdepfile3=$dir$base.d 3839bd41f2cSmrg tmpdepfile4=$dir$base.d 3849bd41f2cSmrg "$@" -MD 3859bd41f2cSmrg fi 3869bd41f2cSmrg 3879bd41f2cSmrg stat=$? 3889bd41f2cSmrg if test $stat -eq 0; then : 3899bd41f2cSmrg else 3909bd41f2cSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3919bd41f2cSmrg exit $stat 3929bd41f2cSmrg fi 3939bd41f2cSmrg 3949bd41f2cSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3959bd41f2cSmrg do 3969bd41f2cSmrg test -f "$tmpdepfile" && break 3979bd41f2cSmrg done 3989bd41f2cSmrg if test -f "$tmpdepfile"; then 3999bd41f2cSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 4009bd41f2cSmrg # That's a tab and a space in the []. 4019bd41f2cSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 4029bd41f2cSmrg else 4039bd41f2cSmrg echo "#dummy" > "$depfile" 4049bd41f2cSmrg fi 4059bd41f2cSmrg rm -f "$tmpdepfile" 4069bd41f2cSmrg ;; 4079bd41f2cSmrg 4089bd41f2cSmrg#nosideeffect) 4099bd41f2cSmrg # This comment above is used by automake to tell side-effect 4109bd41f2cSmrg # dependency tracking mechanisms from slower ones. 4119bd41f2cSmrg 4129bd41f2cSmrgdashmstdout) 4139bd41f2cSmrg # Important note: in order to support this mode, a compiler *must* 4149bd41f2cSmrg # always write the preprocessed file to stdout, regardless of -o. 4159bd41f2cSmrg "$@" || exit $? 4169bd41f2cSmrg 4179bd41f2cSmrg # Remove the call to Libtool. 4189bd41f2cSmrg if test "$libtool" = yes; then 4199418810dSmrg while test "X$1" != 'X--mode=compile'; do 4209bd41f2cSmrg shift 4219bd41f2cSmrg done 4229bd41f2cSmrg shift 4239bd41f2cSmrg fi 4249bd41f2cSmrg 4259bd41f2cSmrg # Remove `-o $object'. 4269bd41f2cSmrg IFS=" " 4279bd41f2cSmrg for arg 4289bd41f2cSmrg do 4299bd41f2cSmrg case $arg in 4309bd41f2cSmrg -o) 4319bd41f2cSmrg shift 4329bd41f2cSmrg ;; 4339bd41f2cSmrg $object) 4349bd41f2cSmrg shift 4359bd41f2cSmrg ;; 4369bd41f2cSmrg *) 4379bd41f2cSmrg set fnord "$@" "$arg" 4389bd41f2cSmrg shift # fnord 4399bd41f2cSmrg shift # $arg 4409bd41f2cSmrg ;; 4419bd41f2cSmrg esac 4429bd41f2cSmrg done 4439bd41f2cSmrg 4449bd41f2cSmrg test -z "$dashmflag" && dashmflag=-M 4459bd41f2cSmrg # Require at least two characters before searching for `:' 4469bd41f2cSmrg # in the target name. This is to cope with DOS-style filenames: 4479bd41f2cSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 4489bd41f2cSmrg "$@" $dashmflag | 4499bd41f2cSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 4509bd41f2cSmrg rm -f "$depfile" 4519bd41f2cSmrg cat < "$tmpdepfile" > "$depfile" 4529bd41f2cSmrg tr ' ' ' 4539bd41f2cSmrg' < "$tmpdepfile" | \ 4549bd41f2cSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 4559bd41f2cSmrg## correctly. Breaking it into two sed invocations is a workaround. 4569bd41f2cSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 4579bd41f2cSmrg rm -f "$tmpdepfile" 4589bd41f2cSmrg ;; 4599bd41f2cSmrg 4609bd41f2cSmrgdashXmstdout) 4619bd41f2cSmrg # This case only exists to satisfy depend.m4. It is never actually 4629bd41f2cSmrg # run, as this mode is specially recognized in the preamble. 4639bd41f2cSmrg exit 1 4649bd41f2cSmrg ;; 4659bd41f2cSmrg 4669bd41f2cSmrgmakedepend) 4679bd41f2cSmrg "$@" || exit $? 4689bd41f2cSmrg # Remove any Libtool call 4699bd41f2cSmrg if test "$libtool" = yes; then 4709418810dSmrg while test "X$1" != 'X--mode=compile'; do 4719bd41f2cSmrg shift 4729bd41f2cSmrg done 4739bd41f2cSmrg shift 4749bd41f2cSmrg fi 4759bd41f2cSmrg # X makedepend 4769bd41f2cSmrg shift 4779418810dSmrg cleared=no eat=no 4789418810dSmrg for arg 4799418810dSmrg do 4809bd41f2cSmrg case $cleared in 4819bd41f2cSmrg no) 4829bd41f2cSmrg set ""; shift 4839bd41f2cSmrg cleared=yes ;; 4849bd41f2cSmrg esac 4859418810dSmrg if test $eat = yes; then 4869418810dSmrg eat=no 4879418810dSmrg continue 4889418810dSmrg fi 4899bd41f2cSmrg case "$arg" in 4909bd41f2cSmrg -D*|-I*) 4919bd41f2cSmrg set fnord "$@" "$arg"; shift ;; 4929bd41f2cSmrg # Strip any option that makedepend may not understand. Remove 4939bd41f2cSmrg # the object too, otherwise makedepend will parse it as a source file. 4949418810dSmrg -arch) 4959418810dSmrg eat=yes ;; 4969bd41f2cSmrg -*|$object) 4979bd41f2cSmrg ;; 4989bd41f2cSmrg *) 4999bd41f2cSmrg set fnord "$@" "$arg"; shift ;; 5009bd41f2cSmrg esac 5019bd41f2cSmrg done 5029418810dSmrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 5039bd41f2cSmrg touch "$tmpdepfile" 5049bd41f2cSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 5059bd41f2cSmrg rm -f "$depfile" 5069bd41f2cSmrg cat < "$tmpdepfile" > "$depfile" 5079bd41f2cSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 5089bd41f2cSmrg' | \ 5099bd41f2cSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 5109bd41f2cSmrg## correctly. Breaking it into two sed invocations is a workaround. 5119bd41f2cSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 5129bd41f2cSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 5139bd41f2cSmrg ;; 5149bd41f2cSmrg 5159bd41f2cSmrgcpp) 5169bd41f2cSmrg # Important note: in order to support this mode, a compiler *must* 5179bd41f2cSmrg # always write the preprocessed file to stdout. 5189bd41f2cSmrg "$@" || exit $? 5199bd41f2cSmrg 5209bd41f2cSmrg # Remove the call to Libtool. 5219bd41f2cSmrg if test "$libtool" = yes; then 5229418810dSmrg while test "X$1" != 'X--mode=compile'; do 5239bd41f2cSmrg shift 5249bd41f2cSmrg done 5259bd41f2cSmrg shift 5269bd41f2cSmrg fi 5279bd41f2cSmrg 5289bd41f2cSmrg # Remove `-o $object'. 5299bd41f2cSmrg IFS=" " 5309bd41f2cSmrg for arg 5319bd41f2cSmrg do 5329bd41f2cSmrg case $arg in 5339bd41f2cSmrg -o) 5349bd41f2cSmrg shift 5359bd41f2cSmrg ;; 5369bd41f2cSmrg $object) 5379bd41f2cSmrg shift 5389bd41f2cSmrg ;; 5399bd41f2cSmrg *) 5409bd41f2cSmrg set fnord "$@" "$arg" 5419bd41f2cSmrg shift # fnord 5429bd41f2cSmrg shift # $arg 5439bd41f2cSmrg ;; 5449bd41f2cSmrg esac 5459bd41f2cSmrg done 5469bd41f2cSmrg 5479bd41f2cSmrg "$@" -E | 5489bd41f2cSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 5499bd41f2cSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 5509bd41f2cSmrg sed '$ s: \\$::' > "$tmpdepfile" 5519bd41f2cSmrg rm -f "$depfile" 5529bd41f2cSmrg echo "$object : \\" > "$depfile" 5539bd41f2cSmrg cat < "$tmpdepfile" >> "$depfile" 5549bd41f2cSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 5559bd41f2cSmrg rm -f "$tmpdepfile" 5569bd41f2cSmrg ;; 5579bd41f2cSmrg 5589bd41f2cSmrgmsvisualcpp) 5599bd41f2cSmrg # Important note: in order to support this mode, a compiler *must* 5609418810dSmrg # always write the preprocessed file to stdout. 5619bd41f2cSmrg "$@" || exit $? 5629418810dSmrg 5639418810dSmrg # Remove the call to Libtool. 5649418810dSmrg if test "$libtool" = yes; then 5659418810dSmrg while test "X$1" != 'X--mode=compile'; do 5669418810dSmrg shift 5679418810dSmrg done 5689418810dSmrg shift 5699418810dSmrg fi 5709418810dSmrg 5719bd41f2cSmrg IFS=" " 5729bd41f2cSmrg for arg 5739bd41f2cSmrg do 5749bd41f2cSmrg case "$arg" in 5759418810dSmrg -o) 5769418810dSmrg shift 5779418810dSmrg ;; 5789418810dSmrg $object) 5799418810dSmrg shift 5809418810dSmrg ;; 5819bd41f2cSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 5829bd41f2cSmrg set fnord "$@" 5839bd41f2cSmrg shift 5849bd41f2cSmrg shift 5859bd41f2cSmrg ;; 5869bd41f2cSmrg *) 5879bd41f2cSmrg set fnord "$@" "$arg" 5889bd41f2cSmrg shift 5899bd41f2cSmrg shift 5909bd41f2cSmrg ;; 5919bd41f2cSmrg esac 5929bd41f2cSmrg done 5939418810dSmrg "$@" -E 2>/dev/null | 5949418810dSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 5959bd41f2cSmrg rm -f "$depfile" 5969bd41f2cSmrg echo "$object : \\" > "$depfile" 5979418810dSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 5989bd41f2cSmrg echo " " >> "$depfile" 5999418810dSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 6009bd41f2cSmrg rm -f "$tmpdepfile" 6019bd41f2cSmrg ;; 6029bd41f2cSmrg 6039418810dSmrgmsvcmsys) 6049418810dSmrg # This case exists only to let depend.m4 do its work. It works by 6059418810dSmrg # looking at the text of this script. This case will never be run, 6069418810dSmrg # since it is checked for above. 6079418810dSmrg exit 1 6089418810dSmrg ;; 6099418810dSmrg 6109bd41f2cSmrgnone) 6119bd41f2cSmrg exec "$@" 6129bd41f2cSmrg ;; 6139bd41f2cSmrg 6149bd41f2cSmrg*) 6159bd41f2cSmrg echo "Unknown depmode $depmode" 1>&2 6169bd41f2cSmrg exit 1 6179bd41f2cSmrg ;; 6189bd41f2cSmrgesac 6199bd41f2cSmrg 6209bd41f2cSmrgexit 0 6219bd41f2cSmrg 6229bd41f2cSmrg# Local Variables: 6239bd41f2cSmrg# mode: shell-script 6249bd41f2cSmrg# sh-indentation: 2 6259bd41f2cSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 6269bd41f2cSmrg# time-stamp-start: "scriptversion=" 6279bd41f2cSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6289418810dSmrg# time-stamp-time-zone: "UTC" 6299418810dSmrg# time-stamp-end: "; # UTC" 6309bd41f2cSmrg# End: 631