depcomp revision 2f39173d
1209ff23fSmrg#! /bin/sh 2209ff23fSmrg# depcomp - compile a program generating dependencies as side-effects 3209ff23fSmrg 42f39173dSmrgscriptversion=2009-04-28.21; # UTC 5209ff23fSmrg 62f39173dSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 72f39173dSmrg# Software Foundation, Inc. 8209ff23fSmrg 9209ff23fSmrg# This program is free software; you can redistribute it and/or modify 10209ff23fSmrg# it under the terms of the GNU General Public License as published by 11209ff23fSmrg# the Free Software Foundation; either version 2, or (at your option) 12209ff23fSmrg# any later version. 13209ff23fSmrg 14209ff23fSmrg# This program is distributed in the hope that it will be useful, 15209ff23fSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16209ff23fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17209ff23fSmrg# GNU General Public License for more details. 18209ff23fSmrg 19209ff23fSmrg# You should have received a copy of the GNU General Public License 202f39173dSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21209ff23fSmrg 22209ff23fSmrg# As a special exception to the GNU General Public License, if you 23209ff23fSmrg# distribute this file as part of a program that contains a 24209ff23fSmrg# configuration script generated by Autoconf, you may include it under 25209ff23fSmrg# the same distribution terms that you use for the rest of that program. 26209ff23fSmrg 27209ff23fSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 28209ff23fSmrg 29209ff23fSmrgcase $1 in 30209ff23fSmrg '') 31209ff23fSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 32209ff23fSmrg exit 1; 33209ff23fSmrg ;; 34209ff23fSmrg -h | --h*) 35209ff23fSmrg cat <<\EOF 36209ff23fSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 37209ff23fSmrg 38209ff23fSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 39209ff23fSmrgas side-effects. 40209ff23fSmrg 41209ff23fSmrgEnvironment variables: 42209ff23fSmrg depmode Dependency tracking mode. 43209ff23fSmrg source Source file read by `PROGRAMS ARGS'. 44209ff23fSmrg object Object file output by `PROGRAMS ARGS'. 45209ff23fSmrg DEPDIR directory where to store dependencies. 46209ff23fSmrg depfile Dependency file to output. 47209ff23fSmrg tmpdepfile Temporary file to use when outputing dependencies. 48209ff23fSmrg libtool Whether libtool is used (yes/no). 49209ff23fSmrg 50209ff23fSmrgReport bugs to <bug-automake@gnu.org>. 51209ff23fSmrgEOF 52209ff23fSmrg exit $? 53209ff23fSmrg ;; 54209ff23fSmrg -v | --v*) 55209ff23fSmrg echo "depcomp $scriptversion" 56209ff23fSmrg exit $? 57209ff23fSmrg ;; 58209ff23fSmrgesac 59209ff23fSmrg 60209ff23fSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 61209ff23fSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 62209ff23fSmrg exit 1 63209ff23fSmrgfi 64209ff23fSmrg 65209ff23fSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 66209ff23fSmrgdepfile=${depfile-`echo "$object" | 67209ff23fSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 68209ff23fSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 69209ff23fSmrg 70209ff23fSmrgrm -f "$tmpdepfile" 71209ff23fSmrg 72209ff23fSmrg# Some modes work just like other modes, but use different flags. We 73209ff23fSmrg# parameterize here, but still list the modes in the big case below, 74209ff23fSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 75209ff23fSmrg# here, because this file can only contain one case statement. 76209ff23fSmrgif test "$depmode" = hp; then 77209ff23fSmrg # HP compiler uses -M and no extra arg. 78209ff23fSmrg gccflag=-M 79209ff23fSmrg depmode=gcc 80209ff23fSmrgfi 81209ff23fSmrg 82209ff23fSmrgif test "$depmode" = dashXmstdout; then 83209ff23fSmrg # This is just like dashmstdout with a different argument. 84209ff23fSmrg dashmflag=-xM 85209ff23fSmrg depmode=dashmstdout 86209ff23fSmrgfi 87209ff23fSmrg 882f39173dSmrgcygpath_u="cygpath -u -f -" 892f39173dSmrgif test "$depmode" = msvcmsys; then 902f39173dSmrg # This is just like msvisualcpp but w/o cygpath translation. 912f39173dSmrg # Just convert the backslash-escaped backslashes to single forward 922f39173dSmrg # slashes to satisfy depend.m4 932f39173dSmrg cygpath_u="sed s,\\\\\\\\,/,g" 942f39173dSmrg depmode=msvisualcpp 952f39173dSmrgfi 962f39173dSmrg 97209ff23fSmrgcase "$depmode" in 98209ff23fSmrggcc3) 99209ff23fSmrg## gcc 3 implements dependency tracking that does exactly what 100209ff23fSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 101209ff23fSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 102209ff23fSmrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 103209ff23fSmrg## the command line argument order; so add the flags where they 104209ff23fSmrg## appear in depend2.am. Note that the slowdown incurred here 105209ff23fSmrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 106209ff23fSmrg for arg 107209ff23fSmrg do 108209ff23fSmrg case $arg in 109209ff23fSmrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 110209ff23fSmrg *) set fnord "$@" "$arg" ;; 111209ff23fSmrg esac 112209ff23fSmrg shift # fnord 113209ff23fSmrg shift # $arg 114209ff23fSmrg done 115209ff23fSmrg "$@" 116209ff23fSmrg stat=$? 117209ff23fSmrg if test $stat -eq 0; then : 118209ff23fSmrg else 119209ff23fSmrg rm -f "$tmpdepfile" 120209ff23fSmrg exit $stat 121209ff23fSmrg fi 122209ff23fSmrg mv "$tmpdepfile" "$depfile" 123209ff23fSmrg ;; 124209ff23fSmrg 125209ff23fSmrggcc) 126209ff23fSmrg## There are various ways to get dependency output from gcc. Here's 127209ff23fSmrg## why we pick this rather obscure method: 128209ff23fSmrg## - Don't want to use -MD because we'd like the dependencies to end 129209ff23fSmrg## up in a subdir. Having to rename by hand is ugly. 130209ff23fSmrg## (We might end up doing this anyway to support other compilers.) 131209ff23fSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 132209ff23fSmrg## -MM, not -M (despite what the docs say). 133209ff23fSmrg## - Using -M directly means running the compiler twice (even worse 134209ff23fSmrg## than renaming). 135209ff23fSmrg if test -z "$gccflag"; then 136209ff23fSmrg gccflag=-MD, 137209ff23fSmrg fi 138209ff23fSmrg "$@" -Wp,"$gccflag$tmpdepfile" 139209ff23fSmrg stat=$? 140209ff23fSmrg if test $stat -eq 0; then : 141209ff23fSmrg else 142209ff23fSmrg rm -f "$tmpdepfile" 143209ff23fSmrg exit $stat 144209ff23fSmrg fi 145209ff23fSmrg rm -f "$depfile" 146209ff23fSmrg echo "$object : \\" > "$depfile" 147209ff23fSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 148209ff23fSmrg## The second -e expression handles DOS-style file names with drive letters. 149209ff23fSmrg sed -e 's/^[^:]*: / /' \ 150209ff23fSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 151209ff23fSmrg## This next piece of magic avoids the `deleted header file' problem. 152209ff23fSmrg## The problem is that when a header file which appears in a .P file 153209ff23fSmrg## is deleted, the dependency causes make to die (because there is 154209ff23fSmrg## typically no way to rebuild the header). We avoid this by adding 155209ff23fSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 156209ff23fSmrg## this for us directly. 157209ff23fSmrg tr ' ' ' 158209ff23fSmrg' < "$tmpdepfile" | 159209ff23fSmrg## Some versions of gcc put a space before the `:'. On the theory 160209ff23fSmrg## that the space means something, we add a space to the output as 161209ff23fSmrg## well. 162209ff23fSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 163209ff23fSmrg## correctly. Breaking it into two sed invocations is a workaround. 164209ff23fSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 165209ff23fSmrg rm -f "$tmpdepfile" 166209ff23fSmrg ;; 167209ff23fSmrg 168209ff23fSmrghp) 169209ff23fSmrg # This case exists only to let depend.m4 do its work. It works by 170209ff23fSmrg # looking at the text of this script. This case will never be run, 171209ff23fSmrg # since it is checked for above. 172209ff23fSmrg exit 1 173209ff23fSmrg ;; 174209ff23fSmrg 175209ff23fSmrgsgi) 176209ff23fSmrg if test "$libtool" = yes; then 177209ff23fSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 178209ff23fSmrg else 179209ff23fSmrg "$@" -MDupdate "$tmpdepfile" 180209ff23fSmrg fi 181209ff23fSmrg stat=$? 182209ff23fSmrg if test $stat -eq 0; then : 183209ff23fSmrg else 184209ff23fSmrg rm -f "$tmpdepfile" 185209ff23fSmrg exit $stat 186209ff23fSmrg fi 187209ff23fSmrg rm -f "$depfile" 188209ff23fSmrg 189209ff23fSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 190209ff23fSmrg echo "$object : \\" > "$depfile" 191209ff23fSmrg 192209ff23fSmrg # Clip off the initial element (the dependent). Don't try to be 193209ff23fSmrg # clever and replace this with sed code, as IRIX sed won't handle 194209ff23fSmrg # lines with more than a fixed number of characters (4096 in 195209ff23fSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 196209ff23fSmrg # the IRIX cc adds comments like `#:fec' to the end of the 197209ff23fSmrg # dependency line. 198209ff23fSmrg tr ' ' ' 199209ff23fSmrg' < "$tmpdepfile" \ 200209ff23fSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 201209ff23fSmrg tr ' 2022f39173dSmrg' ' ' >> "$depfile" 2032f39173dSmrg echo >> "$depfile" 204209ff23fSmrg 205209ff23fSmrg # The second pass generates a dummy entry for each header file. 206209ff23fSmrg tr ' ' ' 207209ff23fSmrg' < "$tmpdepfile" \ 208209ff23fSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2092f39173dSmrg >> "$depfile" 210209ff23fSmrg else 211209ff23fSmrg # The sourcefile does not contain any dependencies, so just 212209ff23fSmrg # store a dummy comment line, to avoid errors with the Makefile 213209ff23fSmrg # "include basename.Plo" scheme. 214209ff23fSmrg echo "#dummy" > "$depfile" 215209ff23fSmrg fi 216209ff23fSmrg rm -f "$tmpdepfile" 217209ff23fSmrg ;; 218209ff23fSmrg 219209ff23fSmrgaix) 220209ff23fSmrg # The C for AIX Compiler uses -M and outputs the dependencies 221209ff23fSmrg # in a .u file. In older versions, this file always lives in the 222209ff23fSmrg # current directory. Also, the AIX compiler puts `$object:' at the 223209ff23fSmrg # start of each line; $object doesn't have directory information. 224209ff23fSmrg # Version 6 uses the directory in both cases. 225c503f109Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 226c503f109Smrg test "x$dir" = "x$object" && dir= 227c503f109Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 228209ff23fSmrg if test "$libtool" = yes; then 229c503f109Smrg tmpdepfile1=$dir$base.u 230c503f109Smrg tmpdepfile2=$base.u 231c503f109Smrg tmpdepfile3=$dir.libs/$base.u 232209ff23fSmrg "$@" -Wc,-M 233209ff23fSmrg else 234c503f109Smrg tmpdepfile1=$dir$base.u 235c503f109Smrg tmpdepfile2=$dir$base.u 236c503f109Smrg tmpdepfile3=$dir$base.u 237209ff23fSmrg "$@" -M 238209ff23fSmrg fi 239209ff23fSmrg stat=$? 240209ff23fSmrg 241209ff23fSmrg if test $stat -eq 0; then : 242209ff23fSmrg else 243c503f109Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 244209ff23fSmrg exit $stat 245209ff23fSmrg fi 246209ff23fSmrg 247c503f109Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 248c503f109Smrg do 249c503f109Smrg test -f "$tmpdepfile" && break 250c503f109Smrg done 251209ff23fSmrg if test -f "$tmpdepfile"; then 252209ff23fSmrg # Each line is of the form `foo.o: dependent.h'. 253209ff23fSmrg # Do two passes, one to just change these to 254209ff23fSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 255c503f109Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 256c503f109Smrg # That's a tab and a space in the []. 257c503f109Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 258209ff23fSmrg else 259209ff23fSmrg # The sourcefile does not contain any dependencies, so just 260209ff23fSmrg # store a dummy comment line, to avoid errors with the Makefile 261209ff23fSmrg # "include basename.Plo" scheme. 262209ff23fSmrg echo "#dummy" > "$depfile" 263209ff23fSmrg fi 264209ff23fSmrg rm -f "$tmpdepfile" 265209ff23fSmrg ;; 266209ff23fSmrg 267209ff23fSmrgicc) 268209ff23fSmrg # Intel's C compiler understands `-MD -MF file'. However on 269209ff23fSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 270209ff23fSmrg # ICC 7.0 will fill foo.d with something like 271209ff23fSmrg # foo.o: sub/foo.c 272209ff23fSmrg # foo.o: sub/foo.h 273209ff23fSmrg # which is wrong. We want: 274209ff23fSmrg # sub/foo.o: sub/foo.c 275209ff23fSmrg # sub/foo.o: sub/foo.h 276209ff23fSmrg # sub/foo.c: 277209ff23fSmrg # sub/foo.h: 278209ff23fSmrg # ICC 7.1 will output 279209ff23fSmrg # foo.o: sub/foo.c sub/foo.h 280209ff23fSmrg # and will wrap long lines using \ : 281209ff23fSmrg # foo.o: sub/foo.c ... \ 282209ff23fSmrg # sub/foo.h ... \ 283209ff23fSmrg # ... 284209ff23fSmrg 285209ff23fSmrg "$@" -MD -MF "$tmpdepfile" 286209ff23fSmrg stat=$? 287209ff23fSmrg if test $stat -eq 0; then : 288209ff23fSmrg else 289209ff23fSmrg rm -f "$tmpdepfile" 290209ff23fSmrg exit $stat 291209ff23fSmrg fi 292209ff23fSmrg rm -f "$depfile" 293209ff23fSmrg # Each line is of the form `foo.o: dependent.h', 294209ff23fSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 295209ff23fSmrg # Do two passes, one to just change these to 296209ff23fSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 297209ff23fSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 298209ff23fSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 299209ff23fSmrg # correctly. Breaking it into two sed invocations is a workaround. 300209ff23fSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 301209ff23fSmrg sed -e 's/$/ :/' >> "$depfile" 302209ff23fSmrg rm -f "$tmpdepfile" 303209ff23fSmrg ;; 304209ff23fSmrg 305209ff23fSmrghp2) 306209ff23fSmrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 307209ff23fSmrg # compilers, which have integrated preprocessors. The correct option 308209ff23fSmrg # to use with these is +Maked; it writes dependencies to a file named 309209ff23fSmrg # 'foo.d', which lands next to the object file, wherever that 310209ff23fSmrg # happens to be. 311209ff23fSmrg # Much of this is similar to the tru64 case; see comments there. 312209ff23fSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 313209ff23fSmrg test "x$dir" = "x$object" && dir= 314209ff23fSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 315209ff23fSmrg if test "$libtool" = yes; then 316209ff23fSmrg tmpdepfile1=$dir$base.d 317209ff23fSmrg tmpdepfile2=$dir.libs/$base.d 318209ff23fSmrg "$@" -Wc,+Maked 319209ff23fSmrg else 320209ff23fSmrg tmpdepfile1=$dir$base.d 321209ff23fSmrg tmpdepfile2=$dir$base.d 322209ff23fSmrg "$@" +Maked 323209ff23fSmrg fi 324209ff23fSmrg stat=$? 325209ff23fSmrg if test $stat -eq 0; then : 326209ff23fSmrg else 327209ff23fSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" 328209ff23fSmrg exit $stat 329209ff23fSmrg fi 330209ff23fSmrg 331209ff23fSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 332209ff23fSmrg do 333209ff23fSmrg test -f "$tmpdepfile" && break 334209ff23fSmrg done 335209ff23fSmrg if test -f "$tmpdepfile"; then 336209ff23fSmrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 337209ff23fSmrg # Add `dependent.h:' lines. 3382f39173dSmrg sed -ne '2,${ 3392f39173dSmrg s/^ *// 3402f39173dSmrg s/ \\*$// 3412f39173dSmrg s/$/:/ 3422f39173dSmrg p 3432f39173dSmrg }' "$tmpdepfile" >> "$depfile" 344209ff23fSmrg else 345209ff23fSmrg echo "#dummy" > "$depfile" 346209ff23fSmrg fi 347209ff23fSmrg rm -f "$tmpdepfile" "$tmpdepfile2" 348209ff23fSmrg ;; 349209ff23fSmrg 350209ff23fSmrgtru64) 351209ff23fSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 352209ff23fSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 353209ff23fSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 354209ff23fSmrg # dependencies in `foo.d' instead, so we check for that too. 355209ff23fSmrg # Subdirectories are respected. 356209ff23fSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 357209ff23fSmrg test "x$dir" = "x$object" && dir= 358209ff23fSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 359209ff23fSmrg 360209ff23fSmrg if test "$libtool" = yes; then 361209ff23fSmrg # With Tru64 cc, shared objects can also be used to make a 362209ff23fSmrg # static library. This mechanism is used in libtool 1.4 series to 363209ff23fSmrg # handle both shared and static libraries in a single compilation. 364209ff23fSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 365209ff23fSmrg # 366209ff23fSmrg # With libtool 1.5 this exception was removed, and libtool now 367209ff23fSmrg # generates 2 separate objects for the 2 libraries. These two 368209ff23fSmrg # compilations output dependencies in $dir.libs/$base.o.d and 369209ff23fSmrg # in $dir$base.o.d. We have to check for both files, because 370209ff23fSmrg # one of the two compilations can be disabled. We should prefer 371209ff23fSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 372209ff23fSmrg # automatically cleaned when .libs/ is deleted, while ignoring 373209ff23fSmrg # the former would cause a distcleancheck panic. 374209ff23fSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 375209ff23fSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 376209ff23fSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 377209ff23fSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 378209ff23fSmrg "$@" -Wc,-MD 379209ff23fSmrg else 380209ff23fSmrg tmpdepfile1=$dir$base.o.d 381209ff23fSmrg tmpdepfile2=$dir$base.d 382209ff23fSmrg tmpdepfile3=$dir$base.d 383209ff23fSmrg tmpdepfile4=$dir$base.d 384209ff23fSmrg "$@" -MD 385209ff23fSmrg fi 386209ff23fSmrg 387209ff23fSmrg stat=$? 388209ff23fSmrg if test $stat -eq 0; then : 389209ff23fSmrg else 390209ff23fSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 391209ff23fSmrg exit $stat 392209ff23fSmrg fi 393209ff23fSmrg 394209ff23fSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 395209ff23fSmrg do 396209ff23fSmrg test -f "$tmpdepfile" && break 397209ff23fSmrg done 398209ff23fSmrg if test -f "$tmpdepfile"; then 399209ff23fSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 400209ff23fSmrg # That's a tab and a space in the []. 401209ff23fSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 402209ff23fSmrg else 403209ff23fSmrg echo "#dummy" > "$depfile" 404209ff23fSmrg fi 405209ff23fSmrg rm -f "$tmpdepfile" 406209ff23fSmrg ;; 407209ff23fSmrg 408209ff23fSmrg#nosideeffect) 409209ff23fSmrg # This comment above is used by automake to tell side-effect 410209ff23fSmrg # dependency tracking mechanisms from slower ones. 411209ff23fSmrg 412209ff23fSmrgdashmstdout) 413209ff23fSmrg # Important note: in order to support this mode, a compiler *must* 414209ff23fSmrg # always write the preprocessed file to stdout, regardless of -o. 415209ff23fSmrg "$@" || exit $? 416209ff23fSmrg 417209ff23fSmrg # Remove the call to Libtool. 418209ff23fSmrg if test "$libtool" = yes; then 4192f39173dSmrg while test "X$1" != 'X--mode=compile'; do 420209ff23fSmrg shift 421209ff23fSmrg done 422209ff23fSmrg shift 423209ff23fSmrg fi 424209ff23fSmrg 425209ff23fSmrg # Remove `-o $object'. 426209ff23fSmrg IFS=" " 427209ff23fSmrg for arg 428209ff23fSmrg do 429209ff23fSmrg case $arg in 430209ff23fSmrg -o) 431209ff23fSmrg shift 432209ff23fSmrg ;; 433209ff23fSmrg $object) 434209ff23fSmrg shift 435209ff23fSmrg ;; 436209ff23fSmrg *) 437209ff23fSmrg set fnord "$@" "$arg" 438209ff23fSmrg shift # fnord 439209ff23fSmrg shift # $arg 440209ff23fSmrg ;; 441209ff23fSmrg esac 442209ff23fSmrg done 443209ff23fSmrg 444209ff23fSmrg test -z "$dashmflag" && dashmflag=-M 445209ff23fSmrg # Require at least two characters before searching for `:' 446209ff23fSmrg # in the target name. This is to cope with DOS-style filenames: 447209ff23fSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 448209ff23fSmrg "$@" $dashmflag | 449209ff23fSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 450209ff23fSmrg rm -f "$depfile" 451209ff23fSmrg cat < "$tmpdepfile" > "$depfile" 452209ff23fSmrg tr ' ' ' 453209ff23fSmrg' < "$tmpdepfile" | \ 454209ff23fSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 455209ff23fSmrg## correctly. Breaking it into two sed invocations is a workaround. 456209ff23fSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 457209ff23fSmrg rm -f "$tmpdepfile" 458209ff23fSmrg ;; 459209ff23fSmrg 460209ff23fSmrgdashXmstdout) 461209ff23fSmrg # This case only exists to satisfy depend.m4. It is never actually 462209ff23fSmrg # run, as this mode is specially recognized in the preamble. 463209ff23fSmrg exit 1 464209ff23fSmrg ;; 465209ff23fSmrg 466209ff23fSmrgmakedepend) 467209ff23fSmrg "$@" || exit $? 468209ff23fSmrg # Remove any Libtool call 469209ff23fSmrg if test "$libtool" = yes; then 4702f39173dSmrg while test "X$1" != 'X--mode=compile'; do 471209ff23fSmrg shift 472209ff23fSmrg done 473209ff23fSmrg shift 474209ff23fSmrg fi 475209ff23fSmrg # X makedepend 476209ff23fSmrg shift 4772f39173dSmrg cleared=no eat=no 4782f39173dSmrg for arg 4792f39173dSmrg do 480209ff23fSmrg case $cleared in 481209ff23fSmrg no) 482209ff23fSmrg set ""; shift 483209ff23fSmrg cleared=yes ;; 484209ff23fSmrg esac 4852f39173dSmrg if test $eat = yes; then 4862f39173dSmrg eat=no 4872f39173dSmrg continue 4882f39173dSmrg fi 489209ff23fSmrg case "$arg" in 490209ff23fSmrg -D*|-I*) 491209ff23fSmrg set fnord "$@" "$arg"; shift ;; 492209ff23fSmrg # Strip any option that makedepend may not understand. Remove 493209ff23fSmrg # the object too, otherwise makedepend will parse it as a source file. 4942f39173dSmrg -arch) 4952f39173dSmrg eat=yes ;; 496209ff23fSmrg -*|$object) 497209ff23fSmrg ;; 498209ff23fSmrg *) 499209ff23fSmrg set fnord "$@" "$arg"; shift ;; 500209ff23fSmrg esac 501209ff23fSmrg done 5022f39173dSmrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 503209ff23fSmrg touch "$tmpdepfile" 504209ff23fSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 505209ff23fSmrg rm -f "$depfile" 506209ff23fSmrg cat < "$tmpdepfile" > "$depfile" 507209ff23fSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 508209ff23fSmrg' | \ 509209ff23fSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 510209ff23fSmrg## correctly. Breaking it into two sed invocations is a workaround. 511209ff23fSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 512209ff23fSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 513209ff23fSmrg ;; 514209ff23fSmrg 515209ff23fSmrgcpp) 516209ff23fSmrg # Important note: in order to support this mode, a compiler *must* 517209ff23fSmrg # always write the preprocessed file to stdout. 518209ff23fSmrg "$@" || exit $? 519209ff23fSmrg 520209ff23fSmrg # Remove the call to Libtool. 521209ff23fSmrg if test "$libtool" = yes; then 5222f39173dSmrg while test "X$1" != 'X--mode=compile'; do 523209ff23fSmrg shift 524209ff23fSmrg done 525209ff23fSmrg shift 526209ff23fSmrg fi 527209ff23fSmrg 528209ff23fSmrg # Remove `-o $object'. 529209ff23fSmrg IFS=" " 530209ff23fSmrg for arg 531209ff23fSmrg do 532209ff23fSmrg case $arg in 533209ff23fSmrg -o) 534209ff23fSmrg shift 535209ff23fSmrg ;; 536209ff23fSmrg $object) 537209ff23fSmrg shift 538209ff23fSmrg ;; 539209ff23fSmrg *) 540209ff23fSmrg set fnord "$@" "$arg" 541209ff23fSmrg shift # fnord 542209ff23fSmrg shift # $arg 543209ff23fSmrg ;; 544209ff23fSmrg esac 545209ff23fSmrg done 546209ff23fSmrg 547209ff23fSmrg "$@" -E | 548209ff23fSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 549209ff23fSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 550209ff23fSmrg sed '$ s: \\$::' > "$tmpdepfile" 551209ff23fSmrg rm -f "$depfile" 552209ff23fSmrg echo "$object : \\" > "$depfile" 553209ff23fSmrg cat < "$tmpdepfile" >> "$depfile" 554209ff23fSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 555209ff23fSmrg rm -f "$tmpdepfile" 556209ff23fSmrg ;; 557209ff23fSmrg 558209ff23fSmrgmsvisualcpp) 559209ff23fSmrg # Important note: in order to support this mode, a compiler *must* 5602f39173dSmrg # always write the preprocessed file to stdout. 561209ff23fSmrg "$@" || exit $? 5622f39173dSmrg 5632f39173dSmrg # Remove the call to Libtool. 5642f39173dSmrg if test "$libtool" = yes; then 5652f39173dSmrg while test "X$1" != 'X--mode=compile'; do 5662f39173dSmrg shift 5672f39173dSmrg done 5682f39173dSmrg shift 5692f39173dSmrg fi 5702f39173dSmrg 571209ff23fSmrg IFS=" " 572209ff23fSmrg for arg 573209ff23fSmrg do 574209ff23fSmrg case "$arg" in 5752f39173dSmrg -o) 5762f39173dSmrg shift 5772f39173dSmrg ;; 5782f39173dSmrg $object) 5792f39173dSmrg shift 5802f39173dSmrg ;; 581209ff23fSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 582209ff23fSmrg set fnord "$@" 583209ff23fSmrg shift 584209ff23fSmrg shift 585209ff23fSmrg ;; 586209ff23fSmrg *) 587209ff23fSmrg set fnord "$@" "$arg" 588209ff23fSmrg shift 589209ff23fSmrg shift 590209ff23fSmrg ;; 591209ff23fSmrg esac 592209ff23fSmrg done 5932f39173dSmrg "$@" -E 2>/dev/null | 5942f39173dSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 595209ff23fSmrg rm -f "$depfile" 596209ff23fSmrg echo "$object : \\" > "$depfile" 5972f39173dSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 598209ff23fSmrg echo " " >> "$depfile" 5992f39173dSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 600209ff23fSmrg rm -f "$tmpdepfile" 601209ff23fSmrg ;; 602209ff23fSmrg 6032f39173dSmrgmsvcmsys) 6042f39173dSmrg # This case exists only to let depend.m4 do its work. It works by 6052f39173dSmrg # looking at the text of this script. This case will never be run, 6062f39173dSmrg # since it is checked for above. 6072f39173dSmrg exit 1 6082f39173dSmrg ;; 6092f39173dSmrg 610209ff23fSmrgnone) 611209ff23fSmrg exec "$@" 612209ff23fSmrg ;; 613209ff23fSmrg 614209ff23fSmrg*) 615209ff23fSmrg echo "Unknown depmode $depmode" 1>&2 616209ff23fSmrg exit 1 617209ff23fSmrg ;; 618209ff23fSmrgesac 619209ff23fSmrg 620209ff23fSmrgexit 0 621209ff23fSmrg 622209ff23fSmrg# Local Variables: 623209ff23fSmrg# mode: shell-script 624209ff23fSmrg# sh-indentation: 2 625209ff23fSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 626209ff23fSmrg# time-stamp-start: "scriptversion=" 627209ff23fSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6282f39173dSmrg# time-stamp-time-zone: "UTC" 6292f39173dSmrg# time-stamp-end: "; # UTC" 630209ff23fSmrg# End: 631