depcomp revision 2a51b5be
132b578d3Smrg#! /bin/sh 232b578d3Smrg# depcomp - compile a program generating dependencies as side-effects 332b578d3Smrg 42a51b5beSmrgscriptversion=2009-04-28.21; # UTC 532b578d3Smrg 62a51b5beSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 72a51b5beSmrg# Software Foundation, Inc. 832b578d3Smrg 932b578d3Smrg# This program is free software; you can redistribute it and/or modify 1032b578d3Smrg# it under the terms of the GNU General Public License as published by 1132b578d3Smrg# the Free Software Foundation; either version 2, or (at your option) 1232b578d3Smrg# any later version. 1332b578d3Smrg 1432b578d3Smrg# This program is distributed in the hope that it will be useful, 1532b578d3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1632b578d3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1732b578d3Smrg# GNU General Public License for more details. 1832b578d3Smrg 1932b578d3Smrg# You should have received a copy of the GNU General Public License 202a51b5beSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2132b578d3Smrg 2232b578d3Smrg# As a special exception to the GNU General Public License, if you 2332b578d3Smrg# distribute this file as part of a program that contains a 2432b578d3Smrg# configuration script generated by Autoconf, you may include it under 2532b578d3Smrg# the same distribution terms that you use for the rest of that program. 2632b578d3Smrg 2732b578d3Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 2832b578d3Smrg 2932b578d3Smrgcase $1 in 3032b578d3Smrg '') 3132b578d3Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 3232b578d3Smrg exit 1; 3332b578d3Smrg ;; 3432b578d3Smrg -h | --h*) 3532b578d3Smrg cat <<\EOF 3632b578d3SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 3732b578d3Smrg 3832b578d3SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 3932b578d3Smrgas side-effects. 4032b578d3Smrg 4132b578d3SmrgEnvironment variables: 4232b578d3Smrg depmode Dependency tracking mode. 4332b578d3Smrg source Source file read by `PROGRAMS ARGS'. 4432b578d3Smrg object Object file output by `PROGRAMS ARGS'. 4532b578d3Smrg DEPDIR directory where to store dependencies. 4632b578d3Smrg depfile Dependency file to output. 4732b578d3Smrg tmpdepfile Temporary file to use when outputing dependencies. 4832b578d3Smrg libtool Whether libtool is used (yes/no). 4932b578d3Smrg 5032b578d3SmrgReport bugs to <bug-automake@gnu.org>. 5132b578d3SmrgEOF 5232b578d3Smrg exit $? 5332b578d3Smrg ;; 5432b578d3Smrg -v | --v*) 5532b578d3Smrg echo "depcomp $scriptversion" 5632b578d3Smrg exit $? 5732b578d3Smrg ;; 5832b578d3Smrgesac 5932b578d3Smrg 6032b578d3Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 6132b578d3Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 6232b578d3Smrg exit 1 6332b578d3Smrgfi 6432b578d3Smrg 6532b578d3Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 6632b578d3Smrgdepfile=${depfile-`echo "$object" | 6732b578d3Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 6832b578d3Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 6932b578d3Smrg 7032b578d3Smrgrm -f "$tmpdepfile" 7132b578d3Smrg 7232b578d3Smrg# Some modes work just like other modes, but use different flags. We 7332b578d3Smrg# parameterize here, but still list the modes in the big case below, 7432b578d3Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 7532b578d3Smrg# here, because this file can only contain one case statement. 7632b578d3Smrgif test "$depmode" = hp; then 7732b578d3Smrg # HP compiler uses -M and no extra arg. 7832b578d3Smrg gccflag=-M 7932b578d3Smrg depmode=gcc 8032b578d3Smrgfi 8132b578d3Smrg 8232b578d3Smrgif test "$depmode" = dashXmstdout; then 8332b578d3Smrg # This is just like dashmstdout with a different argument. 8432b578d3Smrg dashmflag=-xM 8532b578d3Smrg depmode=dashmstdout 8632b578d3Smrgfi 8732b578d3Smrg 882a51b5beSmrgcygpath_u="cygpath -u -f -" 892a51b5beSmrgif test "$depmode" = msvcmsys; then 902a51b5beSmrg # This is just like msvisualcpp but w/o cygpath translation. 912a51b5beSmrg # Just convert the backslash-escaped backslashes to single forward 922a51b5beSmrg # slashes to satisfy depend.m4 932a51b5beSmrg cygpath_u="sed s,\\\\\\\\,/,g" 942a51b5beSmrg depmode=msvisualcpp 952a51b5beSmrgfi 962a51b5beSmrg 9732b578d3Smrgcase "$depmode" in 9832b578d3Smrggcc3) 9932b578d3Smrg## gcc 3 implements dependency tracking that does exactly what 10032b578d3Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 10132b578d3Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 10232b578d3Smrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 10332b578d3Smrg## the command line argument order; so add the flags where they 10432b578d3Smrg## appear in depend2.am. Note that the slowdown incurred here 10532b578d3Smrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 10632b578d3Smrg for arg 10732b578d3Smrg do 10832b578d3Smrg case $arg in 10932b578d3Smrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 11032b578d3Smrg *) set fnord "$@" "$arg" ;; 11132b578d3Smrg esac 11232b578d3Smrg shift # fnord 11332b578d3Smrg shift # $arg 11432b578d3Smrg done 11532b578d3Smrg "$@" 11632b578d3Smrg stat=$? 11732b578d3Smrg if test $stat -eq 0; then : 11832b578d3Smrg else 11932b578d3Smrg rm -f "$tmpdepfile" 12032b578d3Smrg exit $stat 12132b578d3Smrg fi 12232b578d3Smrg mv "$tmpdepfile" "$depfile" 12332b578d3Smrg ;; 12432b578d3Smrg 12532b578d3Smrggcc) 12632b578d3Smrg## There are various ways to get dependency output from gcc. Here's 12732b578d3Smrg## why we pick this rather obscure method: 12832b578d3Smrg## - Don't want to use -MD because we'd like the dependencies to end 12932b578d3Smrg## up in a subdir. Having to rename by hand is ugly. 13032b578d3Smrg## (We might end up doing this anyway to support other compilers.) 13132b578d3Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 13232b578d3Smrg## -MM, not -M (despite what the docs say). 13332b578d3Smrg## - Using -M directly means running the compiler twice (even worse 13432b578d3Smrg## than renaming). 13532b578d3Smrg if test -z "$gccflag"; then 13632b578d3Smrg gccflag=-MD, 13732b578d3Smrg fi 13832b578d3Smrg "$@" -Wp,"$gccflag$tmpdepfile" 13932b578d3Smrg stat=$? 14032b578d3Smrg if test $stat -eq 0; then : 14132b578d3Smrg else 14232b578d3Smrg rm -f "$tmpdepfile" 14332b578d3Smrg exit $stat 14432b578d3Smrg fi 14532b578d3Smrg rm -f "$depfile" 14632b578d3Smrg echo "$object : \\" > "$depfile" 14732b578d3Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 14832b578d3Smrg## The second -e expression handles DOS-style file names with drive letters. 14932b578d3Smrg sed -e 's/^[^:]*: / /' \ 15032b578d3Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 15132b578d3Smrg## This next piece of magic avoids the `deleted header file' problem. 15232b578d3Smrg## The problem is that when a header file which appears in a .P file 15332b578d3Smrg## is deleted, the dependency causes make to die (because there is 15432b578d3Smrg## typically no way to rebuild the header). We avoid this by adding 15532b578d3Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 15632b578d3Smrg## this for us directly. 15732b578d3Smrg tr ' ' ' 15832b578d3Smrg' < "$tmpdepfile" | 15932b578d3Smrg## Some versions of gcc put a space before the `:'. On the theory 16032b578d3Smrg## that the space means something, we add a space to the output as 16132b578d3Smrg## well. 16232b578d3Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 16332b578d3Smrg## correctly. Breaking it into two sed invocations is a workaround. 16432b578d3Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 16532b578d3Smrg rm -f "$tmpdepfile" 16632b578d3Smrg ;; 16732b578d3Smrg 16832b578d3Smrghp) 16932b578d3Smrg # This case exists only to let depend.m4 do its work. It works by 17032b578d3Smrg # looking at the text of this script. This case will never be run, 17132b578d3Smrg # since it is checked for above. 17232b578d3Smrg exit 1 17332b578d3Smrg ;; 17432b578d3Smrg 17532b578d3Smrgsgi) 17632b578d3Smrg if test "$libtool" = yes; then 17732b578d3Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 17832b578d3Smrg else 17932b578d3Smrg "$@" -MDupdate "$tmpdepfile" 18032b578d3Smrg fi 18132b578d3Smrg stat=$? 18232b578d3Smrg if test $stat -eq 0; then : 18332b578d3Smrg else 18432b578d3Smrg rm -f "$tmpdepfile" 18532b578d3Smrg exit $stat 18632b578d3Smrg fi 18732b578d3Smrg rm -f "$depfile" 18832b578d3Smrg 18932b578d3Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 19032b578d3Smrg echo "$object : \\" > "$depfile" 19132b578d3Smrg 19232b578d3Smrg # Clip off the initial element (the dependent). Don't try to be 19332b578d3Smrg # clever and replace this with sed code, as IRIX sed won't handle 19432b578d3Smrg # lines with more than a fixed number of characters (4096 in 19532b578d3Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 19632b578d3Smrg # the IRIX cc adds comments like `#:fec' to the end of the 19732b578d3Smrg # dependency line. 19832b578d3Smrg tr ' ' ' 19932b578d3Smrg' < "$tmpdepfile" \ 20032b578d3Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 20132b578d3Smrg tr ' 2022a51b5beSmrg' ' ' >> "$depfile" 2032a51b5beSmrg echo >> "$depfile" 20432b578d3Smrg 20532b578d3Smrg # The second pass generates a dummy entry for each header file. 20632b578d3Smrg tr ' ' ' 20732b578d3Smrg' < "$tmpdepfile" \ 20832b578d3Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2092a51b5beSmrg >> "$depfile" 21032b578d3Smrg else 21132b578d3Smrg # The sourcefile does not contain any dependencies, so just 21232b578d3Smrg # store a dummy comment line, to avoid errors with the Makefile 21332b578d3Smrg # "include basename.Plo" scheme. 21432b578d3Smrg echo "#dummy" > "$depfile" 21532b578d3Smrg fi 21632b578d3Smrg rm -f "$tmpdepfile" 21732b578d3Smrg ;; 21832b578d3Smrg 21932b578d3Smrgaix) 22032b578d3Smrg # The C for AIX Compiler uses -M and outputs the dependencies 22132b578d3Smrg # in a .u file. In older versions, this file always lives in the 22232b578d3Smrg # current directory. Also, the AIX compiler puts `$object:' at the 22332b578d3Smrg # start of each line; $object doesn't have directory information. 22432b578d3Smrg # Version 6 uses the directory in both cases. 2252a51b5beSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2262a51b5beSmrg test "x$dir" = "x$object" && dir= 2272a51b5beSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 22832b578d3Smrg if test "$libtool" = yes; then 2292a51b5beSmrg tmpdepfile1=$dir$base.u 2302a51b5beSmrg tmpdepfile2=$base.u 2312a51b5beSmrg tmpdepfile3=$dir.libs/$base.u 23232b578d3Smrg "$@" -Wc,-M 23332b578d3Smrg else 2342a51b5beSmrg tmpdepfile1=$dir$base.u 2352a51b5beSmrg tmpdepfile2=$dir$base.u 2362a51b5beSmrg tmpdepfile3=$dir$base.u 23732b578d3Smrg "$@" -M 23832b578d3Smrg fi 23932b578d3Smrg stat=$? 24032b578d3Smrg 24132b578d3Smrg if test $stat -eq 0; then : 24232b578d3Smrg else 2432a51b5beSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 24432b578d3Smrg exit $stat 24532b578d3Smrg fi 24632b578d3Smrg 2472a51b5beSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2482a51b5beSmrg do 2492a51b5beSmrg test -f "$tmpdepfile" && break 2502a51b5beSmrg done 25132b578d3Smrg if test -f "$tmpdepfile"; then 25232b578d3Smrg # Each line is of the form `foo.o: dependent.h'. 25332b578d3Smrg # Do two passes, one to just change these to 25432b578d3Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 2552a51b5beSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2562a51b5beSmrg # That's a tab and a space in the []. 2572a51b5beSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 25832b578d3Smrg else 25932b578d3Smrg # The sourcefile does not contain any dependencies, so just 26032b578d3Smrg # store a dummy comment line, to avoid errors with the Makefile 26132b578d3Smrg # "include basename.Plo" scheme. 26232b578d3Smrg echo "#dummy" > "$depfile" 26332b578d3Smrg fi 26432b578d3Smrg rm -f "$tmpdepfile" 26532b578d3Smrg ;; 26632b578d3Smrg 26732b578d3Smrgicc) 26832b578d3Smrg # Intel's C compiler understands `-MD -MF file'. However on 26932b578d3Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 27032b578d3Smrg # ICC 7.0 will fill foo.d with something like 27132b578d3Smrg # foo.o: sub/foo.c 27232b578d3Smrg # foo.o: sub/foo.h 27332b578d3Smrg # which is wrong. We want: 27432b578d3Smrg # sub/foo.o: sub/foo.c 27532b578d3Smrg # sub/foo.o: sub/foo.h 27632b578d3Smrg # sub/foo.c: 27732b578d3Smrg # sub/foo.h: 27832b578d3Smrg # ICC 7.1 will output 27932b578d3Smrg # foo.o: sub/foo.c sub/foo.h 28032b578d3Smrg # and will wrap long lines using \ : 28132b578d3Smrg # foo.o: sub/foo.c ... \ 28232b578d3Smrg # sub/foo.h ... \ 28332b578d3Smrg # ... 28432b578d3Smrg 28532b578d3Smrg "$@" -MD -MF "$tmpdepfile" 28632b578d3Smrg stat=$? 28732b578d3Smrg if test $stat -eq 0; then : 28832b578d3Smrg else 28932b578d3Smrg rm -f "$tmpdepfile" 29032b578d3Smrg exit $stat 29132b578d3Smrg fi 29232b578d3Smrg rm -f "$depfile" 29332b578d3Smrg # Each line is of the form `foo.o: dependent.h', 29432b578d3Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 29532b578d3Smrg # Do two passes, one to just change these to 29632b578d3Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 29732b578d3Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 29832b578d3Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 29932b578d3Smrg # correctly. Breaking it into two sed invocations is a workaround. 30032b578d3Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 30132b578d3Smrg sed -e 's/$/ :/' >> "$depfile" 30232b578d3Smrg rm -f "$tmpdepfile" 30332b578d3Smrg ;; 30432b578d3Smrg 30532b578d3Smrghp2) 30632b578d3Smrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 30732b578d3Smrg # compilers, which have integrated preprocessors. The correct option 30832b578d3Smrg # to use with these is +Maked; it writes dependencies to a file named 30932b578d3Smrg # 'foo.d', which lands next to the object file, wherever that 31032b578d3Smrg # happens to be. 31132b578d3Smrg # Much of this is similar to the tru64 case; see comments there. 31232b578d3Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 31332b578d3Smrg test "x$dir" = "x$object" && dir= 31432b578d3Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 31532b578d3Smrg if test "$libtool" = yes; then 31632b578d3Smrg tmpdepfile1=$dir$base.d 31732b578d3Smrg tmpdepfile2=$dir.libs/$base.d 31832b578d3Smrg "$@" -Wc,+Maked 31932b578d3Smrg else 32032b578d3Smrg tmpdepfile1=$dir$base.d 32132b578d3Smrg tmpdepfile2=$dir$base.d 32232b578d3Smrg "$@" +Maked 32332b578d3Smrg fi 32432b578d3Smrg stat=$? 32532b578d3Smrg if test $stat -eq 0; then : 32632b578d3Smrg else 32732b578d3Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 32832b578d3Smrg exit $stat 32932b578d3Smrg fi 33032b578d3Smrg 33132b578d3Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 33232b578d3Smrg do 33332b578d3Smrg test -f "$tmpdepfile" && break 33432b578d3Smrg done 33532b578d3Smrg if test -f "$tmpdepfile"; then 33632b578d3Smrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 33732b578d3Smrg # Add `dependent.h:' lines. 3382a51b5beSmrg sed -ne '2,${ 3392a51b5beSmrg s/^ *// 3402a51b5beSmrg s/ \\*$// 3412a51b5beSmrg s/$/:/ 3422a51b5beSmrg p 3432a51b5beSmrg }' "$tmpdepfile" >> "$depfile" 34432b578d3Smrg else 34532b578d3Smrg echo "#dummy" > "$depfile" 34632b578d3Smrg fi 34732b578d3Smrg rm -f "$tmpdepfile" "$tmpdepfile2" 34832b578d3Smrg ;; 34932b578d3Smrg 35032b578d3Smrgtru64) 35132b578d3Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 35232b578d3Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 35332b578d3Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 35432b578d3Smrg # dependencies in `foo.d' instead, so we check for that too. 35532b578d3Smrg # Subdirectories are respected. 35632b578d3Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 35732b578d3Smrg test "x$dir" = "x$object" && dir= 35832b578d3Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 35932b578d3Smrg 36032b578d3Smrg if test "$libtool" = yes; then 36132b578d3Smrg # With Tru64 cc, shared objects can also be used to make a 36232b578d3Smrg # static library. This mechanism is used in libtool 1.4 series to 36332b578d3Smrg # handle both shared and static libraries in a single compilation. 36432b578d3Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 36532b578d3Smrg # 36632b578d3Smrg # With libtool 1.5 this exception was removed, and libtool now 36732b578d3Smrg # generates 2 separate objects for the 2 libraries. These two 36832b578d3Smrg # compilations output dependencies in $dir.libs/$base.o.d and 36932b578d3Smrg # in $dir$base.o.d. We have to check for both files, because 37032b578d3Smrg # one of the two compilations can be disabled. We should prefer 37132b578d3Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 37232b578d3Smrg # automatically cleaned when .libs/ is deleted, while ignoring 37332b578d3Smrg # the former would cause a distcleancheck panic. 37432b578d3Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 37532b578d3Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 37632b578d3Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 37732b578d3Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 37832b578d3Smrg "$@" -Wc,-MD 37932b578d3Smrg else 38032b578d3Smrg tmpdepfile1=$dir$base.o.d 38132b578d3Smrg tmpdepfile2=$dir$base.d 38232b578d3Smrg tmpdepfile3=$dir$base.d 38332b578d3Smrg tmpdepfile4=$dir$base.d 38432b578d3Smrg "$@" -MD 38532b578d3Smrg fi 38632b578d3Smrg 38732b578d3Smrg stat=$? 38832b578d3Smrg if test $stat -eq 0; then : 38932b578d3Smrg else 39032b578d3Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 39132b578d3Smrg exit $stat 39232b578d3Smrg fi 39332b578d3Smrg 39432b578d3Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 39532b578d3Smrg do 39632b578d3Smrg test -f "$tmpdepfile" && break 39732b578d3Smrg done 39832b578d3Smrg if test -f "$tmpdepfile"; then 39932b578d3Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 40032b578d3Smrg # That's a tab and a space in the []. 40132b578d3Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 40232b578d3Smrg else 40332b578d3Smrg echo "#dummy" > "$depfile" 40432b578d3Smrg fi 40532b578d3Smrg rm -f "$tmpdepfile" 40632b578d3Smrg ;; 40732b578d3Smrg 40832b578d3Smrg#nosideeffect) 40932b578d3Smrg # This comment above is used by automake to tell side-effect 41032b578d3Smrg # dependency tracking mechanisms from slower ones. 41132b578d3Smrg 41232b578d3Smrgdashmstdout) 41332b578d3Smrg # Important note: in order to support this mode, a compiler *must* 41432b578d3Smrg # always write the preprocessed file to stdout, regardless of -o. 41532b578d3Smrg "$@" || exit $? 41632b578d3Smrg 41732b578d3Smrg # Remove the call to Libtool. 41832b578d3Smrg if test "$libtool" = yes; then 4192a51b5beSmrg while test "X$1" != 'X--mode=compile'; do 42032b578d3Smrg shift 42132b578d3Smrg done 42232b578d3Smrg shift 42332b578d3Smrg fi 42432b578d3Smrg 42532b578d3Smrg # Remove `-o $object'. 42632b578d3Smrg IFS=" " 42732b578d3Smrg for arg 42832b578d3Smrg do 42932b578d3Smrg case $arg in 43032b578d3Smrg -o) 43132b578d3Smrg shift 43232b578d3Smrg ;; 43332b578d3Smrg $object) 43432b578d3Smrg shift 43532b578d3Smrg ;; 43632b578d3Smrg *) 43732b578d3Smrg set fnord "$@" "$arg" 43832b578d3Smrg shift # fnord 43932b578d3Smrg shift # $arg 44032b578d3Smrg ;; 44132b578d3Smrg esac 44232b578d3Smrg done 44332b578d3Smrg 44432b578d3Smrg test -z "$dashmflag" && dashmflag=-M 44532b578d3Smrg # Require at least two characters before searching for `:' 44632b578d3Smrg # in the target name. This is to cope with DOS-style filenames: 44732b578d3Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 44832b578d3Smrg "$@" $dashmflag | 44932b578d3Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 45032b578d3Smrg rm -f "$depfile" 45132b578d3Smrg cat < "$tmpdepfile" > "$depfile" 45232b578d3Smrg tr ' ' ' 45332b578d3Smrg' < "$tmpdepfile" | \ 45432b578d3Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 45532b578d3Smrg## correctly. Breaking it into two sed invocations is a workaround. 45632b578d3Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 45732b578d3Smrg rm -f "$tmpdepfile" 45832b578d3Smrg ;; 45932b578d3Smrg 46032b578d3SmrgdashXmstdout) 46132b578d3Smrg # This case only exists to satisfy depend.m4. It is never actually 46232b578d3Smrg # run, as this mode is specially recognized in the preamble. 46332b578d3Smrg exit 1 46432b578d3Smrg ;; 46532b578d3Smrg 46632b578d3Smrgmakedepend) 46732b578d3Smrg "$@" || exit $? 46832b578d3Smrg # Remove any Libtool call 46932b578d3Smrg if test "$libtool" = yes; then 4702a51b5beSmrg while test "X$1" != 'X--mode=compile'; do 47132b578d3Smrg shift 47232b578d3Smrg done 47332b578d3Smrg shift 47432b578d3Smrg fi 47532b578d3Smrg # X makedepend 47632b578d3Smrg shift 4772a51b5beSmrg cleared=no eat=no 4782a51b5beSmrg for arg 4792a51b5beSmrg do 48032b578d3Smrg case $cleared in 48132b578d3Smrg no) 48232b578d3Smrg set ""; shift 48332b578d3Smrg cleared=yes ;; 48432b578d3Smrg esac 4852a51b5beSmrg if test $eat = yes; then 4862a51b5beSmrg eat=no 4872a51b5beSmrg continue 4882a51b5beSmrg fi 48932b578d3Smrg case "$arg" in 49032b578d3Smrg -D*|-I*) 49132b578d3Smrg set fnord "$@" "$arg"; shift ;; 49232b578d3Smrg # Strip any option that makedepend may not understand. Remove 49332b578d3Smrg # the object too, otherwise makedepend will parse it as a source file. 4942a51b5beSmrg -arch) 4952a51b5beSmrg eat=yes ;; 49632b578d3Smrg -*|$object) 49732b578d3Smrg ;; 49832b578d3Smrg *) 49932b578d3Smrg set fnord "$@" "$arg"; shift ;; 50032b578d3Smrg esac 50132b578d3Smrg done 5022a51b5beSmrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 50332b578d3Smrg touch "$tmpdepfile" 50432b578d3Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 50532b578d3Smrg rm -f "$depfile" 50632b578d3Smrg cat < "$tmpdepfile" > "$depfile" 50732b578d3Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 50832b578d3Smrg' | \ 50932b578d3Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 51032b578d3Smrg## correctly. Breaking it into two sed invocations is a workaround. 51132b578d3Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 51232b578d3Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 51332b578d3Smrg ;; 51432b578d3Smrg 51532b578d3Smrgcpp) 51632b578d3Smrg # Important note: in order to support this mode, a compiler *must* 51732b578d3Smrg # always write the preprocessed file to stdout. 51832b578d3Smrg "$@" || exit $? 51932b578d3Smrg 52032b578d3Smrg # Remove the call to Libtool. 52132b578d3Smrg if test "$libtool" = yes; then 5222a51b5beSmrg while test "X$1" != 'X--mode=compile'; do 52332b578d3Smrg shift 52432b578d3Smrg done 52532b578d3Smrg shift 52632b578d3Smrg fi 52732b578d3Smrg 52832b578d3Smrg # Remove `-o $object'. 52932b578d3Smrg IFS=" " 53032b578d3Smrg for arg 53132b578d3Smrg do 53232b578d3Smrg case $arg in 53332b578d3Smrg -o) 53432b578d3Smrg shift 53532b578d3Smrg ;; 53632b578d3Smrg $object) 53732b578d3Smrg shift 53832b578d3Smrg ;; 53932b578d3Smrg *) 54032b578d3Smrg set fnord "$@" "$arg" 54132b578d3Smrg shift # fnord 54232b578d3Smrg shift # $arg 54332b578d3Smrg ;; 54432b578d3Smrg esac 54532b578d3Smrg done 54632b578d3Smrg 54732b578d3Smrg "$@" -E | 54832b578d3Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 54932b578d3Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 55032b578d3Smrg sed '$ s: \\$::' > "$tmpdepfile" 55132b578d3Smrg rm -f "$depfile" 55232b578d3Smrg echo "$object : \\" > "$depfile" 55332b578d3Smrg cat < "$tmpdepfile" >> "$depfile" 55432b578d3Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 55532b578d3Smrg rm -f "$tmpdepfile" 55632b578d3Smrg ;; 55732b578d3Smrg 55832b578d3Smrgmsvisualcpp) 55932b578d3Smrg # Important note: in order to support this mode, a compiler *must* 5602a51b5beSmrg # always write the preprocessed file to stdout. 56132b578d3Smrg "$@" || exit $? 5622a51b5beSmrg 5632a51b5beSmrg # Remove the call to Libtool. 5642a51b5beSmrg if test "$libtool" = yes; then 5652a51b5beSmrg while test "X$1" != 'X--mode=compile'; do 5662a51b5beSmrg shift 5672a51b5beSmrg done 5682a51b5beSmrg shift 5692a51b5beSmrg fi 5702a51b5beSmrg 57132b578d3Smrg IFS=" " 57232b578d3Smrg for arg 57332b578d3Smrg do 57432b578d3Smrg case "$arg" in 5752a51b5beSmrg -o) 5762a51b5beSmrg shift 5772a51b5beSmrg ;; 5782a51b5beSmrg $object) 5792a51b5beSmrg shift 5802a51b5beSmrg ;; 58132b578d3Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 58232b578d3Smrg set fnord "$@" 58332b578d3Smrg shift 58432b578d3Smrg shift 58532b578d3Smrg ;; 58632b578d3Smrg *) 58732b578d3Smrg set fnord "$@" "$arg" 58832b578d3Smrg shift 58932b578d3Smrg shift 59032b578d3Smrg ;; 59132b578d3Smrg esac 59232b578d3Smrg done 5932a51b5beSmrg "$@" -E 2>/dev/null | 5942a51b5beSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 59532b578d3Smrg rm -f "$depfile" 59632b578d3Smrg echo "$object : \\" > "$depfile" 5972a51b5beSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 59832b578d3Smrg echo " " >> "$depfile" 5992a51b5beSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 60032b578d3Smrg rm -f "$tmpdepfile" 60132b578d3Smrg ;; 60232b578d3Smrg 6032a51b5beSmrgmsvcmsys) 6042a51b5beSmrg # This case exists only to let depend.m4 do its work. It works by 6052a51b5beSmrg # looking at the text of this script. This case will never be run, 6062a51b5beSmrg # since it is checked for above. 6072a51b5beSmrg exit 1 6082a51b5beSmrg ;; 6092a51b5beSmrg 61032b578d3Smrgnone) 61132b578d3Smrg exec "$@" 61232b578d3Smrg ;; 61332b578d3Smrg 61432b578d3Smrg*) 61532b578d3Smrg echo "Unknown depmode $depmode" 1>&2 61632b578d3Smrg exit 1 61732b578d3Smrg ;; 61832b578d3Smrgesac 61932b578d3Smrg 62032b578d3Smrgexit 0 62132b578d3Smrg 62232b578d3Smrg# Local Variables: 62332b578d3Smrg# mode: shell-script 62432b578d3Smrg# sh-indentation: 2 62532b578d3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 62632b578d3Smrg# time-stamp-start: "scriptversion=" 62732b578d3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6282a51b5beSmrg# time-stamp-time-zone: "UTC" 6292a51b5beSmrg# time-stamp-end: "; # UTC" 63032b578d3Smrg# End: 631