depcomp revision d8556812
176888252Smrg#! /bin/sh 276888252Smrg# depcomp - compile a program generating dependencies as side-effects 376888252Smrg 4d8556812Smrgscriptversion=2009-04-28.21; # UTC 576888252Smrg 6d8556812Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 7d8556812Smrg# Software Foundation, Inc. 876888252Smrg 976888252Smrg# This program is free software; you can redistribute it and/or modify 1076888252Smrg# it under the terms of the GNU General Public License as published by 1176888252Smrg# the Free Software Foundation; either version 2, or (at your option) 1276888252Smrg# any later version. 1376888252Smrg 1476888252Smrg# This program is distributed in the hope that it will be useful, 1576888252Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1676888252Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1776888252Smrg# GNU General Public License for more details. 1876888252Smrg 1976888252Smrg# You should have received a copy of the GNU General Public License 20d8556812Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2176888252Smrg 2276888252Smrg# As a special exception to the GNU General Public License, if you 2376888252Smrg# distribute this file as part of a program that contains a 2476888252Smrg# configuration script generated by Autoconf, you may include it under 2576888252Smrg# the same distribution terms that you use for the rest of that program. 2676888252Smrg 2776888252Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 2876888252Smrg 2976888252Smrgcase $1 in 3076888252Smrg '') 3176888252Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 3276888252Smrg exit 1; 3376888252Smrg ;; 3476888252Smrg -h | --h*) 3576888252Smrg cat <<\EOF 3676888252SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 3776888252Smrg 3876888252SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 3976888252Smrgas side-effects. 4076888252Smrg 4176888252SmrgEnvironment variables: 4276888252Smrg depmode Dependency tracking mode. 4376888252Smrg source Source file read by `PROGRAMS ARGS'. 4476888252Smrg object Object file output by `PROGRAMS ARGS'. 4576888252Smrg DEPDIR directory where to store dependencies. 4676888252Smrg depfile Dependency file to output. 4776888252Smrg tmpdepfile Temporary file to use when outputing dependencies. 4876888252Smrg libtool Whether libtool is used (yes/no). 4976888252Smrg 5076888252SmrgReport bugs to <bug-automake@gnu.org>. 5176888252SmrgEOF 5276888252Smrg exit $? 5376888252Smrg ;; 5476888252Smrg -v | --v*) 5576888252Smrg echo "depcomp $scriptversion" 5676888252Smrg exit $? 5776888252Smrg ;; 5876888252Smrgesac 5976888252Smrg 6076888252Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 6176888252Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 6276888252Smrg exit 1 6376888252Smrgfi 6476888252Smrg 6576888252Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 6676888252Smrgdepfile=${depfile-`echo "$object" | 6776888252Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 6876888252Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 6976888252Smrg 7076888252Smrgrm -f "$tmpdepfile" 7176888252Smrg 7276888252Smrg# Some modes work just like other modes, but use different flags. We 7376888252Smrg# parameterize here, but still list the modes in the big case below, 7476888252Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 7576888252Smrg# here, because this file can only contain one case statement. 7676888252Smrgif test "$depmode" = hp; then 7776888252Smrg # HP compiler uses -M and no extra arg. 7876888252Smrg gccflag=-M 7976888252Smrg depmode=gcc 8076888252Smrgfi 8176888252Smrg 8276888252Smrgif test "$depmode" = dashXmstdout; then 8376888252Smrg # This is just like dashmstdout with a different argument. 8476888252Smrg dashmflag=-xM 8576888252Smrg depmode=dashmstdout 8676888252Smrgfi 8776888252Smrg 88d8556812Smrgcygpath_u="cygpath -u -f -" 89d8556812Smrgif test "$depmode" = msvcmsys; then 90d8556812Smrg # This is just like msvisualcpp but w/o cygpath translation. 91d8556812Smrg # Just convert the backslash-escaped backslashes to single forward 92d8556812Smrg # slashes to satisfy depend.m4 93d8556812Smrg cygpath_u="sed s,\\\\\\\\,/,g" 94d8556812Smrg depmode=msvisualcpp 95d8556812Smrgfi 96d8556812Smrg 9776888252Smrgcase "$depmode" in 9876888252Smrggcc3) 9976888252Smrg## gcc 3 implements dependency tracking that does exactly what 10076888252Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 10176888252Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 1021ae1b5e8Smrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1031ae1b5e8Smrg## the command line argument order; so add the flags where they 1041ae1b5e8Smrg## appear in depend2.am. Note that the slowdown incurred here 1051ae1b5e8Smrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1061ae1b5e8Smrg for arg 1071ae1b5e8Smrg do 1081ae1b5e8Smrg case $arg in 1091ae1b5e8Smrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1101ae1b5e8Smrg *) set fnord "$@" "$arg" ;; 1111ae1b5e8Smrg esac 1121ae1b5e8Smrg shift # fnord 1131ae1b5e8Smrg shift # $arg 1141ae1b5e8Smrg done 1151ae1b5e8Smrg "$@" 11676888252Smrg stat=$? 11776888252Smrg if test $stat -eq 0; then : 11876888252Smrg else 11976888252Smrg rm -f "$tmpdepfile" 12076888252Smrg exit $stat 12176888252Smrg fi 12276888252Smrg mv "$tmpdepfile" "$depfile" 12376888252Smrg ;; 12476888252Smrg 12576888252Smrggcc) 12676888252Smrg## There are various ways to get dependency output from gcc. Here's 12776888252Smrg## why we pick this rather obscure method: 12876888252Smrg## - Don't want to use -MD because we'd like the dependencies to end 12976888252Smrg## up in a subdir. Having to rename by hand is ugly. 13076888252Smrg## (We might end up doing this anyway to support other compilers.) 13176888252Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 13276888252Smrg## -MM, not -M (despite what the docs say). 13376888252Smrg## - Using -M directly means running the compiler twice (even worse 13476888252Smrg## than renaming). 13576888252Smrg if test -z "$gccflag"; then 13676888252Smrg gccflag=-MD, 13776888252Smrg fi 13876888252Smrg "$@" -Wp,"$gccflag$tmpdepfile" 13976888252Smrg stat=$? 14076888252Smrg if test $stat -eq 0; then : 14176888252Smrg else 14276888252Smrg rm -f "$tmpdepfile" 14376888252Smrg exit $stat 14476888252Smrg fi 14576888252Smrg rm -f "$depfile" 14676888252Smrg echo "$object : \\" > "$depfile" 14776888252Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 14876888252Smrg## The second -e expression handles DOS-style file names with drive letters. 14976888252Smrg sed -e 's/^[^:]*: / /' \ 15076888252Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 15176888252Smrg## This next piece of magic avoids the `deleted header file' problem. 15276888252Smrg## The problem is that when a header file which appears in a .P file 15376888252Smrg## is deleted, the dependency causes make to die (because there is 15476888252Smrg## typically no way to rebuild the header). We avoid this by adding 15576888252Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 15676888252Smrg## this for us directly. 15776888252Smrg tr ' ' ' 15876888252Smrg' < "$tmpdepfile" | 15976888252Smrg## Some versions of gcc put a space before the `:'. On the theory 16076888252Smrg## that the space means something, we add a space to the output as 16176888252Smrg## well. 16276888252Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 16376888252Smrg## correctly. Breaking it into two sed invocations is a workaround. 16476888252Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 16576888252Smrg rm -f "$tmpdepfile" 16676888252Smrg ;; 16776888252Smrg 16876888252Smrghp) 16976888252Smrg # This case exists only to let depend.m4 do its work. It works by 17076888252Smrg # looking at the text of this script. This case will never be run, 17176888252Smrg # since it is checked for above. 17276888252Smrg exit 1 17376888252Smrg ;; 17476888252Smrg 17576888252Smrgsgi) 17676888252Smrg if test "$libtool" = yes; then 17776888252Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 17876888252Smrg else 17976888252Smrg "$@" -MDupdate "$tmpdepfile" 18076888252Smrg fi 18176888252Smrg stat=$? 18276888252Smrg if test $stat -eq 0; then : 18376888252Smrg else 18476888252Smrg rm -f "$tmpdepfile" 18576888252Smrg exit $stat 18676888252Smrg fi 18776888252Smrg rm -f "$depfile" 18876888252Smrg 18976888252Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 19076888252Smrg echo "$object : \\" > "$depfile" 19176888252Smrg 19276888252Smrg # Clip off the initial element (the dependent). Don't try to be 19376888252Smrg # clever and replace this with sed code, as IRIX sed won't handle 19476888252Smrg # lines with more than a fixed number of characters (4096 in 19576888252Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 19676888252Smrg # the IRIX cc adds comments like `#:fec' to the end of the 19776888252Smrg # dependency line. 19876888252Smrg tr ' ' ' 19976888252Smrg' < "$tmpdepfile" \ 20076888252Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 20176888252Smrg tr ' 202d8556812Smrg' ' ' >> "$depfile" 203d8556812Smrg echo >> "$depfile" 20476888252Smrg 20576888252Smrg # The second pass generates a dummy entry for each header file. 20676888252Smrg tr ' ' ' 20776888252Smrg' < "$tmpdepfile" \ 20876888252Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 209d8556812Smrg >> "$depfile" 21076888252Smrg else 21176888252Smrg # The sourcefile does not contain any dependencies, so just 21276888252Smrg # store a dummy comment line, to avoid errors with the Makefile 21376888252Smrg # "include basename.Plo" scheme. 21476888252Smrg echo "#dummy" > "$depfile" 21576888252Smrg fi 21676888252Smrg rm -f "$tmpdepfile" 21776888252Smrg ;; 21876888252Smrg 21976888252Smrgaix) 22076888252Smrg # The C for AIX Compiler uses -M and outputs the dependencies 22176888252Smrg # in a .u file. In older versions, this file always lives in the 22276888252Smrg # current directory. Also, the AIX compiler puts `$object:' at the 22376888252Smrg # start of each line; $object doesn't have directory information. 22476888252Smrg # Version 6 uses the directory in both cases. 22586dafe34Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 22686dafe34Smrg test "x$dir" = "x$object" && dir= 22786dafe34Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 22876888252Smrg if test "$libtool" = yes; then 22986dafe34Smrg tmpdepfile1=$dir$base.u 23086dafe34Smrg tmpdepfile2=$base.u 23186dafe34Smrg tmpdepfile3=$dir.libs/$base.u 23276888252Smrg "$@" -Wc,-M 23376888252Smrg else 23486dafe34Smrg tmpdepfile1=$dir$base.u 23586dafe34Smrg tmpdepfile2=$dir$base.u 23686dafe34Smrg tmpdepfile3=$dir$base.u 23776888252Smrg "$@" -M 23876888252Smrg fi 23976888252Smrg stat=$? 24076888252Smrg 24176888252Smrg if test $stat -eq 0; then : 24276888252Smrg else 24386dafe34Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 24476888252Smrg exit $stat 24576888252Smrg fi 24676888252Smrg 24786dafe34Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 24886dafe34Smrg do 24986dafe34Smrg test -f "$tmpdepfile" && break 25086dafe34Smrg done 25176888252Smrg if test -f "$tmpdepfile"; then 25276888252Smrg # Each line is of the form `foo.o: dependent.h'. 25376888252Smrg # Do two passes, one to just change these to 25476888252Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 25586dafe34Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 25686dafe34Smrg # That's a tab and a space in the []. 25786dafe34Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 25876888252Smrg else 25976888252Smrg # The sourcefile does not contain any dependencies, so just 26076888252Smrg # store a dummy comment line, to avoid errors with the Makefile 26176888252Smrg # "include basename.Plo" scheme. 26276888252Smrg echo "#dummy" > "$depfile" 26376888252Smrg fi 26476888252Smrg rm -f "$tmpdepfile" 26576888252Smrg ;; 26676888252Smrg 26776888252Smrgicc) 26876888252Smrg # Intel's C compiler understands `-MD -MF file'. However on 26976888252Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 27076888252Smrg # ICC 7.0 will fill foo.d with something like 27176888252Smrg # foo.o: sub/foo.c 27276888252Smrg # foo.o: sub/foo.h 27376888252Smrg # which is wrong. We want: 27476888252Smrg # sub/foo.o: sub/foo.c 27576888252Smrg # sub/foo.o: sub/foo.h 27676888252Smrg # sub/foo.c: 27776888252Smrg # sub/foo.h: 27876888252Smrg # ICC 7.1 will output 27976888252Smrg # foo.o: sub/foo.c sub/foo.h 28076888252Smrg # and will wrap long lines using \ : 28176888252Smrg # foo.o: sub/foo.c ... \ 28276888252Smrg # sub/foo.h ... \ 28376888252Smrg # ... 28476888252Smrg 28576888252Smrg "$@" -MD -MF "$tmpdepfile" 28676888252Smrg stat=$? 28776888252Smrg if test $stat -eq 0; then : 28876888252Smrg else 28976888252Smrg rm -f "$tmpdepfile" 29076888252Smrg exit $stat 29176888252Smrg fi 29276888252Smrg rm -f "$depfile" 29376888252Smrg # Each line is of the form `foo.o: dependent.h', 29476888252Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 29576888252Smrg # Do two passes, one to just change these to 29676888252Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 29776888252Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 29876888252Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 29976888252Smrg # correctly. Breaking it into two sed invocations is a workaround. 30076888252Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 30176888252Smrg sed -e 's/$/ :/' >> "$depfile" 30276888252Smrg rm -f "$tmpdepfile" 30376888252Smrg ;; 30476888252Smrg 3051ae1b5e8Smrghp2) 3061ae1b5e8Smrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3071ae1b5e8Smrg # compilers, which have integrated preprocessors. The correct option 3081ae1b5e8Smrg # to use with these is +Maked; it writes dependencies to a file named 3091ae1b5e8Smrg # 'foo.d', which lands next to the object file, wherever that 3101ae1b5e8Smrg # happens to be. 3111ae1b5e8Smrg # Much of this is similar to the tru64 case; see comments there. 3121ae1b5e8Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3131ae1b5e8Smrg test "x$dir" = "x$object" && dir= 3141ae1b5e8Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3151ae1b5e8Smrg if test "$libtool" = yes; then 3161ae1b5e8Smrg tmpdepfile1=$dir$base.d 3171ae1b5e8Smrg tmpdepfile2=$dir.libs/$base.d 3181ae1b5e8Smrg "$@" -Wc,+Maked 3191ae1b5e8Smrg else 3201ae1b5e8Smrg tmpdepfile1=$dir$base.d 3211ae1b5e8Smrg tmpdepfile2=$dir$base.d 3221ae1b5e8Smrg "$@" +Maked 3231ae1b5e8Smrg fi 3241ae1b5e8Smrg stat=$? 3251ae1b5e8Smrg if test $stat -eq 0; then : 3261ae1b5e8Smrg else 3271ae1b5e8Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3281ae1b5e8Smrg exit $stat 3291ae1b5e8Smrg fi 3301ae1b5e8Smrg 3311ae1b5e8Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3321ae1b5e8Smrg do 3331ae1b5e8Smrg test -f "$tmpdepfile" && break 3341ae1b5e8Smrg done 3351ae1b5e8Smrg if test -f "$tmpdepfile"; then 3361ae1b5e8Smrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3371ae1b5e8Smrg # Add `dependent.h:' lines. 338d8556812Smrg sed -ne '2,${ 339d8556812Smrg s/^ *// 340d8556812Smrg s/ \\*$// 341d8556812Smrg s/$/:/ 342d8556812Smrg p 343d8556812Smrg }' "$tmpdepfile" >> "$depfile" 3441ae1b5e8Smrg else 3451ae1b5e8Smrg echo "#dummy" > "$depfile" 3461ae1b5e8Smrg fi 3471ae1b5e8Smrg rm -f "$tmpdepfile" "$tmpdepfile2" 3481ae1b5e8Smrg ;; 3491ae1b5e8Smrg 35076888252Smrgtru64) 35176888252Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 35276888252Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 35376888252Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 35476888252Smrg # dependencies in `foo.d' instead, so we check for that too. 35576888252Smrg # Subdirectories are respected. 35676888252Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 35776888252Smrg test "x$dir" = "x$object" && dir= 35876888252Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 35976888252Smrg 36076888252Smrg if test "$libtool" = yes; then 36176888252Smrg # With Tru64 cc, shared objects can also be used to make a 3621ae1b5e8Smrg # static library. This mechanism is used in libtool 1.4 series to 36376888252Smrg # handle both shared and static libraries in a single compilation. 36476888252Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 36576888252Smrg # 36676888252Smrg # With libtool 1.5 this exception was removed, and libtool now 36776888252Smrg # generates 2 separate objects for the 2 libraries. These two 3681ae1b5e8Smrg # compilations output dependencies in $dir.libs/$base.o.d and 36976888252Smrg # in $dir$base.o.d. We have to check for both files, because 37076888252Smrg # one of the two compilations can be disabled. We should prefer 37176888252Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 37276888252Smrg # automatically cleaned when .libs/ is deleted, while ignoring 37376888252Smrg # the former would cause a distcleancheck panic. 37476888252Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 37576888252Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 37676888252Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 37776888252Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 37876888252Smrg "$@" -Wc,-MD 37976888252Smrg else 38076888252Smrg tmpdepfile1=$dir$base.o.d 38176888252Smrg tmpdepfile2=$dir$base.d 38276888252Smrg tmpdepfile3=$dir$base.d 38376888252Smrg tmpdepfile4=$dir$base.d 38476888252Smrg "$@" -MD 38576888252Smrg fi 38676888252Smrg 38776888252Smrg stat=$? 38876888252Smrg if test $stat -eq 0; then : 38976888252Smrg else 39076888252Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 39176888252Smrg exit $stat 39276888252Smrg fi 39376888252Smrg 39476888252Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 39576888252Smrg do 39676888252Smrg test -f "$tmpdepfile" && break 39776888252Smrg done 39876888252Smrg if test -f "$tmpdepfile"; then 39976888252Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 40076888252Smrg # That's a tab and a space in the []. 40176888252Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 40276888252Smrg else 40376888252Smrg echo "#dummy" > "$depfile" 40476888252Smrg fi 40576888252Smrg rm -f "$tmpdepfile" 40676888252Smrg ;; 40776888252Smrg 40876888252Smrg#nosideeffect) 40976888252Smrg # This comment above is used by automake to tell side-effect 41076888252Smrg # dependency tracking mechanisms from slower ones. 41176888252Smrg 41276888252Smrgdashmstdout) 41376888252Smrg # Important note: in order to support this mode, a compiler *must* 41476888252Smrg # always write the preprocessed file to stdout, regardless of -o. 41576888252Smrg "$@" || exit $? 41676888252Smrg 41776888252Smrg # Remove the call to Libtool. 41876888252Smrg if test "$libtool" = yes; then 419d8556812Smrg while test "X$1" != 'X--mode=compile'; do 42076888252Smrg shift 42176888252Smrg done 42276888252Smrg shift 42376888252Smrg fi 42476888252Smrg 42576888252Smrg # Remove `-o $object'. 42676888252Smrg IFS=" " 42776888252Smrg for arg 42876888252Smrg do 42976888252Smrg case $arg in 43076888252Smrg -o) 43176888252Smrg shift 43276888252Smrg ;; 43376888252Smrg $object) 43476888252Smrg shift 43576888252Smrg ;; 43676888252Smrg *) 43776888252Smrg set fnord "$@" "$arg" 43876888252Smrg shift # fnord 43976888252Smrg shift # $arg 44076888252Smrg ;; 44176888252Smrg esac 44276888252Smrg done 44376888252Smrg 44476888252Smrg test -z "$dashmflag" && dashmflag=-M 44576888252Smrg # Require at least two characters before searching for `:' 44676888252Smrg # in the target name. This is to cope with DOS-style filenames: 44776888252Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 44876888252Smrg "$@" $dashmflag | 44976888252Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 45076888252Smrg rm -f "$depfile" 45176888252Smrg cat < "$tmpdepfile" > "$depfile" 45276888252Smrg tr ' ' ' 45376888252Smrg' < "$tmpdepfile" | \ 45476888252Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 45576888252Smrg## correctly. Breaking it into two sed invocations is a workaround. 45676888252Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 45776888252Smrg rm -f "$tmpdepfile" 45876888252Smrg ;; 45976888252Smrg 46076888252SmrgdashXmstdout) 46176888252Smrg # This case only exists to satisfy depend.m4. It is never actually 46276888252Smrg # run, as this mode is specially recognized in the preamble. 46376888252Smrg exit 1 46476888252Smrg ;; 46576888252Smrg 46676888252Smrgmakedepend) 46776888252Smrg "$@" || exit $? 46876888252Smrg # Remove any Libtool call 46976888252Smrg if test "$libtool" = yes; then 470d8556812Smrg while test "X$1" != 'X--mode=compile'; do 47176888252Smrg shift 47276888252Smrg done 47376888252Smrg shift 47476888252Smrg fi 47576888252Smrg # X makedepend 47676888252Smrg shift 477d8556812Smrg cleared=no eat=no 478d8556812Smrg for arg 479d8556812Smrg do 48076888252Smrg case $cleared in 48176888252Smrg no) 48276888252Smrg set ""; shift 48376888252Smrg cleared=yes ;; 48476888252Smrg esac 485d8556812Smrg if test $eat = yes; then 486d8556812Smrg eat=no 487d8556812Smrg continue 488d8556812Smrg fi 48976888252Smrg case "$arg" in 49076888252Smrg -D*|-I*) 49176888252Smrg set fnord "$@" "$arg"; shift ;; 49276888252Smrg # Strip any option that makedepend may not understand. Remove 49376888252Smrg # the object too, otherwise makedepend will parse it as a source file. 494d8556812Smrg -arch) 495d8556812Smrg eat=yes ;; 49676888252Smrg -*|$object) 49776888252Smrg ;; 49876888252Smrg *) 49976888252Smrg set fnord "$@" "$arg"; shift ;; 50076888252Smrg esac 50176888252Smrg done 502d8556812Smrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 50376888252Smrg touch "$tmpdepfile" 50476888252Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 50576888252Smrg rm -f "$depfile" 50676888252Smrg cat < "$tmpdepfile" > "$depfile" 50776888252Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 50876888252Smrg' | \ 50976888252Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 51076888252Smrg## correctly. Breaking it into two sed invocations is a workaround. 51176888252Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 51276888252Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 51376888252Smrg ;; 51476888252Smrg 51576888252Smrgcpp) 51676888252Smrg # Important note: in order to support this mode, a compiler *must* 51776888252Smrg # always write the preprocessed file to stdout. 51876888252Smrg "$@" || exit $? 51976888252Smrg 52076888252Smrg # Remove the call to Libtool. 52176888252Smrg if test "$libtool" = yes; then 522d8556812Smrg while test "X$1" != 'X--mode=compile'; do 52376888252Smrg shift 52476888252Smrg done 52576888252Smrg shift 52676888252Smrg fi 52776888252Smrg 52876888252Smrg # Remove `-o $object'. 52976888252Smrg IFS=" " 53076888252Smrg for arg 53176888252Smrg do 53276888252Smrg case $arg in 53376888252Smrg -o) 53476888252Smrg shift 53576888252Smrg ;; 53676888252Smrg $object) 53776888252Smrg shift 53876888252Smrg ;; 53976888252Smrg *) 54076888252Smrg set fnord "$@" "$arg" 54176888252Smrg shift # fnord 54276888252Smrg shift # $arg 54376888252Smrg ;; 54476888252Smrg esac 54576888252Smrg done 54676888252Smrg 54776888252Smrg "$@" -E | 54876888252Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 54976888252Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 55076888252Smrg sed '$ s: \\$::' > "$tmpdepfile" 55176888252Smrg rm -f "$depfile" 55276888252Smrg echo "$object : \\" > "$depfile" 55376888252Smrg cat < "$tmpdepfile" >> "$depfile" 55476888252Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 55576888252Smrg rm -f "$tmpdepfile" 55676888252Smrg ;; 55776888252Smrg 55876888252Smrgmsvisualcpp) 55976888252Smrg # Important note: in order to support this mode, a compiler *must* 560d8556812Smrg # always write the preprocessed file to stdout. 56176888252Smrg "$@" || exit $? 562d8556812Smrg 563d8556812Smrg # Remove the call to Libtool. 564d8556812Smrg if test "$libtool" = yes; then 565d8556812Smrg while test "X$1" != 'X--mode=compile'; do 566d8556812Smrg shift 567d8556812Smrg done 568d8556812Smrg shift 569d8556812Smrg fi 570d8556812Smrg 57176888252Smrg IFS=" " 57276888252Smrg for arg 57376888252Smrg do 57476888252Smrg case "$arg" in 575d8556812Smrg -o) 576d8556812Smrg shift 577d8556812Smrg ;; 578d8556812Smrg $object) 579d8556812Smrg shift 580d8556812Smrg ;; 58176888252Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 58276888252Smrg set fnord "$@" 58376888252Smrg shift 58476888252Smrg shift 58576888252Smrg ;; 58676888252Smrg *) 58776888252Smrg set fnord "$@" "$arg" 58876888252Smrg shift 58976888252Smrg shift 59076888252Smrg ;; 59176888252Smrg esac 59276888252Smrg done 593d8556812Smrg "$@" -E 2>/dev/null | 594d8556812Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 59576888252Smrg rm -f "$depfile" 59676888252Smrg echo "$object : \\" > "$depfile" 597d8556812Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 59876888252Smrg echo " " >> "$depfile" 599d8556812Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 60076888252Smrg rm -f "$tmpdepfile" 60176888252Smrg ;; 60276888252Smrg 603d8556812Smrgmsvcmsys) 604d8556812Smrg # This case exists only to let depend.m4 do its work. It works by 605d8556812Smrg # looking at the text of this script. This case will never be run, 606d8556812Smrg # since it is checked for above. 607d8556812Smrg exit 1 608d8556812Smrg ;; 609d8556812Smrg 61076888252Smrgnone) 61176888252Smrg exec "$@" 61276888252Smrg ;; 61376888252Smrg 61476888252Smrg*) 61576888252Smrg echo "Unknown depmode $depmode" 1>&2 61676888252Smrg exit 1 61776888252Smrg ;; 61876888252Smrgesac 61976888252Smrg 62076888252Smrgexit 0 62176888252Smrg 62276888252Smrg# Local Variables: 62376888252Smrg# mode: shell-script 62476888252Smrg# sh-indentation: 2 62576888252Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 62676888252Smrg# time-stamp-start: "scriptversion=" 62776888252Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 628d8556812Smrg# time-stamp-time-zone: "UTC" 629d8556812Smrg# time-stamp-end: "; # UTC" 63076888252Smrg# End: 631