depcomp revision 41c30155
123a0898aSmrg#! /bin/sh 223a0898aSmrg# depcomp - compile a program generating dependencies as side-effects 323a0898aSmrg 441c30155Smrgscriptversion=2009-04-28.21; # UTC 523a0898aSmrg 641c30155Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 741c30155Smrg# Software Foundation, Inc. 823a0898aSmrg 923a0898aSmrg# This program is free software; you can redistribute it and/or modify 1023a0898aSmrg# it under the terms of the GNU General Public License as published by 1123a0898aSmrg# the Free Software Foundation; either version 2, or (at your option) 1223a0898aSmrg# any later version. 1323a0898aSmrg 1423a0898aSmrg# This program is distributed in the hope that it will be useful, 1523a0898aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1623a0898aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1723a0898aSmrg# GNU General Public License for more details. 1823a0898aSmrg 1923a0898aSmrg# You should have received a copy of the GNU General Public License 2041c30155Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2123a0898aSmrg 2223a0898aSmrg# As a special exception to the GNU General Public License, if you 2323a0898aSmrg# distribute this file as part of a program that contains a 2423a0898aSmrg# configuration script generated by Autoconf, you may include it under 2523a0898aSmrg# the same distribution terms that you use for the rest of that program. 2623a0898aSmrg 2723a0898aSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 2823a0898aSmrg 2923a0898aSmrgcase $1 in 3023a0898aSmrg '') 3123a0898aSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 3223a0898aSmrg exit 1; 3323a0898aSmrg ;; 3423a0898aSmrg -h | --h*) 3523a0898aSmrg cat <<\EOF 3623a0898aSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 3723a0898aSmrg 3823a0898aSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 3923a0898aSmrgas side-effects. 4023a0898aSmrg 4123a0898aSmrgEnvironment variables: 4223a0898aSmrg depmode Dependency tracking mode. 4323a0898aSmrg source Source file read by `PROGRAMS ARGS'. 4423a0898aSmrg object Object file output by `PROGRAMS ARGS'. 4523a0898aSmrg DEPDIR directory where to store dependencies. 4623a0898aSmrg depfile Dependency file to output. 4723a0898aSmrg tmpdepfile Temporary file to use when outputing dependencies. 4823a0898aSmrg libtool Whether libtool is used (yes/no). 4923a0898aSmrg 5023a0898aSmrgReport bugs to <bug-automake@gnu.org>. 5123a0898aSmrgEOF 5223a0898aSmrg exit $? 5323a0898aSmrg ;; 5423a0898aSmrg -v | --v*) 5523a0898aSmrg echo "depcomp $scriptversion" 5623a0898aSmrg exit $? 5723a0898aSmrg ;; 5823a0898aSmrgesac 5923a0898aSmrg 6023a0898aSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 6123a0898aSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 6223a0898aSmrg exit 1 6323a0898aSmrgfi 6423a0898aSmrg 6523a0898aSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 6623a0898aSmrgdepfile=${depfile-`echo "$object" | 6723a0898aSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 6823a0898aSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 6923a0898aSmrg 7023a0898aSmrgrm -f "$tmpdepfile" 7123a0898aSmrg 7223a0898aSmrg# Some modes work just like other modes, but use different flags. We 7323a0898aSmrg# parameterize here, but still list the modes in the big case below, 7423a0898aSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 7523a0898aSmrg# here, because this file can only contain one case statement. 7623a0898aSmrgif test "$depmode" = hp; then 7723a0898aSmrg # HP compiler uses -M and no extra arg. 7823a0898aSmrg gccflag=-M 7923a0898aSmrg depmode=gcc 8023a0898aSmrgfi 8123a0898aSmrg 8223a0898aSmrgif test "$depmode" = dashXmstdout; then 8323a0898aSmrg # This is just like dashmstdout with a different argument. 8423a0898aSmrg dashmflag=-xM 8523a0898aSmrg depmode=dashmstdout 8623a0898aSmrgfi 8723a0898aSmrg 8841c30155Smrgcygpath_u="cygpath -u -f -" 8941c30155Smrgif test "$depmode" = msvcmsys; then 9041c30155Smrg # This is just like msvisualcpp but w/o cygpath translation. 9141c30155Smrg # Just convert the backslash-escaped backslashes to single forward 9241c30155Smrg # slashes to satisfy depend.m4 9341c30155Smrg cygpath_u="sed s,\\\\\\\\,/,g" 9441c30155Smrg depmode=msvisualcpp 9541c30155Smrgfi 9641c30155Smrg 9723a0898aSmrgcase "$depmode" in 9823a0898aSmrggcc3) 9923a0898aSmrg## gcc 3 implements dependency tracking that does exactly what 10023a0898aSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 10123a0898aSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 10223a0898aSmrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 10323a0898aSmrg## the command line argument order; so add the flags where they 10423a0898aSmrg## appear in depend2.am. Note that the slowdown incurred here 10523a0898aSmrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 10623a0898aSmrg for arg 10723a0898aSmrg do 10823a0898aSmrg case $arg in 10923a0898aSmrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 11023a0898aSmrg *) set fnord "$@" "$arg" ;; 11123a0898aSmrg esac 11223a0898aSmrg shift # fnord 11323a0898aSmrg shift # $arg 11423a0898aSmrg done 11523a0898aSmrg "$@" 11623a0898aSmrg stat=$? 11723a0898aSmrg if test $stat -eq 0; then : 11823a0898aSmrg else 11923a0898aSmrg rm -f "$tmpdepfile" 12023a0898aSmrg exit $stat 12123a0898aSmrg fi 12223a0898aSmrg mv "$tmpdepfile" "$depfile" 12323a0898aSmrg ;; 12423a0898aSmrg 12523a0898aSmrggcc) 12623a0898aSmrg## There are various ways to get dependency output from gcc. Here's 12723a0898aSmrg## why we pick this rather obscure method: 12823a0898aSmrg## - Don't want to use -MD because we'd like the dependencies to end 12923a0898aSmrg## up in a subdir. Having to rename by hand is ugly. 13023a0898aSmrg## (We might end up doing this anyway to support other compilers.) 13123a0898aSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 13223a0898aSmrg## -MM, not -M (despite what the docs say). 13323a0898aSmrg## - Using -M directly means running the compiler twice (even worse 13423a0898aSmrg## than renaming). 13523a0898aSmrg if test -z "$gccflag"; then 13623a0898aSmrg gccflag=-MD, 13723a0898aSmrg fi 13823a0898aSmrg "$@" -Wp,"$gccflag$tmpdepfile" 13923a0898aSmrg stat=$? 14023a0898aSmrg if test $stat -eq 0; then : 14123a0898aSmrg else 14223a0898aSmrg rm -f "$tmpdepfile" 14323a0898aSmrg exit $stat 14423a0898aSmrg fi 14523a0898aSmrg rm -f "$depfile" 14623a0898aSmrg echo "$object : \\" > "$depfile" 14723a0898aSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 14823a0898aSmrg## The second -e expression handles DOS-style file names with drive letters. 14923a0898aSmrg sed -e 's/^[^:]*: / /' \ 15023a0898aSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 15123a0898aSmrg## This next piece of magic avoids the `deleted header file' problem. 15223a0898aSmrg## The problem is that when a header file which appears in a .P file 15323a0898aSmrg## is deleted, the dependency causes make to die (because there is 15423a0898aSmrg## typically no way to rebuild the header). We avoid this by adding 15523a0898aSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 15623a0898aSmrg## this for us directly. 15723a0898aSmrg tr ' ' ' 15823a0898aSmrg' < "$tmpdepfile" | 15923a0898aSmrg## Some versions of gcc put a space before the `:'. On the theory 16023a0898aSmrg## that the space means something, we add a space to the output as 16123a0898aSmrg## well. 16223a0898aSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 16323a0898aSmrg## correctly. Breaking it into two sed invocations is a workaround. 16423a0898aSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 16523a0898aSmrg rm -f "$tmpdepfile" 16623a0898aSmrg ;; 16723a0898aSmrg 16823a0898aSmrghp) 16923a0898aSmrg # This case exists only to let depend.m4 do its work. It works by 17023a0898aSmrg # looking at the text of this script. This case will never be run, 17123a0898aSmrg # since it is checked for above. 17223a0898aSmrg exit 1 17323a0898aSmrg ;; 17423a0898aSmrg 17523a0898aSmrgsgi) 17623a0898aSmrg if test "$libtool" = yes; then 17723a0898aSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 17823a0898aSmrg else 17923a0898aSmrg "$@" -MDupdate "$tmpdepfile" 18023a0898aSmrg fi 18123a0898aSmrg stat=$? 18223a0898aSmrg if test $stat -eq 0; then : 18323a0898aSmrg else 18423a0898aSmrg rm -f "$tmpdepfile" 18523a0898aSmrg exit $stat 18623a0898aSmrg fi 18723a0898aSmrg rm -f "$depfile" 18823a0898aSmrg 18923a0898aSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 19023a0898aSmrg echo "$object : \\" > "$depfile" 19123a0898aSmrg 19223a0898aSmrg # Clip off the initial element (the dependent). Don't try to be 19323a0898aSmrg # clever and replace this with sed code, as IRIX sed won't handle 19423a0898aSmrg # lines with more than a fixed number of characters (4096 in 19523a0898aSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 19623a0898aSmrg # the IRIX cc adds comments like `#:fec' to the end of the 19723a0898aSmrg # dependency line. 19823a0898aSmrg tr ' ' ' 19923a0898aSmrg' < "$tmpdepfile" \ 20023a0898aSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 20123a0898aSmrg tr ' 20241c30155Smrg' ' ' >> "$depfile" 20341c30155Smrg echo >> "$depfile" 20423a0898aSmrg 20523a0898aSmrg # The second pass generates a dummy entry for each header file. 20623a0898aSmrg tr ' ' ' 20723a0898aSmrg' < "$tmpdepfile" \ 20823a0898aSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 20941c30155Smrg >> "$depfile" 21023a0898aSmrg else 21123a0898aSmrg # The sourcefile does not contain any dependencies, so just 21223a0898aSmrg # store a dummy comment line, to avoid errors with the Makefile 21323a0898aSmrg # "include basename.Plo" scheme. 21423a0898aSmrg echo "#dummy" > "$depfile" 21523a0898aSmrg fi 21623a0898aSmrg rm -f "$tmpdepfile" 21723a0898aSmrg ;; 21823a0898aSmrg 21923a0898aSmrgaix) 22023a0898aSmrg # The C for AIX Compiler uses -M and outputs the dependencies 22123a0898aSmrg # in a .u file. In older versions, this file always lives in the 22223a0898aSmrg # current directory. Also, the AIX compiler puts `$object:' at the 22323a0898aSmrg # start of each line; $object doesn't have directory information. 22423a0898aSmrg # Version 6 uses the directory in both cases. 22523a0898aSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 22623a0898aSmrg test "x$dir" = "x$object" && dir= 22723a0898aSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 22823a0898aSmrg if test "$libtool" = yes; then 22923a0898aSmrg tmpdepfile1=$dir$base.u 23023a0898aSmrg tmpdepfile2=$base.u 23123a0898aSmrg tmpdepfile3=$dir.libs/$base.u 23223a0898aSmrg "$@" -Wc,-M 23323a0898aSmrg else 23423a0898aSmrg tmpdepfile1=$dir$base.u 23523a0898aSmrg tmpdepfile2=$dir$base.u 23623a0898aSmrg tmpdepfile3=$dir$base.u 23723a0898aSmrg "$@" -M 23823a0898aSmrg fi 23923a0898aSmrg stat=$? 24023a0898aSmrg 24123a0898aSmrg if test $stat -eq 0; then : 24223a0898aSmrg else 24323a0898aSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 24423a0898aSmrg exit $stat 24523a0898aSmrg fi 24623a0898aSmrg 24723a0898aSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 24823a0898aSmrg do 24923a0898aSmrg test -f "$tmpdepfile" && break 25023a0898aSmrg done 25123a0898aSmrg if test -f "$tmpdepfile"; then 25223a0898aSmrg # Each line is of the form `foo.o: dependent.h'. 25323a0898aSmrg # Do two passes, one to just change these to 25423a0898aSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 25523a0898aSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 25623a0898aSmrg # That's a tab and a space in the []. 25723a0898aSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 25823a0898aSmrg else 25923a0898aSmrg # The sourcefile does not contain any dependencies, so just 26023a0898aSmrg # store a dummy comment line, to avoid errors with the Makefile 26123a0898aSmrg # "include basename.Plo" scheme. 26223a0898aSmrg echo "#dummy" > "$depfile" 26323a0898aSmrg fi 26423a0898aSmrg rm -f "$tmpdepfile" 26523a0898aSmrg ;; 26623a0898aSmrg 26723a0898aSmrgicc) 26823a0898aSmrg # Intel's C compiler understands `-MD -MF file'. However on 26923a0898aSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 27023a0898aSmrg # ICC 7.0 will fill foo.d with something like 27123a0898aSmrg # foo.o: sub/foo.c 27223a0898aSmrg # foo.o: sub/foo.h 27323a0898aSmrg # which is wrong. We want: 27423a0898aSmrg # sub/foo.o: sub/foo.c 27523a0898aSmrg # sub/foo.o: sub/foo.h 27623a0898aSmrg # sub/foo.c: 27723a0898aSmrg # sub/foo.h: 27823a0898aSmrg # ICC 7.1 will output 27923a0898aSmrg # foo.o: sub/foo.c sub/foo.h 28023a0898aSmrg # and will wrap long lines using \ : 28123a0898aSmrg # foo.o: sub/foo.c ... \ 28223a0898aSmrg # sub/foo.h ... \ 28323a0898aSmrg # ... 28423a0898aSmrg 28523a0898aSmrg "$@" -MD -MF "$tmpdepfile" 28623a0898aSmrg stat=$? 28723a0898aSmrg if test $stat -eq 0; then : 28823a0898aSmrg else 28923a0898aSmrg rm -f "$tmpdepfile" 29023a0898aSmrg exit $stat 29123a0898aSmrg fi 29223a0898aSmrg rm -f "$depfile" 29323a0898aSmrg # Each line is of the form `foo.o: dependent.h', 29423a0898aSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 29523a0898aSmrg # Do two passes, one to just change these to 29623a0898aSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 29723a0898aSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 29823a0898aSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 29923a0898aSmrg # correctly. Breaking it into two sed invocations is a workaround. 30023a0898aSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 30123a0898aSmrg sed -e 's/$/ :/' >> "$depfile" 30223a0898aSmrg rm -f "$tmpdepfile" 30323a0898aSmrg ;; 30423a0898aSmrg 30523a0898aSmrghp2) 30623a0898aSmrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 30723a0898aSmrg # compilers, which have integrated preprocessors. The correct option 30823a0898aSmrg # to use with these is +Maked; it writes dependencies to a file named 30923a0898aSmrg # 'foo.d', which lands next to the object file, wherever that 31023a0898aSmrg # happens to be. 31123a0898aSmrg # Much of this is similar to the tru64 case; see comments there. 31223a0898aSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 31323a0898aSmrg test "x$dir" = "x$object" && dir= 31423a0898aSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 31523a0898aSmrg if test "$libtool" = yes; then 31623a0898aSmrg tmpdepfile1=$dir$base.d 31723a0898aSmrg tmpdepfile2=$dir.libs/$base.d 31823a0898aSmrg "$@" -Wc,+Maked 31923a0898aSmrg else 32023a0898aSmrg tmpdepfile1=$dir$base.d 32123a0898aSmrg tmpdepfile2=$dir$base.d 32223a0898aSmrg "$@" +Maked 32323a0898aSmrg fi 32423a0898aSmrg stat=$? 32523a0898aSmrg if test $stat -eq 0; then : 32623a0898aSmrg else 32723a0898aSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" 32823a0898aSmrg exit $stat 32923a0898aSmrg fi 33023a0898aSmrg 33123a0898aSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 33223a0898aSmrg do 33323a0898aSmrg test -f "$tmpdepfile" && break 33423a0898aSmrg done 33523a0898aSmrg if test -f "$tmpdepfile"; then 33623a0898aSmrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 33723a0898aSmrg # Add `dependent.h:' lines. 33841c30155Smrg sed -ne '2,${ 33941c30155Smrg s/^ *// 34041c30155Smrg s/ \\*$// 34141c30155Smrg s/$/:/ 34241c30155Smrg p 34341c30155Smrg }' "$tmpdepfile" >> "$depfile" 34423a0898aSmrg else 34523a0898aSmrg echo "#dummy" > "$depfile" 34623a0898aSmrg fi 34723a0898aSmrg rm -f "$tmpdepfile" "$tmpdepfile2" 34823a0898aSmrg ;; 34923a0898aSmrg 35023a0898aSmrgtru64) 35123a0898aSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 35223a0898aSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 35323a0898aSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 35423a0898aSmrg # dependencies in `foo.d' instead, so we check for that too. 35523a0898aSmrg # Subdirectories are respected. 35623a0898aSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 35723a0898aSmrg test "x$dir" = "x$object" && dir= 35823a0898aSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 35923a0898aSmrg 36023a0898aSmrg if test "$libtool" = yes; then 36123a0898aSmrg # With Tru64 cc, shared objects can also be used to make a 36223a0898aSmrg # static library. This mechanism is used in libtool 1.4 series to 36323a0898aSmrg # handle both shared and static libraries in a single compilation. 36423a0898aSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 36523a0898aSmrg # 36623a0898aSmrg # With libtool 1.5 this exception was removed, and libtool now 36723a0898aSmrg # generates 2 separate objects for the 2 libraries. These two 36823a0898aSmrg # compilations output dependencies in $dir.libs/$base.o.d and 36923a0898aSmrg # in $dir$base.o.d. We have to check for both files, because 37023a0898aSmrg # one of the two compilations can be disabled. We should prefer 37123a0898aSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 37223a0898aSmrg # automatically cleaned when .libs/ is deleted, while ignoring 37323a0898aSmrg # the former would cause a distcleancheck panic. 37423a0898aSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 37523a0898aSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 37623a0898aSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 37723a0898aSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 37823a0898aSmrg "$@" -Wc,-MD 37923a0898aSmrg else 38023a0898aSmrg tmpdepfile1=$dir$base.o.d 38123a0898aSmrg tmpdepfile2=$dir$base.d 38223a0898aSmrg tmpdepfile3=$dir$base.d 38323a0898aSmrg tmpdepfile4=$dir$base.d 38423a0898aSmrg "$@" -MD 38523a0898aSmrg fi 38623a0898aSmrg 38723a0898aSmrg stat=$? 38823a0898aSmrg if test $stat -eq 0; then : 38923a0898aSmrg else 39023a0898aSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 39123a0898aSmrg exit $stat 39223a0898aSmrg fi 39323a0898aSmrg 39423a0898aSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 39523a0898aSmrg do 39623a0898aSmrg test -f "$tmpdepfile" && break 39723a0898aSmrg done 39823a0898aSmrg if test -f "$tmpdepfile"; then 39923a0898aSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 40023a0898aSmrg # That's a tab and a space in the []. 40123a0898aSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 40223a0898aSmrg else 40323a0898aSmrg echo "#dummy" > "$depfile" 40423a0898aSmrg fi 40523a0898aSmrg rm -f "$tmpdepfile" 40623a0898aSmrg ;; 40723a0898aSmrg 40823a0898aSmrg#nosideeffect) 40923a0898aSmrg # This comment above is used by automake to tell side-effect 41023a0898aSmrg # dependency tracking mechanisms from slower ones. 41123a0898aSmrg 41223a0898aSmrgdashmstdout) 41323a0898aSmrg # Important note: in order to support this mode, a compiler *must* 41423a0898aSmrg # always write the preprocessed file to stdout, regardless of -o. 41523a0898aSmrg "$@" || exit $? 41623a0898aSmrg 41723a0898aSmrg # Remove the call to Libtool. 41823a0898aSmrg if test "$libtool" = yes; then 41941c30155Smrg while test "X$1" != 'X--mode=compile'; do 42023a0898aSmrg shift 42123a0898aSmrg done 42223a0898aSmrg shift 42323a0898aSmrg fi 42423a0898aSmrg 42523a0898aSmrg # Remove `-o $object'. 42623a0898aSmrg IFS=" " 42723a0898aSmrg for arg 42823a0898aSmrg do 42923a0898aSmrg case $arg in 43023a0898aSmrg -o) 43123a0898aSmrg shift 43223a0898aSmrg ;; 43323a0898aSmrg $object) 43423a0898aSmrg shift 43523a0898aSmrg ;; 43623a0898aSmrg *) 43723a0898aSmrg set fnord "$@" "$arg" 43823a0898aSmrg shift # fnord 43923a0898aSmrg shift # $arg 44023a0898aSmrg ;; 44123a0898aSmrg esac 44223a0898aSmrg done 44323a0898aSmrg 44423a0898aSmrg test -z "$dashmflag" && dashmflag=-M 44523a0898aSmrg # Require at least two characters before searching for `:' 44623a0898aSmrg # in the target name. This is to cope with DOS-style filenames: 44723a0898aSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 44823a0898aSmrg "$@" $dashmflag | 44923a0898aSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 45023a0898aSmrg rm -f "$depfile" 45123a0898aSmrg cat < "$tmpdepfile" > "$depfile" 45223a0898aSmrg tr ' ' ' 45323a0898aSmrg' < "$tmpdepfile" | \ 45423a0898aSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 45523a0898aSmrg## correctly. Breaking it into two sed invocations is a workaround. 45623a0898aSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 45723a0898aSmrg rm -f "$tmpdepfile" 45823a0898aSmrg ;; 45923a0898aSmrg 46023a0898aSmrgdashXmstdout) 46123a0898aSmrg # This case only exists to satisfy depend.m4. It is never actually 46223a0898aSmrg # run, as this mode is specially recognized in the preamble. 46323a0898aSmrg exit 1 46423a0898aSmrg ;; 46523a0898aSmrg 46623a0898aSmrgmakedepend) 46723a0898aSmrg "$@" || exit $? 46823a0898aSmrg # Remove any Libtool call 46923a0898aSmrg if test "$libtool" = yes; then 47041c30155Smrg while test "X$1" != 'X--mode=compile'; do 47123a0898aSmrg shift 47223a0898aSmrg done 47323a0898aSmrg shift 47423a0898aSmrg fi 47523a0898aSmrg # X makedepend 47623a0898aSmrg shift 47741c30155Smrg cleared=no eat=no 47841c30155Smrg for arg 47941c30155Smrg do 48023a0898aSmrg case $cleared in 48123a0898aSmrg no) 48223a0898aSmrg set ""; shift 48323a0898aSmrg cleared=yes ;; 48423a0898aSmrg esac 48541c30155Smrg if test $eat = yes; then 48641c30155Smrg eat=no 48741c30155Smrg continue 48841c30155Smrg fi 48923a0898aSmrg case "$arg" in 49023a0898aSmrg -D*|-I*) 49123a0898aSmrg set fnord "$@" "$arg"; shift ;; 49223a0898aSmrg # Strip any option that makedepend may not understand. Remove 49323a0898aSmrg # the object too, otherwise makedepend will parse it as a source file. 49441c30155Smrg -arch) 49541c30155Smrg eat=yes ;; 49623a0898aSmrg -*|$object) 49723a0898aSmrg ;; 49823a0898aSmrg *) 49923a0898aSmrg set fnord "$@" "$arg"; shift ;; 50023a0898aSmrg esac 50123a0898aSmrg done 50241c30155Smrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 50323a0898aSmrg touch "$tmpdepfile" 50423a0898aSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 50523a0898aSmrg rm -f "$depfile" 50623a0898aSmrg cat < "$tmpdepfile" > "$depfile" 50723a0898aSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 50823a0898aSmrg' | \ 50923a0898aSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 51023a0898aSmrg## correctly. Breaking it into two sed invocations is a workaround. 51123a0898aSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 51223a0898aSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 51323a0898aSmrg ;; 51423a0898aSmrg 51523a0898aSmrgcpp) 51623a0898aSmrg # Important note: in order to support this mode, a compiler *must* 51723a0898aSmrg # always write the preprocessed file to stdout. 51823a0898aSmrg "$@" || exit $? 51923a0898aSmrg 52023a0898aSmrg # Remove the call to Libtool. 52123a0898aSmrg if test "$libtool" = yes; then 52241c30155Smrg while test "X$1" != 'X--mode=compile'; do 52323a0898aSmrg shift 52423a0898aSmrg done 52523a0898aSmrg shift 52623a0898aSmrg fi 52723a0898aSmrg 52823a0898aSmrg # Remove `-o $object'. 52923a0898aSmrg IFS=" " 53023a0898aSmrg for arg 53123a0898aSmrg do 53223a0898aSmrg case $arg in 53323a0898aSmrg -o) 53423a0898aSmrg shift 53523a0898aSmrg ;; 53623a0898aSmrg $object) 53723a0898aSmrg shift 53823a0898aSmrg ;; 53923a0898aSmrg *) 54023a0898aSmrg set fnord "$@" "$arg" 54123a0898aSmrg shift # fnord 54223a0898aSmrg shift # $arg 54323a0898aSmrg ;; 54423a0898aSmrg esac 54523a0898aSmrg done 54623a0898aSmrg 54723a0898aSmrg "$@" -E | 54823a0898aSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 54923a0898aSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 55023a0898aSmrg sed '$ s: \\$::' > "$tmpdepfile" 55123a0898aSmrg rm -f "$depfile" 55223a0898aSmrg echo "$object : \\" > "$depfile" 55323a0898aSmrg cat < "$tmpdepfile" >> "$depfile" 55423a0898aSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 55523a0898aSmrg rm -f "$tmpdepfile" 55623a0898aSmrg ;; 55723a0898aSmrg 55823a0898aSmrgmsvisualcpp) 55923a0898aSmrg # Important note: in order to support this mode, a compiler *must* 56041c30155Smrg # always write the preprocessed file to stdout. 56123a0898aSmrg "$@" || exit $? 56241c30155Smrg 56341c30155Smrg # Remove the call to Libtool. 56441c30155Smrg if test "$libtool" = yes; then 56541c30155Smrg while test "X$1" != 'X--mode=compile'; do 56641c30155Smrg shift 56741c30155Smrg done 56841c30155Smrg shift 56941c30155Smrg fi 57041c30155Smrg 57123a0898aSmrg IFS=" " 57223a0898aSmrg for arg 57323a0898aSmrg do 57423a0898aSmrg case "$arg" in 57541c30155Smrg -o) 57641c30155Smrg shift 57741c30155Smrg ;; 57841c30155Smrg $object) 57941c30155Smrg shift 58041c30155Smrg ;; 58123a0898aSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 58223a0898aSmrg set fnord "$@" 58323a0898aSmrg shift 58423a0898aSmrg shift 58523a0898aSmrg ;; 58623a0898aSmrg *) 58723a0898aSmrg set fnord "$@" "$arg" 58823a0898aSmrg shift 58923a0898aSmrg shift 59023a0898aSmrg ;; 59123a0898aSmrg esac 59223a0898aSmrg done 59341c30155Smrg "$@" -E 2>/dev/null | 59441c30155Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 59523a0898aSmrg rm -f "$depfile" 59623a0898aSmrg echo "$object : \\" > "$depfile" 59741c30155Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 59823a0898aSmrg echo " " >> "$depfile" 59941c30155Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 60023a0898aSmrg rm -f "$tmpdepfile" 60123a0898aSmrg ;; 60223a0898aSmrg 60341c30155Smrgmsvcmsys) 60441c30155Smrg # This case exists only to let depend.m4 do its work. It works by 60541c30155Smrg # looking at the text of this script. This case will never be run, 60641c30155Smrg # since it is checked for above. 60741c30155Smrg exit 1 60841c30155Smrg ;; 60941c30155Smrg 61023a0898aSmrgnone) 61123a0898aSmrg exec "$@" 61223a0898aSmrg ;; 61323a0898aSmrg 61423a0898aSmrg*) 61523a0898aSmrg echo "Unknown depmode $depmode" 1>&2 61623a0898aSmrg exit 1 61723a0898aSmrg ;; 61823a0898aSmrgesac 61923a0898aSmrg 62023a0898aSmrgexit 0 62123a0898aSmrg 62223a0898aSmrg# Local Variables: 62323a0898aSmrg# mode: shell-script 62423a0898aSmrg# sh-indentation: 2 62523a0898aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 62623a0898aSmrg# time-stamp-start: "scriptversion=" 62723a0898aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 62841c30155Smrg# time-stamp-time-zone: "UTC" 62941c30155Smrg# time-stamp-end: "; # UTC" 63023a0898aSmrg# End: 631