depcomp revision 1473d951
1ab47cfaaSmrg#! /bin/sh 2ab47cfaaSmrg# depcomp - compile a program generating dependencies as side-effects 3ab47cfaaSmrg 41473d951Smrgscriptversion=2007-03-29.01 5ab47cfaaSmrg 61473d951Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software 78697ee19Smrg# Foundation, Inc. 8ab47cfaaSmrg 9ab47cfaaSmrg# This program is free software; you can redistribute it and/or modify 10ab47cfaaSmrg# it under the terms of the GNU General Public License as published by 11ab47cfaaSmrg# the Free Software Foundation; either version 2, or (at your option) 12ab47cfaaSmrg# any later version. 13ab47cfaaSmrg 14ab47cfaaSmrg# This program is distributed in the hope that it will be useful, 15ab47cfaaSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16ab47cfaaSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17ab47cfaaSmrg# GNU General Public License for more details. 18ab47cfaaSmrg 19ab47cfaaSmrg# You should have received a copy of the GNU General Public License 20ab47cfaaSmrg# along with this program; if not, write to the Free Software 21ab47cfaaSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22ab47cfaaSmrg# 02110-1301, USA. 23ab47cfaaSmrg 24ab47cfaaSmrg# As a special exception to the GNU General Public License, if you 25ab47cfaaSmrg# distribute this file as part of a program that contains a 26ab47cfaaSmrg# configuration script generated by Autoconf, you may include it under 27ab47cfaaSmrg# the same distribution terms that you use for the rest of that program. 28ab47cfaaSmrg 29ab47cfaaSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 30ab47cfaaSmrg 31ab47cfaaSmrgcase $1 in 32ab47cfaaSmrg '') 33ab47cfaaSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 34ab47cfaaSmrg exit 1; 35ab47cfaaSmrg ;; 36ab47cfaaSmrg -h | --h*) 37ab47cfaaSmrg cat <<\EOF 38ab47cfaaSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 39ab47cfaaSmrg 40ab47cfaaSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 41ab47cfaaSmrgas side-effects. 42ab47cfaaSmrg 43ab47cfaaSmrgEnvironment variables: 44ab47cfaaSmrg depmode Dependency tracking mode. 45ab47cfaaSmrg source Source file read by `PROGRAMS ARGS'. 46ab47cfaaSmrg object Object file output by `PROGRAMS ARGS'. 47ab47cfaaSmrg DEPDIR directory where to store dependencies. 48ab47cfaaSmrg depfile Dependency file to output. 49ab47cfaaSmrg tmpdepfile Temporary file to use when outputing dependencies. 50ab47cfaaSmrg libtool Whether libtool is used (yes/no). 51ab47cfaaSmrg 52ab47cfaaSmrgReport bugs to <bug-automake@gnu.org>. 53ab47cfaaSmrgEOF 54ab47cfaaSmrg exit $? 55ab47cfaaSmrg ;; 56ab47cfaaSmrg -v | --v*) 57ab47cfaaSmrg echo "depcomp $scriptversion" 58ab47cfaaSmrg exit $? 59ab47cfaaSmrg ;; 60ab47cfaaSmrgesac 61ab47cfaaSmrg 62ab47cfaaSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 63ab47cfaaSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 64ab47cfaaSmrg exit 1 65ab47cfaaSmrgfi 66ab47cfaaSmrg 67ab47cfaaSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 68ab47cfaaSmrgdepfile=${depfile-`echo "$object" | 69ab47cfaaSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 70ab47cfaaSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 71ab47cfaaSmrg 72ab47cfaaSmrgrm -f "$tmpdepfile" 73ab47cfaaSmrg 74ab47cfaaSmrg# Some modes work just like other modes, but use different flags. We 75ab47cfaaSmrg# parameterize here, but still list the modes in the big case below, 76ab47cfaaSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 77ab47cfaaSmrg# here, because this file can only contain one case statement. 78ab47cfaaSmrgif test "$depmode" = hp; then 79ab47cfaaSmrg # HP compiler uses -M and no extra arg. 80ab47cfaaSmrg gccflag=-M 81ab47cfaaSmrg depmode=gcc 82ab47cfaaSmrgfi 83ab47cfaaSmrg 84ab47cfaaSmrgif test "$depmode" = dashXmstdout; then 85ab47cfaaSmrg # This is just like dashmstdout with a different argument. 86ab47cfaaSmrg dashmflag=-xM 87ab47cfaaSmrg depmode=dashmstdout 88ab47cfaaSmrgfi 89ab47cfaaSmrg 90ab47cfaaSmrgcase "$depmode" in 91ab47cfaaSmrggcc3) 92ab47cfaaSmrg## gcc 3 implements dependency tracking that does exactly what 93ab47cfaaSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 94ab47cfaaSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 958697ee19Smrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 968697ee19Smrg## the command line argument order; so add the flags where they 978697ee19Smrg## appear in depend2.am. Note that the slowdown incurred here 988697ee19Smrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 998697ee19Smrg for arg 1008697ee19Smrg do 1018697ee19Smrg case $arg in 1028697ee19Smrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1038697ee19Smrg *) set fnord "$@" "$arg" ;; 1048697ee19Smrg esac 1058697ee19Smrg shift # fnord 1068697ee19Smrg shift # $arg 1078697ee19Smrg done 1088697ee19Smrg "$@" 109ab47cfaaSmrg stat=$? 110ab47cfaaSmrg if test $stat -eq 0; then : 111ab47cfaaSmrg else 112ab47cfaaSmrg rm -f "$tmpdepfile" 113ab47cfaaSmrg exit $stat 114ab47cfaaSmrg fi 115ab47cfaaSmrg mv "$tmpdepfile" "$depfile" 116ab47cfaaSmrg ;; 117ab47cfaaSmrg 118ab47cfaaSmrggcc) 119ab47cfaaSmrg## There are various ways to get dependency output from gcc. Here's 120ab47cfaaSmrg## why we pick this rather obscure method: 121ab47cfaaSmrg## - Don't want to use -MD because we'd like the dependencies to end 122ab47cfaaSmrg## up in a subdir. Having to rename by hand is ugly. 123ab47cfaaSmrg## (We might end up doing this anyway to support other compilers.) 124ab47cfaaSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 125ab47cfaaSmrg## -MM, not -M (despite what the docs say). 126ab47cfaaSmrg## - Using -M directly means running the compiler twice (even worse 127ab47cfaaSmrg## than renaming). 128ab47cfaaSmrg if test -z "$gccflag"; then 129ab47cfaaSmrg gccflag=-MD, 130ab47cfaaSmrg fi 131ab47cfaaSmrg "$@" -Wp,"$gccflag$tmpdepfile" 132ab47cfaaSmrg stat=$? 133ab47cfaaSmrg if test $stat -eq 0; then : 134ab47cfaaSmrg else 135ab47cfaaSmrg rm -f "$tmpdepfile" 136ab47cfaaSmrg exit $stat 137ab47cfaaSmrg fi 138ab47cfaaSmrg rm -f "$depfile" 139ab47cfaaSmrg echo "$object : \\" > "$depfile" 140ab47cfaaSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 141ab47cfaaSmrg## The second -e expression handles DOS-style file names with drive letters. 142ab47cfaaSmrg sed -e 's/^[^:]*: / /' \ 143ab47cfaaSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 144ab47cfaaSmrg## This next piece of magic avoids the `deleted header file' problem. 145ab47cfaaSmrg## The problem is that when a header file which appears in a .P file 146ab47cfaaSmrg## is deleted, the dependency causes make to die (because there is 147ab47cfaaSmrg## typically no way to rebuild the header). We avoid this by adding 148ab47cfaaSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 149ab47cfaaSmrg## this for us directly. 150ab47cfaaSmrg tr ' ' ' 151ab47cfaaSmrg' < "$tmpdepfile" | 152ab47cfaaSmrg## Some versions of gcc put a space before the `:'. On the theory 153ab47cfaaSmrg## that the space means something, we add a space to the output as 154ab47cfaaSmrg## well. 155ab47cfaaSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 156ab47cfaaSmrg## correctly. Breaking it into two sed invocations is a workaround. 157ab47cfaaSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 158ab47cfaaSmrg rm -f "$tmpdepfile" 159ab47cfaaSmrg ;; 160ab47cfaaSmrg 161ab47cfaaSmrghp) 162ab47cfaaSmrg # This case exists only to let depend.m4 do its work. It works by 163ab47cfaaSmrg # looking at the text of this script. This case will never be run, 164ab47cfaaSmrg # since it is checked for above. 165ab47cfaaSmrg exit 1 166ab47cfaaSmrg ;; 167ab47cfaaSmrg 168ab47cfaaSmrgsgi) 169ab47cfaaSmrg if test "$libtool" = yes; then 170ab47cfaaSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 171ab47cfaaSmrg else 172ab47cfaaSmrg "$@" -MDupdate "$tmpdepfile" 173ab47cfaaSmrg fi 174ab47cfaaSmrg stat=$? 175ab47cfaaSmrg if test $stat -eq 0; then : 176ab47cfaaSmrg else 177ab47cfaaSmrg rm -f "$tmpdepfile" 178ab47cfaaSmrg exit $stat 179ab47cfaaSmrg fi 180ab47cfaaSmrg rm -f "$depfile" 181ab47cfaaSmrg 182ab47cfaaSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 183ab47cfaaSmrg echo "$object : \\" > "$depfile" 184ab47cfaaSmrg 185ab47cfaaSmrg # Clip off the initial element (the dependent). Don't try to be 186ab47cfaaSmrg # clever and replace this with sed code, as IRIX sed won't handle 187ab47cfaaSmrg # lines with more than a fixed number of characters (4096 in 188ab47cfaaSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 189ab47cfaaSmrg # the IRIX cc adds comments like `#:fec' to the end of the 190ab47cfaaSmrg # dependency line. 191ab47cfaaSmrg tr ' ' ' 192ab47cfaaSmrg' < "$tmpdepfile" \ 193ab47cfaaSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 194ab47cfaaSmrg tr ' 195ab47cfaaSmrg' ' ' >> $depfile 196ab47cfaaSmrg echo >> $depfile 197ab47cfaaSmrg 198ab47cfaaSmrg # The second pass generates a dummy entry for each header file. 199ab47cfaaSmrg tr ' ' ' 200ab47cfaaSmrg' < "$tmpdepfile" \ 201ab47cfaaSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 202ab47cfaaSmrg >> $depfile 203ab47cfaaSmrg else 204ab47cfaaSmrg # The sourcefile does not contain any dependencies, so just 205ab47cfaaSmrg # store a dummy comment line, to avoid errors with the Makefile 206ab47cfaaSmrg # "include basename.Plo" scheme. 207ab47cfaaSmrg echo "#dummy" > "$depfile" 208ab47cfaaSmrg fi 209ab47cfaaSmrg rm -f "$tmpdepfile" 210ab47cfaaSmrg ;; 211ab47cfaaSmrg 212ab47cfaaSmrgaix) 213ab47cfaaSmrg # The C for AIX Compiler uses -M and outputs the dependencies 214ab47cfaaSmrg # in a .u file. In older versions, this file always lives in the 215ab47cfaaSmrg # current directory. Also, the AIX compiler puts `$object:' at the 216ab47cfaaSmrg # start of each line; $object doesn't have directory information. 217ab47cfaaSmrg # Version 6 uses the directory in both cases. 2181473d951Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2191473d951Smrg test "x$dir" = "x$object" && dir= 2201473d951Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 221ab47cfaaSmrg if test "$libtool" = yes; then 2221473d951Smrg tmpdepfile1=$dir$base.u 2231473d951Smrg tmpdepfile2=$base.u 2241473d951Smrg tmpdepfile3=$dir.libs/$base.u 225ab47cfaaSmrg "$@" -Wc,-M 226ab47cfaaSmrg else 2271473d951Smrg tmpdepfile1=$dir$base.u 2281473d951Smrg tmpdepfile2=$dir$base.u 2291473d951Smrg tmpdepfile3=$dir$base.u 230ab47cfaaSmrg "$@" -M 231ab47cfaaSmrg fi 232ab47cfaaSmrg stat=$? 233ab47cfaaSmrg 234ab47cfaaSmrg if test $stat -eq 0; then : 235ab47cfaaSmrg else 2361473d951Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 237ab47cfaaSmrg exit $stat 238ab47cfaaSmrg fi 239ab47cfaaSmrg 2401473d951Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2411473d951Smrg do 2421473d951Smrg test -f "$tmpdepfile" && break 2431473d951Smrg done 244ab47cfaaSmrg if test -f "$tmpdepfile"; then 245ab47cfaaSmrg # Each line is of the form `foo.o: dependent.h'. 246ab47cfaaSmrg # Do two passes, one to just change these to 247ab47cfaaSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2481473d951Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2491473d951Smrg # That's a tab and a space in the []. 2501473d951Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 251ab47cfaaSmrg else 252ab47cfaaSmrg # The sourcefile does not contain any dependencies, so just 253ab47cfaaSmrg # store a dummy comment line, to avoid errors with the Makefile 254ab47cfaaSmrg # "include basename.Plo" scheme. 255ab47cfaaSmrg echo "#dummy" > "$depfile" 256ab47cfaaSmrg fi 257ab47cfaaSmrg rm -f "$tmpdepfile" 258ab47cfaaSmrg ;; 259ab47cfaaSmrg 260ab47cfaaSmrgicc) 261ab47cfaaSmrg # Intel's C compiler understands `-MD -MF file'. However on 262ab47cfaaSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 263ab47cfaaSmrg # ICC 7.0 will fill foo.d with something like 264ab47cfaaSmrg # foo.o: sub/foo.c 265ab47cfaaSmrg # foo.o: sub/foo.h 266ab47cfaaSmrg # which is wrong. We want: 267ab47cfaaSmrg # sub/foo.o: sub/foo.c 268ab47cfaaSmrg # sub/foo.o: sub/foo.h 269ab47cfaaSmrg # sub/foo.c: 270ab47cfaaSmrg # sub/foo.h: 271ab47cfaaSmrg # ICC 7.1 will output 272ab47cfaaSmrg # foo.o: sub/foo.c sub/foo.h 273ab47cfaaSmrg # and will wrap long lines using \ : 274ab47cfaaSmrg # foo.o: sub/foo.c ... \ 275ab47cfaaSmrg # sub/foo.h ... \ 276ab47cfaaSmrg # ... 277ab47cfaaSmrg 278ab47cfaaSmrg "$@" -MD -MF "$tmpdepfile" 279ab47cfaaSmrg stat=$? 280ab47cfaaSmrg if test $stat -eq 0; then : 281ab47cfaaSmrg else 282ab47cfaaSmrg rm -f "$tmpdepfile" 283ab47cfaaSmrg exit $stat 284ab47cfaaSmrg fi 285ab47cfaaSmrg rm -f "$depfile" 286ab47cfaaSmrg # Each line is of the form `foo.o: dependent.h', 287ab47cfaaSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 288ab47cfaaSmrg # Do two passes, one to just change these to 289ab47cfaaSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 290ab47cfaaSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 291ab47cfaaSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 292ab47cfaaSmrg # correctly. Breaking it into two sed invocations is a workaround. 293ab47cfaaSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 294ab47cfaaSmrg sed -e 's/$/ :/' >> "$depfile" 295ab47cfaaSmrg rm -f "$tmpdepfile" 296ab47cfaaSmrg ;; 297ab47cfaaSmrg 2988697ee19Smrghp2) 2998697ee19Smrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3008697ee19Smrg # compilers, which have integrated preprocessors. The correct option 3018697ee19Smrg # to use with these is +Maked; it writes dependencies to a file named 3028697ee19Smrg # 'foo.d', which lands next to the object file, wherever that 3038697ee19Smrg # happens to be. 3048697ee19Smrg # Much of this is similar to the tru64 case; see comments there. 3058697ee19Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3068697ee19Smrg test "x$dir" = "x$object" && dir= 3078697ee19Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3088697ee19Smrg if test "$libtool" = yes; then 3098697ee19Smrg tmpdepfile1=$dir$base.d 3108697ee19Smrg tmpdepfile2=$dir.libs/$base.d 3118697ee19Smrg "$@" -Wc,+Maked 3128697ee19Smrg else 3138697ee19Smrg tmpdepfile1=$dir$base.d 3148697ee19Smrg tmpdepfile2=$dir$base.d 3158697ee19Smrg "$@" +Maked 3168697ee19Smrg fi 3178697ee19Smrg stat=$? 3188697ee19Smrg if test $stat -eq 0; then : 3198697ee19Smrg else 3208697ee19Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3218697ee19Smrg exit $stat 3228697ee19Smrg fi 3238697ee19Smrg 3248697ee19Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3258697ee19Smrg do 3268697ee19Smrg test -f "$tmpdepfile" && break 3278697ee19Smrg done 3288697ee19Smrg if test -f "$tmpdepfile"; then 3298697ee19Smrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3308697ee19Smrg # Add `dependent.h:' lines. 3318697ee19Smrg sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" 3328697ee19Smrg else 3338697ee19Smrg echo "#dummy" > "$depfile" 3348697ee19Smrg fi 3358697ee19Smrg rm -f "$tmpdepfile" "$tmpdepfile2" 3368697ee19Smrg ;; 3378697ee19Smrg 338ab47cfaaSmrgtru64) 339ab47cfaaSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 340ab47cfaaSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 341ab47cfaaSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 342ab47cfaaSmrg # dependencies in `foo.d' instead, so we check for that too. 343ab47cfaaSmrg # Subdirectories are respected. 344ab47cfaaSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 345ab47cfaaSmrg test "x$dir" = "x$object" && dir= 346ab47cfaaSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 347ab47cfaaSmrg 348ab47cfaaSmrg if test "$libtool" = yes; then 349ab47cfaaSmrg # With Tru64 cc, shared objects can also be used to make a 3508697ee19Smrg # static library. This mechanism is used in libtool 1.4 series to 351ab47cfaaSmrg # handle both shared and static libraries in a single compilation. 352ab47cfaaSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 353ab47cfaaSmrg # 354ab47cfaaSmrg # With libtool 1.5 this exception was removed, and libtool now 355ab47cfaaSmrg # generates 2 separate objects for the 2 libraries. These two 3568697ee19Smrg # compilations output dependencies in $dir.libs/$base.o.d and 357ab47cfaaSmrg # in $dir$base.o.d. We have to check for both files, because 358ab47cfaaSmrg # one of the two compilations can be disabled. We should prefer 359ab47cfaaSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 360ab47cfaaSmrg # automatically cleaned when .libs/ is deleted, while ignoring 361ab47cfaaSmrg # the former would cause a distcleancheck panic. 362ab47cfaaSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 363ab47cfaaSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 364ab47cfaaSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 365ab47cfaaSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 366ab47cfaaSmrg "$@" -Wc,-MD 367ab47cfaaSmrg else 368ab47cfaaSmrg tmpdepfile1=$dir$base.o.d 369ab47cfaaSmrg tmpdepfile2=$dir$base.d 370ab47cfaaSmrg tmpdepfile3=$dir$base.d 371ab47cfaaSmrg tmpdepfile4=$dir$base.d 372ab47cfaaSmrg "$@" -MD 373ab47cfaaSmrg fi 374ab47cfaaSmrg 375ab47cfaaSmrg stat=$? 376ab47cfaaSmrg if test $stat -eq 0; then : 377ab47cfaaSmrg else 378ab47cfaaSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 379ab47cfaaSmrg exit $stat 380ab47cfaaSmrg fi 381ab47cfaaSmrg 382ab47cfaaSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 383ab47cfaaSmrg do 384ab47cfaaSmrg test -f "$tmpdepfile" && break 385ab47cfaaSmrg done 386ab47cfaaSmrg if test -f "$tmpdepfile"; then 387ab47cfaaSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 388ab47cfaaSmrg # That's a tab and a space in the []. 389ab47cfaaSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 390ab47cfaaSmrg else 391ab47cfaaSmrg echo "#dummy" > "$depfile" 392ab47cfaaSmrg fi 393ab47cfaaSmrg rm -f "$tmpdepfile" 394ab47cfaaSmrg ;; 395ab47cfaaSmrg 396ab47cfaaSmrg#nosideeffect) 397ab47cfaaSmrg # This comment above is used by automake to tell side-effect 398ab47cfaaSmrg # dependency tracking mechanisms from slower ones. 399ab47cfaaSmrg 400ab47cfaaSmrgdashmstdout) 401ab47cfaaSmrg # Important note: in order to support this mode, a compiler *must* 402ab47cfaaSmrg # always write the preprocessed file to stdout, regardless of -o. 403ab47cfaaSmrg "$@" || exit $? 404ab47cfaaSmrg 405ab47cfaaSmrg # Remove the call to Libtool. 406ab47cfaaSmrg if test "$libtool" = yes; then 407ab47cfaaSmrg while test $1 != '--mode=compile'; do 408ab47cfaaSmrg shift 409ab47cfaaSmrg done 410ab47cfaaSmrg shift 411ab47cfaaSmrg fi 412ab47cfaaSmrg 413ab47cfaaSmrg # Remove `-o $object'. 414ab47cfaaSmrg IFS=" " 415ab47cfaaSmrg for arg 416ab47cfaaSmrg do 417ab47cfaaSmrg case $arg in 418ab47cfaaSmrg -o) 419ab47cfaaSmrg shift 420ab47cfaaSmrg ;; 421ab47cfaaSmrg $object) 422ab47cfaaSmrg shift 423ab47cfaaSmrg ;; 424ab47cfaaSmrg *) 425ab47cfaaSmrg set fnord "$@" "$arg" 426ab47cfaaSmrg shift # fnord 427ab47cfaaSmrg shift # $arg 428ab47cfaaSmrg ;; 429ab47cfaaSmrg esac 430ab47cfaaSmrg done 431ab47cfaaSmrg 432ab47cfaaSmrg test -z "$dashmflag" && dashmflag=-M 433ab47cfaaSmrg # Require at least two characters before searching for `:' 434ab47cfaaSmrg # in the target name. This is to cope with DOS-style filenames: 435ab47cfaaSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 436ab47cfaaSmrg "$@" $dashmflag | 437ab47cfaaSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 438ab47cfaaSmrg rm -f "$depfile" 439ab47cfaaSmrg cat < "$tmpdepfile" > "$depfile" 440ab47cfaaSmrg tr ' ' ' 441ab47cfaaSmrg' < "$tmpdepfile" | \ 442ab47cfaaSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 443ab47cfaaSmrg## correctly. Breaking it into two sed invocations is a workaround. 444ab47cfaaSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 445ab47cfaaSmrg rm -f "$tmpdepfile" 446ab47cfaaSmrg ;; 447ab47cfaaSmrg 448ab47cfaaSmrgdashXmstdout) 449ab47cfaaSmrg # This case only exists to satisfy depend.m4. It is never actually 450ab47cfaaSmrg # run, as this mode is specially recognized in the preamble. 451ab47cfaaSmrg exit 1 452ab47cfaaSmrg ;; 453ab47cfaaSmrg 454ab47cfaaSmrgmakedepend) 455ab47cfaaSmrg "$@" || exit $? 456ab47cfaaSmrg # Remove any Libtool call 457ab47cfaaSmrg if test "$libtool" = yes; then 458ab47cfaaSmrg while test $1 != '--mode=compile'; do 459ab47cfaaSmrg shift 460ab47cfaaSmrg done 461ab47cfaaSmrg shift 462ab47cfaaSmrg fi 463ab47cfaaSmrg # X makedepend 464ab47cfaaSmrg shift 465ab47cfaaSmrg cleared=no 466ab47cfaaSmrg for arg in "$@"; do 467ab47cfaaSmrg case $cleared in 468ab47cfaaSmrg no) 469ab47cfaaSmrg set ""; shift 470ab47cfaaSmrg cleared=yes ;; 471ab47cfaaSmrg esac 472ab47cfaaSmrg case "$arg" in 473ab47cfaaSmrg -D*|-I*) 474ab47cfaaSmrg set fnord "$@" "$arg"; shift ;; 475ab47cfaaSmrg # Strip any option that makedepend may not understand. Remove 476ab47cfaaSmrg # the object too, otherwise makedepend will parse it as a source file. 477ab47cfaaSmrg -*|$object) 478ab47cfaaSmrg ;; 479ab47cfaaSmrg *) 480ab47cfaaSmrg set fnord "$@" "$arg"; shift ;; 481ab47cfaaSmrg esac 482ab47cfaaSmrg done 483ab47cfaaSmrg obj_suffix="`echo $object | sed 's/^.*\././'`" 484ab47cfaaSmrg touch "$tmpdepfile" 485ab47cfaaSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 486ab47cfaaSmrg rm -f "$depfile" 487ab47cfaaSmrg cat < "$tmpdepfile" > "$depfile" 488ab47cfaaSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 489ab47cfaaSmrg' | \ 490ab47cfaaSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 491ab47cfaaSmrg## correctly. Breaking it into two sed invocations is a workaround. 492ab47cfaaSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 493ab47cfaaSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 494ab47cfaaSmrg ;; 495ab47cfaaSmrg 496ab47cfaaSmrgcpp) 497ab47cfaaSmrg # Important note: in order to support this mode, a compiler *must* 498ab47cfaaSmrg # always write the preprocessed file to stdout. 499ab47cfaaSmrg "$@" || exit $? 500ab47cfaaSmrg 501ab47cfaaSmrg # Remove the call to Libtool. 502ab47cfaaSmrg if test "$libtool" = yes; then 503ab47cfaaSmrg while test $1 != '--mode=compile'; do 504ab47cfaaSmrg shift 505ab47cfaaSmrg done 506ab47cfaaSmrg shift 507ab47cfaaSmrg fi 508ab47cfaaSmrg 509ab47cfaaSmrg # Remove `-o $object'. 510ab47cfaaSmrg IFS=" " 511ab47cfaaSmrg for arg 512ab47cfaaSmrg do 513ab47cfaaSmrg case $arg in 514ab47cfaaSmrg -o) 515ab47cfaaSmrg shift 516ab47cfaaSmrg ;; 517ab47cfaaSmrg $object) 518ab47cfaaSmrg shift 519ab47cfaaSmrg ;; 520ab47cfaaSmrg *) 521ab47cfaaSmrg set fnord "$@" "$arg" 522ab47cfaaSmrg shift # fnord 523ab47cfaaSmrg shift # $arg 524ab47cfaaSmrg ;; 525ab47cfaaSmrg esac 526ab47cfaaSmrg done 527ab47cfaaSmrg 528ab47cfaaSmrg "$@" -E | 529ab47cfaaSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 530ab47cfaaSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 531ab47cfaaSmrg sed '$ s: \\$::' > "$tmpdepfile" 532ab47cfaaSmrg rm -f "$depfile" 533ab47cfaaSmrg echo "$object : \\" > "$depfile" 534ab47cfaaSmrg cat < "$tmpdepfile" >> "$depfile" 535ab47cfaaSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 536ab47cfaaSmrg rm -f "$tmpdepfile" 537ab47cfaaSmrg ;; 538ab47cfaaSmrg 539ab47cfaaSmrgmsvisualcpp) 540ab47cfaaSmrg # Important note: in order to support this mode, a compiler *must* 541ab47cfaaSmrg # always write the preprocessed file to stdout, regardless of -o, 542ab47cfaaSmrg # because we must use -o when running libtool. 543ab47cfaaSmrg "$@" || exit $? 544ab47cfaaSmrg IFS=" " 545ab47cfaaSmrg for arg 546ab47cfaaSmrg do 547ab47cfaaSmrg case "$arg" in 548ab47cfaaSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 549ab47cfaaSmrg set fnord "$@" 550ab47cfaaSmrg shift 551ab47cfaaSmrg shift 552ab47cfaaSmrg ;; 553ab47cfaaSmrg *) 554ab47cfaaSmrg set fnord "$@" "$arg" 555ab47cfaaSmrg shift 556ab47cfaaSmrg shift 557ab47cfaaSmrg ;; 558ab47cfaaSmrg esac 559ab47cfaaSmrg done 560ab47cfaaSmrg "$@" -E | 561ab47cfaaSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 562ab47cfaaSmrg rm -f "$depfile" 563ab47cfaaSmrg echo "$object : \\" > "$depfile" 564ab47cfaaSmrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 565ab47cfaaSmrg echo " " >> "$depfile" 566ab47cfaaSmrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 567ab47cfaaSmrg rm -f "$tmpdepfile" 568ab47cfaaSmrg ;; 569ab47cfaaSmrg 570ab47cfaaSmrgnone) 571ab47cfaaSmrg exec "$@" 572ab47cfaaSmrg ;; 573ab47cfaaSmrg 574ab47cfaaSmrg*) 575ab47cfaaSmrg echo "Unknown depmode $depmode" 1>&2 576ab47cfaaSmrg exit 1 577ab47cfaaSmrg ;; 578ab47cfaaSmrgesac 579ab47cfaaSmrg 580ab47cfaaSmrgexit 0 581ab47cfaaSmrg 582ab47cfaaSmrg# Local Variables: 583ab47cfaaSmrg# mode: shell-script 584ab47cfaaSmrg# sh-indentation: 2 585ab47cfaaSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 586ab47cfaaSmrg# time-stamp-start: "scriptversion=" 587ab47cfaaSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 588ab47cfaaSmrg# time-stamp-end: "$" 589ab47cfaaSmrg# End: 590