depcomp revision 7888fd0e
10fa2845dSmrg#! /bin/sh 20fa2845dSmrg# depcomp - compile a program generating dependencies as side-effects 30fa2845dSmrg 47888fd0eSmrgscriptversion=2009-04-28.21; # UTC 50fa2845dSmrg 67888fd0eSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 77888fd0eSmrg# Software Foundation, Inc. 80fa2845dSmrg 90fa2845dSmrg# This program is free software; you can redistribute it and/or modify 100fa2845dSmrg# it under the terms of the GNU General Public License as published by 110fa2845dSmrg# the Free Software Foundation; either version 2, or (at your option) 120fa2845dSmrg# any later version. 130fa2845dSmrg 140fa2845dSmrg# This program is distributed in the hope that it will be useful, 150fa2845dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 160fa2845dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 170fa2845dSmrg# GNU General Public License for more details. 180fa2845dSmrg 190fa2845dSmrg# You should have received a copy of the GNU General Public License 207888fd0eSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 210fa2845dSmrg 220fa2845dSmrg# As a special exception to the GNU General Public License, if you 230fa2845dSmrg# distribute this file as part of a program that contains a 240fa2845dSmrg# configuration script generated by Autoconf, you may include it under 250fa2845dSmrg# the same distribution terms that you use for the rest of that program. 260fa2845dSmrg 270fa2845dSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 280fa2845dSmrg 290fa2845dSmrgcase $1 in 300fa2845dSmrg '') 310fa2845dSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 320fa2845dSmrg exit 1; 330fa2845dSmrg ;; 340fa2845dSmrg -h | --h*) 350fa2845dSmrg cat <<\EOF 360fa2845dSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 370fa2845dSmrg 380fa2845dSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 390fa2845dSmrgas side-effects. 400fa2845dSmrg 410fa2845dSmrgEnvironment variables: 420fa2845dSmrg depmode Dependency tracking mode. 430fa2845dSmrg source Source file read by `PROGRAMS ARGS'. 440fa2845dSmrg object Object file output by `PROGRAMS ARGS'. 450fa2845dSmrg DEPDIR directory where to store dependencies. 460fa2845dSmrg depfile Dependency file to output. 470fa2845dSmrg tmpdepfile Temporary file to use when outputing dependencies. 480fa2845dSmrg libtool Whether libtool is used (yes/no). 490fa2845dSmrg 500fa2845dSmrgReport bugs to <bug-automake@gnu.org>. 510fa2845dSmrgEOF 520fa2845dSmrg exit $? 530fa2845dSmrg ;; 540fa2845dSmrg -v | --v*) 550fa2845dSmrg echo "depcomp $scriptversion" 560fa2845dSmrg exit $? 570fa2845dSmrg ;; 580fa2845dSmrgesac 590fa2845dSmrg 600fa2845dSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 610fa2845dSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 620fa2845dSmrg exit 1 630fa2845dSmrgfi 640fa2845dSmrg 650fa2845dSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 660fa2845dSmrgdepfile=${depfile-`echo "$object" | 670fa2845dSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 680fa2845dSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 690fa2845dSmrg 700fa2845dSmrgrm -f "$tmpdepfile" 710fa2845dSmrg 720fa2845dSmrg# Some modes work just like other modes, but use different flags. We 730fa2845dSmrg# parameterize here, but still list the modes in the big case below, 740fa2845dSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 750fa2845dSmrg# here, because this file can only contain one case statement. 760fa2845dSmrgif test "$depmode" = hp; then 770fa2845dSmrg # HP compiler uses -M and no extra arg. 780fa2845dSmrg gccflag=-M 790fa2845dSmrg depmode=gcc 800fa2845dSmrgfi 810fa2845dSmrg 820fa2845dSmrgif test "$depmode" = dashXmstdout; then 830fa2845dSmrg # This is just like dashmstdout with a different argument. 840fa2845dSmrg dashmflag=-xM 850fa2845dSmrg depmode=dashmstdout 860fa2845dSmrgfi 870fa2845dSmrg 887888fd0eSmrgcygpath_u="cygpath -u -f -" 897888fd0eSmrgif test "$depmode" = msvcmsys; then 907888fd0eSmrg # This is just like msvisualcpp but w/o cygpath translation. 917888fd0eSmrg # Just convert the backslash-escaped backslashes to single forward 927888fd0eSmrg # slashes to satisfy depend.m4 937888fd0eSmrg cygpath_u="sed s,\\\\\\\\,/,g" 947888fd0eSmrg depmode=msvisualcpp 957888fd0eSmrgfi 967888fd0eSmrg 970fa2845dSmrgcase "$depmode" in 980fa2845dSmrggcc3) 990fa2845dSmrg## gcc 3 implements dependency tracking that does exactly what 1000fa2845dSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 1010fa2845dSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 1020fa2845dSmrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1030fa2845dSmrg## the command line argument order; so add the flags where they 1040fa2845dSmrg## appear in depend2.am. Note that the slowdown incurred here 1050fa2845dSmrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1060fa2845dSmrg for arg 1070fa2845dSmrg do 1080fa2845dSmrg case $arg in 1090fa2845dSmrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1100fa2845dSmrg *) set fnord "$@" "$arg" ;; 1110fa2845dSmrg esac 1120fa2845dSmrg shift # fnord 1130fa2845dSmrg shift # $arg 1140fa2845dSmrg done 1150fa2845dSmrg "$@" 1160fa2845dSmrg stat=$? 1170fa2845dSmrg if test $stat -eq 0; then : 1180fa2845dSmrg else 1190fa2845dSmrg rm -f "$tmpdepfile" 1200fa2845dSmrg exit $stat 1210fa2845dSmrg fi 1220fa2845dSmrg mv "$tmpdepfile" "$depfile" 1230fa2845dSmrg ;; 1240fa2845dSmrg 1250fa2845dSmrggcc) 1260fa2845dSmrg## There are various ways to get dependency output from gcc. Here's 1270fa2845dSmrg## why we pick this rather obscure method: 1280fa2845dSmrg## - Don't want to use -MD because we'd like the dependencies to end 1290fa2845dSmrg## up in a subdir. Having to rename by hand is ugly. 1300fa2845dSmrg## (We might end up doing this anyway to support other compilers.) 1310fa2845dSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 1320fa2845dSmrg## -MM, not -M (despite what the docs say). 1330fa2845dSmrg## - Using -M directly means running the compiler twice (even worse 1340fa2845dSmrg## than renaming). 1350fa2845dSmrg if test -z "$gccflag"; then 1360fa2845dSmrg gccflag=-MD, 1370fa2845dSmrg fi 1380fa2845dSmrg "$@" -Wp,"$gccflag$tmpdepfile" 1390fa2845dSmrg stat=$? 1400fa2845dSmrg if test $stat -eq 0; then : 1410fa2845dSmrg else 1420fa2845dSmrg rm -f "$tmpdepfile" 1430fa2845dSmrg exit $stat 1440fa2845dSmrg fi 1450fa2845dSmrg rm -f "$depfile" 1460fa2845dSmrg echo "$object : \\" > "$depfile" 1470fa2845dSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1480fa2845dSmrg## The second -e expression handles DOS-style file names with drive letters. 1490fa2845dSmrg sed -e 's/^[^:]*: / /' \ 1500fa2845dSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1510fa2845dSmrg## This next piece of magic avoids the `deleted header file' problem. 1520fa2845dSmrg## The problem is that when a header file which appears in a .P file 1530fa2845dSmrg## is deleted, the dependency causes make to die (because there is 1540fa2845dSmrg## typically no way to rebuild the header). We avoid this by adding 1550fa2845dSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 1560fa2845dSmrg## this for us directly. 1570fa2845dSmrg tr ' ' ' 1580fa2845dSmrg' < "$tmpdepfile" | 1590fa2845dSmrg## Some versions of gcc put a space before the `:'. On the theory 1600fa2845dSmrg## that the space means something, we add a space to the output as 1610fa2845dSmrg## well. 1620fa2845dSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 1630fa2845dSmrg## correctly. Breaking it into two sed invocations is a workaround. 1640fa2845dSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 1650fa2845dSmrg rm -f "$tmpdepfile" 1660fa2845dSmrg ;; 1670fa2845dSmrg 1680fa2845dSmrghp) 1690fa2845dSmrg # This case exists only to let depend.m4 do its work. It works by 1700fa2845dSmrg # looking at the text of this script. This case will never be run, 1710fa2845dSmrg # since it is checked for above. 1720fa2845dSmrg exit 1 1730fa2845dSmrg ;; 1740fa2845dSmrg 1750fa2845dSmrgsgi) 1760fa2845dSmrg if test "$libtool" = yes; then 1770fa2845dSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 1780fa2845dSmrg else 1790fa2845dSmrg "$@" -MDupdate "$tmpdepfile" 1800fa2845dSmrg fi 1810fa2845dSmrg stat=$? 1820fa2845dSmrg if test $stat -eq 0; then : 1830fa2845dSmrg else 1840fa2845dSmrg rm -f "$tmpdepfile" 1850fa2845dSmrg exit $stat 1860fa2845dSmrg fi 1870fa2845dSmrg rm -f "$depfile" 1880fa2845dSmrg 1890fa2845dSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1900fa2845dSmrg echo "$object : \\" > "$depfile" 1910fa2845dSmrg 1920fa2845dSmrg # Clip off the initial element (the dependent). Don't try to be 1930fa2845dSmrg # clever and replace this with sed code, as IRIX sed won't handle 1940fa2845dSmrg # lines with more than a fixed number of characters (4096 in 1950fa2845dSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1960fa2845dSmrg # the IRIX cc adds comments like `#:fec' to the end of the 1970fa2845dSmrg # dependency line. 1980fa2845dSmrg tr ' ' ' 1990fa2845dSmrg' < "$tmpdepfile" \ 2000fa2845dSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 2010fa2845dSmrg tr ' 2027888fd0eSmrg' ' ' >> "$depfile" 2037888fd0eSmrg echo >> "$depfile" 2040fa2845dSmrg 2050fa2845dSmrg # The second pass generates a dummy entry for each header file. 2060fa2845dSmrg tr ' ' ' 2070fa2845dSmrg' < "$tmpdepfile" \ 2080fa2845dSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2097888fd0eSmrg >> "$depfile" 2100fa2845dSmrg else 2110fa2845dSmrg # The sourcefile does not contain any dependencies, so just 2120fa2845dSmrg # store a dummy comment line, to avoid errors with the Makefile 2130fa2845dSmrg # "include basename.Plo" scheme. 2140fa2845dSmrg echo "#dummy" > "$depfile" 2150fa2845dSmrg fi 2160fa2845dSmrg rm -f "$tmpdepfile" 2170fa2845dSmrg ;; 2180fa2845dSmrg 2190fa2845dSmrgaix) 2200fa2845dSmrg # The C for AIX Compiler uses -M and outputs the dependencies 2210fa2845dSmrg # in a .u file. In older versions, this file always lives in the 2220fa2845dSmrg # current directory. Also, the AIX compiler puts `$object:' at the 2230fa2845dSmrg # start of each line; $object doesn't have directory information. 2240fa2845dSmrg # Version 6 uses the directory in both cases. 2257888fd0eSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2267888fd0eSmrg test "x$dir" = "x$object" && dir= 2277888fd0eSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 2280fa2845dSmrg if test "$libtool" = yes; then 2297888fd0eSmrg tmpdepfile1=$dir$base.u 2307888fd0eSmrg tmpdepfile2=$base.u 2317888fd0eSmrg tmpdepfile3=$dir.libs/$base.u 2320fa2845dSmrg "$@" -Wc,-M 2330fa2845dSmrg else 2347888fd0eSmrg tmpdepfile1=$dir$base.u 2357888fd0eSmrg tmpdepfile2=$dir$base.u 2367888fd0eSmrg tmpdepfile3=$dir$base.u 2370fa2845dSmrg "$@" -M 2380fa2845dSmrg fi 2390fa2845dSmrg stat=$? 2400fa2845dSmrg 2410fa2845dSmrg if test $stat -eq 0; then : 2420fa2845dSmrg else 2437888fd0eSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2440fa2845dSmrg exit $stat 2450fa2845dSmrg fi 2460fa2845dSmrg 2477888fd0eSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2487888fd0eSmrg do 2497888fd0eSmrg test -f "$tmpdepfile" && break 2507888fd0eSmrg done 2510fa2845dSmrg if test -f "$tmpdepfile"; then 2520fa2845dSmrg # Each line is of the form `foo.o: dependent.h'. 2530fa2845dSmrg # Do two passes, one to just change these to 2540fa2845dSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2557888fd0eSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2567888fd0eSmrg # That's a tab and a space in the []. 2577888fd0eSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 2580fa2845dSmrg else 2590fa2845dSmrg # The sourcefile does not contain any dependencies, so just 2600fa2845dSmrg # store a dummy comment line, to avoid errors with the Makefile 2610fa2845dSmrg # "include basename.Plo" scheme. 2620fa2845dSmrg echo "#dummy" > "$depfile" 2630fa2845dSmrg fi 2640fa2845dSmrg rm -f "$tmpdepfile" 2650fa2845dSmrg ;; 2660fa2845dSmrg 2670fa2845dSmrgicc) 2680fa2845dSmrg # Intel's C compiler understands `-MD -MF file'. However on 2690fa2845dSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 2700fa2845dSmrg # ICC 7.0 will fill foo.d with something like 2710fa2845dSmrg # foo.o: sub/foo.c 2720fa2845dSmrg # foo.o: sub/foo.h 2730fa2845dSmrg # which is wrong. We want: 2740fa2845dSmrg # sub/foo.o: sub/foo.c 2750fa2845dSmrg # sub/foo.o: sub/foo.h 2760fa2845dSmrg # sub/foo.c: 2770fa2845dSmrg # sub/foo.h: 2780fa2845dSmrg # ICC 7.1 will output 2790fa2845dSmrg # foo.o: sub/foo.c sub/foo.h 2800fa2845dSmrg # and will wrap long lines using \ : 2810fa2845dSmrg # foo.o: sub/foo.c ... \ 2820fa2845dSmrg # sub/foo.h ... \ 2830fa2845dSmrg # ... 2840fa2845dSmrg 2850fa2845dSmrg "$@" -MD -MF "$tmpdepfile" 2860fa2845dSmrg stat=$? 2870fa2845dSmrg if test $stat -eq 0; then : 2880fa2845dSmrg else 2890fa2845dSmrg rm -f "$tmpdepfile" 2900fa2845dSmrg exit $stat 2910fa2845dSmrg fi 2920fa2845dSmrg rm -f "$depfile" 2930fa2845dSmrg # Each line is of the form `foo.o: dependent.h', 2940fa2845dSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 2950fa2845dSmrg # Do two passes, one to just change these to 2960fa2845dSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2970fa2845dSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 2980fa2845dSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 2990fa2845dSmrg # correctly. Breaking it into two sed invocations is a workaround. 3000fa2845dSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 3010fa2845dSmrg sed -e 's/$/ :/' >> "$depfile" 3020fa2845dSmrg rm -f "$tmpdepfile" 3030fa2845dSmrg ;; 3040fa2845dSmrg 3050fa2845dSmrghp2) 3060fa2845dSmrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3070fa2845dSmrg # compilers, which have integrated preprocessors. The correct option 3080fa2845dSmrg # to use with these is +Maked; it writes dependencies to a file named 3090fa2845dSmrg # 'foo.d', which lands next to the object file, wherever that 3100fa2845dSmrg # happens to be. 3110fa2845dSmrg # Much of this is similar to the tru64 case; see comments there. 3120fa2845dSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3130fa2845dSmrg test "x$dir" = "x$object" && dir= 3140fa2845dSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3150fa2845dSmrg if test "$libtool" = yes; then 3160fa2845dSmrg tmpdepfile1=$dir$base.d 3170fa2845dSmrg tmpdepfile2=$dir.libs/$base.d 3180fa2845dSmrg "$@" -Wc,+Maked 3190fa2845dSmrg else 3200fa2845dSmrg tmpdepfile1=$dir$base.d 3210fa2845dSmrg tmpdepfile2=$dir$base.d 3220fa2845dSmrg "$@" +Maked 3230fa2845dSmrg fi 3240fa2845dSmrg stat=$? 3250fa2845dSmrg if test $stat -eq 0; then : 3260fa2845dSmrg else 3270fa2845dSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3280fa2845dSmrg exit $stat 3290fa2845dSmrg fi 3300fa2845dSmrg 3310fa2845dSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3320fa2845dSmrg do 3330fa2845dSmrg test -f "$tmpdepfile" && break 3340fa2845dSmrg done 3350fa2845dSmrg if test -f "$tmpdepfile"; then 3360fa2845dSmrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3370fa2845dSmrg # Add `dependent.h:' lines. 3387888fd0eSmrg sed -ne '2,${ 3397888fd0eSmrg s/^ *// 3407888fd0eSmrg s/ \\*$// 3417888fd0eSmrg s/$/:/ 3427888fd0eSmrg p 3437888fd0eSmrg }' "$tmpdepfile" >> "$depfile" 3440fa2845dSmrg else 3450fa2845dSmrg echo "#dummy" > "$depfile" 3460fa2845dSmrg fi 3470fa2845dSmrg rm -f "$tmpdepfile" "$tmpdepfile2" 3480fa2845dSmrg ;; 3490fa2845dSmrg 3500fa2845dSmrgtru64) 3510fa2845dSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 3520fa2845dSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 3530fa2845dSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 3540fa2845dSmrg # dependencies in `foo.d' instead, so we check for that too. 3550fa2845dSmrg # Subdirectories are respected. 3560fa2845dSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3570fa2845dSmrg test "x$dir" = "x$object" && dir= 3580fa2845dSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3590fa2845dSmrg 3600fa2845dSmrg if test "$libtool" = yes; then 3610fa2845dSmrg # With Tru64 cc, shared objects can also be used to make a 3620fa2845dSmrg # static library. This mechanism is used in libtool 1.4 series to 3630fa2845dSmrg # handle both shared and static libraries in a single compilation. 3640fa2845dSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 3650fa2845dSmrg # 3660fa2845dSmrg # With libtool 1.5 this exception was removed, and libtool now 3670fa2845dSmrg # generates 2 separate objects for the 2 libraries. These two 3680fa2845dSmrg # compilations output dependencies in $dir.libs/$base.o.d and 3690fa2845dSmrg # in $dir$base.o.d. We have to check for both files, because 3700fa2845dSmrg # one of the two compilations can be disabled. We should prefer 3710fa2845dSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 3720fa2845dSmrg # automatically cleaned when .libs/ is deleted, while ignoring 3730fa2845dSmrg # the former would cause a distcleancheck panic. 3740fa2845dSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 3750fa2845dSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 3760fa2845dSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 3770fa2845dSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 3780fa2845dSmrg "$@" -Wc,-MD 3790fa2845dSmrg else 3800fa2845dSmrg tmpdepfile1=$dir$base.o.d 3810fa2845dSmrg tmpdepfile2=$dir$base.d 3820fa2845dSmrg tmpdepfile3=$dir$base.d 3830fa2845dSmrg tmpdepfile4=$dir$base.d 3840fa2845dSmrg "$@" -MD 3850fa2845dSmrg fi 3860fa2845dSmrg 3870fa2845dSmrg stat=$? 3880fa2845dSmrg if test $stat -eq 0; then : 3890fa2845dSmrg else 3900fa2845dSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3910fa2845dSmrg exit $stat 3920fa2845dSmrg fi 3930fa2845dSmrg 3940fa2845dSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3950fa2845dSmrg do 3960fa2845dSmrg test -f "$tmpdepfile" && break 3970fa2845dSmrg done 3980fa2845dSmrg if test -f "$tmpdepfile"; then 3990fa2845dSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 4000fa2845dSmrg # That's a tab and a space in the []. 4010fa2845dSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 4020fa2845dSmrg else 4030fa2845dSmrg echo "#dummy" > "$depfile" 4040fa2845dSmrg fi 4050fa2845dSmrg rm -f "$tmpdepfile" 4060fa2845dSmrg ;; 4070fa2845dSmrg 4080fa2845dSmrg#nosideeffect) 4090fa2845dSmrg # This comment above is used by automake to tell side-effect 4100fa2845dSmrg # dependency tracking mechanisms from slower ones. 4110fa2845dSmrg 4120fa2845dSmrgdashmstdout) 4130fa2845dSmrg # Important note: in order to support this mode, a compiler *must* 4140fa2845dSmrg # always write the preprocessed file to stdout, regardless of -o. 4150fa2845dSmrg "$@" || exit $? 4160fa2845dSmrg 4170fa2845dSmrg # Remove the call to Libtool. 4180fa2845dSmrg if test "$libtool" = yes; then 4197888fd0eSmrg while test "X$1" != 'X--mode=compile'; do 4200fa2845dSmrg shift 4210fa2845dSmrg done 4220fa2845dSmrg shift 4230fa2845dSmrg fi 4240fa2845dSmrg 4250fa2845dSmrg # Remove `-o $object'. 4260fa2845dSmrg IFS=" " 4270fa2845dSmrg for arg 4280fa2845dSmrg do 4290fa2845dSmrg case $arg in 4300fa2845dSmrg -o) 4310fa2845dSmrg shift 4320fa2845dSmrg ;; 4330fa2845dSmrg $object) 4340fa2845dSmrg shift 4350fa2845dSmrg ;; 4360fa2845dSmrg *) 4370fa2845dSmrg set fnord "$@" "$arg" 4380fa2845dSmrg shift # fnord 4390fa2845dSmrg shift # $arg 4400fa2845dSmrg ;; 4410fa2845dSmrg esac 4420fa2845dSmrg done 4430fa2845dSmrg 4440fa2845dSmrg test -z "$dashmflag" && dashmflag=-M 4450fa2845dSmrg # Require at least two characters before searching for `:' 4460fa2845dSmrg # in the target name. This is to cope with DOS-style filenames: 4470fa2845dSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 4480fa2845dSmrg "$@" $dashmflag | 4490fa2845dSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 4500fa2845dSmrg rm -f "$depfile" 4510fa2845dSmrg cat < "$tmpdepfile" > "$depfile" 4520fa2845dSmrg tr ' ' ' 4530fa2845dSmrg' < "$tmpdepfile" | \ 4540fa2845dSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 4550fa2845dSmrg## correctly. Breaking it into two sed invocations is a workaround. 4560fa2845dSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 4570fa2845dSmrg rm -f "$tmpdepfile" 4580fa2845dSmrg ;; 4590fa2845dSmrg 4600fa2845dSmrgdashXmstdout) 4610fa2845dSmrg # This case only exists to satisfy depend.m4. It is never actually 4620fa2845dSmrg # run, as this mode is specially recognized in the preamble. 4630fa2845dSmrg exit 1 4640fa2845dSmrg ;; 4650fa2845dSmrg 4660fa2845dSmrgmakedepend) 4670fa2845dSmrg "$@" || exit $? 4680fa2845dSmrg # Remove any Libtool call 4690fa2845dSmrg if test "$libtool" = yes; then 4707888fd0eSmrg while test "X$1" != 'X--mode=compile'; do 4710fa2845dSmrg shift 4720fa2845dSmrg done 4730fa2845dSmrg shift 4740fa2845dSmrg fi 4750fa2845dSmrg # X makedepend 4760fa2845dSmrg shift 4777888fd0eSmrg cleared=no eat=no 4787888fd0eSmrg for arg 4797888fd0eSmrg do 4800fa2845dSmrg case $cleared in 4810fa2845dSmrg no) 4820fa2845dSmrg set ""; shift 4830fa2845dSmrg cleared=yes ;; 4840fa2845dSmrg esac 4857888fd0eSmrg if test $eat = yes; then 4867888fd0eSmrg eat=no 4877888fd0eSmrg continue 4887888fd0eSmrg fi 4890fa2845dSmrg case "$arg" in 4900fa2845dSmrg -D*|-I*) 4910fa2845dSmrg set fnord "$@" "$arg"; shift ;; 4920fa2845dSmrg # Strip any option that makedepend may not understand. Remove 4930fa2845dSmrg # the object too, otherwise makedepend will parse it as a source file. 4947888fd0eSmrg -arch) 4957888fd0eSmrg eat=yes ;; 4960fa2845dSmrg -*|$object) 4970fa2845dSmrg ;; 4980fa2845dSmrg *) 4990fa2845dSmrg set fnord "$@" "$arg"; shift ;; 5000fa2845dSmrg esac 5010fa2845dSmrg done 5027888fd0eSmrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 5030fa2845dSmrg touch "$tmpdepfile" 5040fa2845dSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 5050fa2845dSmrg rm -f "$depfile" 5060fa2845dSmrg cat < "$tmpdepfile" > "$depfile" 5070fa2845dSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 5080fa2845dSmrg' | \ 5090fa2845dSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 5100fa2845dSmrg## correctly. Breaking it into two sed invocations is a workaround. 5110fa2845dSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 5120fa2845dSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 5130fa2845dSmrg ;; 5140fa2845dSmrg 5150fa2845dSmrgcpp) 5160fa2845dSmrg # Important note: in order to support this mode, a compiler *must* 5170fa2845dSmrg # always write the preprocessed file to stdout. 5180fa2845dSmrg "$@" || exit $? 5190fa2845dSmrg 5200fa2845dSmrg # Remove the call to Libtool. 5210fa2845dSmrg if test "$libtool" = yes; then 5227888fd0eSmrg while test "X$1" != 'X--mode=compile'; do 5230fa2845dSmrg shift 5240fa2845dSmrg done 5250fa2845dSmrg shift 5260fa2845dSmrg fi 5270fa2845dSmrg 5280fa2845dSmrg # Remove `-o $object'. 5290fa2845dSmrg IFS=" " 5300fa2845dSmrg for arg 5310fa2845dSmrg do 5320fa2845dSmrg case $arg in 5330fa2845dSmrg -o) 5340fa2845dSmrg shift 5350fa2845dSmrg ;; 5360fa2845dSmrg $object) 5370fa2845dSmrg shift 5380fa2845dSmrg ;; 5390fa2845dSmrg *) 5400fa2845dSmrg set fnord "$@" "$arg" 5410fa2845dSmrg shift # fnord 5420fa2845dSmrg shift # $arg 5430fa2845dSmrg ;; 5440fa2845dSmrg esac 5450fa2845dSmrg done 5460fa2845dSmrg 5470fa2845dSmrg "$@" -E | 5480fa2845dSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 5490fa2845dSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 5500fa2845dSmrg sed '$ s: \\$::' > "$tmpdepfile" 5510fa2845dSmrg rm -f "$depfile" 5520fa2845dSmrg echo "$object : \\" > "$depfile" 5530fa2845dSmrg cat < "$tmpdepfile" >> "$depfile" 5540fa2845dSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 5550fa2845dSmrg rm -f "$tmpdepfile" 5560fa2845dSmrg ;; 5570fa2845dSmrg 5580fa2845dSmrgmsvisualcpp) 5590fa2845dSmrg # Important note: in order to support this mode, a compiler *must* 5607888fd0eSmrg # always write the preprocessed file to stdout. 5610fa2845dSmrg "$@" || exit $? 5627888fd0eSmrg 5637888fd0eSmrg # Remove the call to Libtool. 5647888fd0eSmrg if test "$libtool" = yes; then 5657888fd0eSmrg while test "X$1" != 'X--mode=compile'; do 5667888fd0eSmrg shift 5677888fd0eSmrg done 5687888fd0eSmrg shift 5697888fd0eSmrg fi 5707888fd0eSmrg 5710fa2845dSmrg IFS=" " 5720fa2845dSmrg for arg 5730fa2845dSmrg do 5740fa2845dSmrg case "$arg" in 5757888fd0eSmrg -o) 5767888fd0eSmrg shift 5777888fd0eSmrg ;; 5787888fd0eSmrg $object) 5797888fd0eSmrg shift 5807888fd0eSmrg ;; 5810fa2845dSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 5820fa2845dSmrg set fnord "$@" 5830fa2845dSmrg shift 5840fa2845dSmrg shift 5850fa2845dSmrg ;; 5860fa2845dSmrg *) 5870fa2845dSmrg set fnord "$@" "$arg" 5880fa2845dSmrg shift 5890fa2845dSmrg shift 5900fa2845dSmrg ;; 5910fa2845dSmrg esac 5920fa2845dSmrg done 5937888fd0eSmrg "$@" -E 2>/dev/null | 5947888fd0eSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 5950fa2845dSmrg rm -f "$depfile" 5960fa2845dSmrg echo "$object : \\" > "$depfile" 5977888fd0eSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 5980fa2845dSmrg echo " " >> "$depfile" 5997888fd0eSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 6000fa2845dSmrg rm -f "$tmpdepfile" 6010fa2845dSmrg ;; 6020fa2845dSmrg 6037888fd0eSmrgmsvcmsys) 6047888fd0eSmrg # This case exists only to let depend.m4 do its work. It works by 6057888fd0eSmrg # looking at the text of this script. This case will never be run, 6067888fd0eSmrg # since it is checked for above. 6077888fd0eSmrg exit 1 6087888fd0eSmrg ;; 6097888fd0eSmrg 6100fa2845dSmrgnone) 6110fa2845dSmrg exec "$@" 6120fa2845dSmrg ;; 6130fa2845dSmrg 6140fa2845dSmrg*) 6150fa2845dSmrg echo "Unknown depmode $depmode" 1>&2 6160fa2845dSmrg exit 1 6170fa2845dSmrg ;; 6180fa2845dSmrgesac 6190fa2845dSmrg 6200fa2845dSmrgexit 0 6210fa2845dSmrg 6220fa2845dSmrg# Local Variables: 6230fa2845dSmrg# mode: shell-script 6240fa2845dSmrg# sh-indentation: 2 6250fa2845dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 6260fa2845dSmrg# time-stamp-start: "scriptversion=" 6270fa2845dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6287888fd0eSmrg# time-stamp-time-zone: "UTC" 6297888fd0eSmrg# time-stamp-end: "; # UTC" 6300fa2845dSmrg# End: 631