depcomp revision 14ddf674
1cacd992dSmrg#! /bin/sh 2cacd992dSmrg# depcomp - compile a program generating dependencies as side-effects 314ddf674Smrg 414ddf674Smrgscriptversion=2009-04-28.21; # UTC 514ddf674Smrg 614ddf674Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 714ddf674Smrg# Software Foundation, Inc. 8cacd992dSmrg 9cacd992dSmrg# This program is free software; you can redistribute it and/or modify 10cacd992dSmrg# it under the terms of the GNU General Public License as published by 11cacd992dSmrg# the Free Software Foundation; either version 2, or (at your option) 12cacd992dSmrg# any later version. 13cacd992dSmrg 14cacd992dSmrg# This program is distributed in the hope that it will be useful, 15cacd992dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16cacd992dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17cacd992dSmrg# GNU General Public License for more details. 18cacd992dSmrg 19cacd992dSmrg# You should have received a copy of the GNU General Public License 2014ddf674Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21cacd992dSmrg 22cacd992dSmrg# As a special exception to the GNU General Public License, if you 23cacd992dSmrg# distribute this file as part of a program that contains a 24cacd992dSmrg# configuration script generated by Autoconf, you may include it under 25cacd992dSmrg# the same distribution terms that you use for the rest of that program. 26cacd992dSmrg 27cacd992dSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 28cacd992dSmrg 2914ddf674Smrgcase $1 in 3014ddf674Smrg '') 3114ddf674Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 3214ddf674Smrg exit 1; 3314ddf674Smrg ;; 3414ddf674Smrg -h | --h*) 3514ddf674Smrg cat <<\EOF 3614ddf674SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 3714ddf674Smrg 3814ddf674SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 3914ddf674Smrgas side-effects. 4014ddf674Smrg 4114ddf674SmrgEnvironment variables: 4214ddf674Smrg depmode Dependency tracking mode. 4314ddf674Smrg source Source file read by `PROGRAMS ARGS'. 4414ddf674Smrg object Object file output by `PROGRAMS ARGS'. 4514ddf674Smrg DEPDIR directory where to store dependencies. 4614ddf674Smrg depfile Dependency file to output. 4714ddf674Smrg tmpdepfile Temporary file to use when outputing dependencies. 4814ddf674Smrg libtool Whether libtool is used (yes/no). 4914ddf674Smrg 5014ddf674SmrgReport bugs to <bug-automake@gnu.org>. 5114ddf674SmrgEOF 5214ddf674Smrg exit $? 5314ddf674Smrg ;; 5414ddf674Smrg -v | --v*) 5514ddf674Smrg echo "depcomp $scriptversion" 5614ddf674Smrg exit $? 5714ddf674Smrg ;; 5814ddf674Smrgesac 5914ddf674Smrg 60cacd992dSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 61cacd992dSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 62cacd992dSmrg exit 1 63cacd992dSmrgfi 64cacd992dSmrg 6514ddf674Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 6614ddf674Smrgdepfile=${depfile-`echo "$object" | 6714ddf674Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 68cacd992dSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 69cacd992dSmrg 70cacd992dSmrgrm -f "$tmpdepfile" 71cacd992dSmrg 72cacd992dSmrg# Some modes work just like other modes, but use different flags. We 73cacd992dSmrg# parameterize here, but still list the modes in the big case below, 74cacd992dSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 75cacd992dSmrg# here, because this file can only contain one case statement. 76cacd992dSmrgif test "$depmode" = hp; then 77cacd992dSmrg # HP compiler uses -M and no extra arg. 78cacd992dSmrg gccflag=-M 79cacd992dSmrg depmode=gcc 80cacd992dSmrgfi 81cacd992dSmrg 82cacd992dSmrgif test "$depmode" = dashXmstdout; then 83cacd992dSmrg # This is just like dashmstdout with a different argument. 84cacd992dSmrg dashmflag=-xM 85cacd992dSmrg depmode=dashmstdout 86cacd992dSmrgfi 87cacd992dSmrg 8814ddf674Smrgcygpath_u="cygpath -u -f -" 8914ddf674Smrgif test "$depmode" = msvcmsys; then 9014ddf674Smrg # This is just like msvisualcpp but w/o cygpath translation. 9114ddf674Smrg # Just convert the backslash-escaped backslashes to single forward 9214ddf674Smrg # slashes to satisfy depend.m4 9314ddf674Smrg cygpath_u="sed s,\\\\\\\\,/,g" 9414ddf674Smrg depmode=msvisualcpp 9514ddf674Smrgfi 9614ddf674Smrg 97cacd992dSmrgcase "$depmode" in 98cacd992dSmrggcc3) 99cacd992dSmrg## gcc 3 implements dependency tracking that does exactly what 100cacd992dSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 101cacd992dSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 10214ddf674Smrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 10314ddf674Smrg## the command line argument order; so add the flags where they 10414ddf674Smrg## appear in depend2.am. Note that the slowdown incurred here 10514ddf674Smrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 10614ddf674Smrg for arg 10714ddf674Smrg do 10814ddf674Smrg case $arg in 10914ddf674Smrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 11014ddf674Smrg *) set fnord "$@" "$arg" ;; 11114ddf674Smrg esac 11214ddf674Smrg shift # fnord 11314ddf674Smrg shift # $arg 11414ddf674Smrg done 11514ddf674Smrg "$@" 116cacd992dSmrg stat=$? 117cacd992dSmrg if test $stat -eq 0; then : 118cacd992dSmrg else 119cacd992dSmrg rm -f "$tmpdepfile" 120cacd992dSmrg exit $stat 121cacd992dSmrg fi 122cacd992dSmrg mv "$tmpdepfile" "$depfile" 123cacd992dSmrg ;; 124cacd992dSmrg 125cacd992dSmrggcc) 126cacd992dSmrg## There are various ways to get dependency output from gcc. Here's 127cacd992dSmrg## why we pick this rather obscure method: 128cacd992dSmrg## - Don't want to use -MD because we'd like the dependencies to end 129cacd992dSmrg## up in a subdir. Having to rename by hand is ugly. 130cacd992dSmrg## (We might end up doing this anyway to support other compilers.) 131cacd992dSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 132cacd992dSmrg## -MM, not -M (despite what the docs say). 133cacd992dSmrg## - Using -M directly means running the compiler twice (even worse 134cacd992dSmrg## than renaming). 135cacd992dSmrg if test -z "$gccflag"; then 136cacd992dSmrg gccflag=-MD, 137cacd992dSmrg fi 138cacd992dSmrg "$@" -Wp,"$gccflag$tmpdepfile" 139cacd992dSmrg stat=$? 140cacd992dSmrg if test $stat -eq 0; then : 141cacd992dSmrg else 142cacd992dSmrg rm -f "$tmpdepfile" 143cacd992dSmrg exit $stat 144cacd992dSmrg fi 145cacd992dSmrg rm -f "$depfile" 146cacd992dSmrg echo "$object : \\" > "$depfile" 147cacd992dSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 148cacd992dSmrg## The second -e expression handles DOS-style file names with drive letters. 149cacd992dSmrg sed -e 's/^[^:]*: / /' \ 150cacd992dSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 151cacd992dSmrg## This next piece of magic avoids the `deleted header file' problem. 152cacd992dSmrg## The problem is that when a header file which appears in a .P file 153cacd992dSmrg## is deleted, the dependency causes make to die (because there is 154cacd992dSmrg## typically no way to rebuild the header). We avoid this by adding 155cacd992dSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 156cacd992dSmrg## this for us directly. 157cacd992dSmrg tr ' ' ' 158cacd992dSmrg' < "$tmpdepfile" | 159cacd992dSmrg## Some versions of gcc put a space before the `:'. On the theory 160cacd992dSmrg## that the space means something, we add a space to the output as 161cacd992dSmrg## well. 162cacd992dSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 163cacd992dSmrg## correctly. Breaking it into two sed invocations is a workaround. 164cacd992dSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 165cacd992dSmrg rm -f "$tmpdepfile" 166cacd992dSmrg ;; 167cacd992dSmrg 168cacd992dSmrghp) 169cacd992dSmrg # This case exists only to let depend.m4 do its work. It works by 170cacd992dSmrg # looking at the text of this script. This case will never be run, 171cacd992dSmrg # since it is checked for above. 172cacd992dSmrg exit 1 173cacd992dSmrg ;; 174cacd992dSmrg 175cacd992dSmrgsgi) 176cacd992dSmrg if test "$libtool" = yes; then 177cacd992dSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 178cacd992dSmrg else 179cacd992dSmrg "$@" -MDupdate "$tmpdepfile" 180cacd992dSmrg fi 181cacd992dSmrg stat=$? 182cacd992dSmrg if test $stat -eq 0; then : 183cacd992dSmrg else 184cacd992dSmrg rm -f "$tmpdepfile" 185cacd992dSmrg exit $stat 186cacd992dSmrg fi 187cacd992dSmrg rm -f "$depfile" 188cacd992dSmrg 189cacd992dSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 190cacd992dSmrg echo "$object : \\" > "$depfile" 191cacd992dSmrg 192cacd992dSmrg # Clip off the initial element (the dependent). Don't try to be 193cacd992dSmrg # clever and replace this with sed code, as IRIX sed won't handle 194cacd992dSmrg # lines with more than a fixed number of characters (4096 in 195cacd992dSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 196cacd992dSmrg # the IRIX cc adds comments like `#:fec' to the end of the 197cacd992dSmrg # dependency line. 198cacd992dSmrg tr ' ' ' 199cacd992dSmrg' < "$tmpdepfile" \ 200cacd992dSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 201cacd992dSmrg tr ' 20214ddf674Smrg' ' ' >> "$depfile" 20314ddf674Smrg echo >> "$depfile" 204cacd992dSmrg 205cacd992dSmrg # The second pass generates a dummy entry for each header file. 206cacd992dSmrg tr ' ' ' 207cacd992dSmrg' < "$tmpdepfile" \ 208cacd992dSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 20914ddf674Smrg >> "$depfile" 210cacd992dSmrg else 211cacd992dSmrg # The sourcefile does not contain any dependencies, so just 212cacd992dSmrg # store a dummy comment line, to avoid errors with the Makefile 213cacd992dSmrg # "include basename.Plo" scheme. 214cacd992dSmrg echo "#dummy" > "$depfile" 215cacd992dSmrg fi 216cacd992dSmrg rm -f "$tmpdepfile" 217cacd992dSmrg ;; 218cacd992dSmrg 219cacd992dSmrgaix) 220cacd992dSmrg # The C for AIX Compiler uses -M and outputs the dependencies 221cacd992dSmrg # in a .u file. In older versions, this file always lives in the 222cacd992dSmrg # current directory. Also, the AIX compiler puts `$object:' at the 223cacd992dSmrg # start of each line; $object doesn't have directory information. 224cacd992dSmrg # Version 6 uses the directory in both cases. 22514ddf674Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 22614ddf674Smrg test "x$dir" = "x$object" && dir= 22714ddf674Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 228cacd992dSmrg if test "$libtool" = yes; then 22914ddf674Smrg tmpdepfile1=$dir$base.u 23014ddf674Smrg tmpdepfile2=$base.u 23114ddf674Smrg tmpdepfile3=$dir.libs/$base.u 232cacd992dSmrg "$@" -Wc,-M 233cacd992dSmrg else 23414ddf674Smrg tmpdepfile1=$dir$base.u 23514ddf674Smrg tmpdepfile2=$dir$base.u 23614ddf674Smrg tmpdepfile3=$dir$base.u 237cacd992dSmrg "$@" -M 238cacd992dSmrg fi 239cacd992dSmrg stat=$? 240cacd992dSmrg 241cacd992dSmrg if test $stat -eq 0; then : 242cacd992dSmrg else 24314ddf674Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 244cacd992dSmrg exit $stat 245cacd992dSmrg fi 246cacd992dSmrg 24714ddf674Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 24814ddf674Smrg do 24914ddf674Smrg test -f "$tmpdepfile" && break 25014ddf674Smrg done 251cacd992dSmrg if test -f "$tmpdepfile"; then 252cacd992dSmrg # Each line is of the form `foo.o: dependent.h'. 253cacd992dSmrg # Do two passes, one to just change these to 254cacd992dSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 25514ddf674Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 25614ddf674Smrg # That's a tab and a space in the []. 25714ddf674Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 258cacd992dSmrg else 259cacd992dSmrg # The sourcefile does not contain any dependencies, so just 260cacd992dSmrg # store a dummy comment line, to avoid errors with the Makefile 261cacd992dSmrg # "include basename.Plo" scheme. 262cacd992dSmrg echo "#dummy" > "$depfile" 263cacd992dSmrg fi 264cacd992dSmrg rm -f "$tmpdepfile" 265cacd992dSmrg ;; 266cacd992dSmrg 267cacd992dSmrgicc) 268cacd992dSmrg # Intel's C compiler understands `-MD -MF file'. However on 269cacd992dSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 270cacd992dSmrg # ICC 7.0 will fill foo.d with something like 271cacd992dSmrg # foo.o: sub/foo.c 272cacd992dSmrg # foo.o: sub/foo.h 273cacd992dSmrg # which is wrong. We want: 274cacd992dSmrg # sub/foo.o: sub/foo.c 275cacd992dSmrg # sub/foo.o: sub/foo.h 276cacd992dSmrg # sub/foo.c: 277cacd992dSmrg # sub/foo.h: 278cacd992dSmrg # ICC 7.1 will output 279cacd992dSmrg # foo.o: sub/foo.c sub/foo.h 280cacd992dSmrg # and will wrap long lines using \ : 281cacd992dSmrg # foo.o: sub/foo.c ... \ 282cacd992dSmrg # sub/foo.h ... \ 283cacd992dSmrg # ... 284cacd992dSmrg 285cacd992dSmrg "$@" -MD -MF "$tmpdepfile" 286cacd992dSmrg stat=$? 287cacd992dSmrg if test $stat -eq 0; then : 288cacd992dSmrg else 289cacd992dSmrg rm -f "$tmpdepfile" 290cacd992dSmrg exit $stat 291cacd992dSmrg fi 292cacd992dSmrg rm -f "$depfile" 293cacd992dSmrg # Each line is of the form `foo.o: dependent.h', 294cacd992dSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 295cacd992dSmrg # Do two passes, one to just change these to 296cacd992dSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 297cacd992dSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 298cacd992dSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 299cacd992dSmrg # correctly. Breaking it into two sed invocations is a workaround. 300cacd992dSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 301cacd992dSmrg sed -e 's/$/ :/' >> "$depfile" 302cacd992dSmrg rm -f "$tmpdepfile" 303cacd992dSmrg ;; 304cacd992dSmrg 30514ddf674Smrghp2) 30614ddf674Smrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 30714ddf674Smrg # compilers, which have integrated preprocessors. The correct option 30814ddf674Smrg # to use with these is +Maked; it writes dependencies to a file named 30914ddf674Smrg # 'foo.d', which lands next to the object file, wherever that 31014ddf674Smrg # happens to be. 31114ddf674Smrg # Much of this is similar to the tru64 case; see comments there. 31214ddf674Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 31314ddf674Smrg test "x$dir" = "x$object" && dir= 31414ddf674Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 31514ddf674Smrg if test "$libtool" = yes; then 31614ddf674Smrg tmpdepfile1=$dir$base.d 31714ddf674Smrg tmpdepfile2=$dir.libs/$base.d 31814ddf674Smrg "$@" -Wc,+Maked 31914ddf674Smrg else 32014ddf674Smrg tmpdepfile1=$dir$base.d 32114ddf674Smrg tmpdepfile2=$dir$base.d 32214ddf674Smrg "$@" +Maked 32314ddf674Smrg fi 32414ddf674Smrg stat=$? 32514ddf674Smrg if test $stat -eq 0; then : 32614ddf674Smrg else 32714ddf674Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 32814ddf674Smrg exit $stat 32914ddf674Smrg fi 33014ddf674Smrg 33114ddf674Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 33214ddf674Smrg do 33314ddf674Smrg test -f "$tmpdepfile" && break 33414ddf674Smrg done 33514ddf674Smrg if test -f "$tmpdepfile"; then 33614ddf674Smrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 33714ddf674Smrg # Add `dependent.h:' lines. 33814ddf674Smrg sed -ne '2,${ 33914ddf674Smrg s/^ *// 34014ddf674Smrg s/ \\*$// 34114ddf674Smrg s/$/:/ 34214ddf674Smrg p 34314ddf674Smrg }' "$tmpdepfile" >> "$depfile" 34414ddf674Smrg else 34514ddf674Smrg echo "#dummy" > "$depfile" 34614ddf674Smrg fi 34714ddf674Smrg rm -f "$tmpdepfile" "$tmpdepfile2" 34814ddf674Smrg ;; 34914ddf674Smrg 350cacd992dSmrgtru64) 351cacd992dSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 352cacd992dSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 353cacd992dSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 354cacd992dSmrg # dependencies in `foo.d' instead, so we check for that too. 355cacd992dSmrg # Subdirectories are respected. 356cacd992dSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 357cacd992dSmrg test "x$dir" = "x$object" && dir= 358cacd992dSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 359cacd992dSmrg 360cacd992dSmrg if test "$libtool" = yes; then 36114ddf674Smrg # With Tru64 cc, shared objects can also be used to make a 36214ddf674Smrg # static library. This mechanism is used in libtool 1.4 series to 36314ddf674Smrg # handle both shared and static libraries in a single compilation. 36414ddf674Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 36514ddf674Smrg # 36614ddf674Smrg # With libtool 1.5 this exception was removed, and libtool now 36714ddf674Smrg # generates 2 separate objects for the 2 libraries. These two 36814ddf674Smrg # compilations output dependencies in $dir.libs/$base.o.d and 36914ddf674Smrg # in $dir$base.o.d. We have to check for both files, because 37014ddf674Smrg # one of the two compilations can be disabled. We should prefer 37114ddf674Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 37214ddf674Smrg # automatically cleaned when .libs/ is deleted, while ignoring 37314ddf674Smrg # the former would cause a distcleancheck panic. 37414ddf674Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 37514ddf674Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 37614ddf674Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 37714ddf674Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 378cacd992dSmrg "$@" -Wc,-MD 379cacd992dSmrg else 38014ddf674Smrg tmpdepfile1=$dir$base.o.d 38114ddf674Smrg tmpdepfile2=$dir$base.d 38214ddf674Smrg tmpdepfile3=$dir$base.d 38314ddf674Smrg tmpdepfile4=$dir$base.d 384cacd992dSmrg "$@" -MD 385cacd992dSmrg fi 386cacd992dSmrg 387cacd992dSmrg stat=$? 388cacd992dSmrg if test $stat -eq 0; then : 389cacd992dSmrg else 39014ddf674Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 391cacd992dSmrg exit $stat 392cacd992dSmrg fi 393cacd992dSmrg 39414ddf674Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 39514ddf674Smrg do 39614ddf674Smrg test -f "$tmpdepfile" && break 39714ddf674Smrg done 398cacd992dSmrg if test -f "$tmpdepfile"; then 399cacd992dSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 400cacd992dSmrg # That's a tab and a space in the []. 401cacd992dSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 402cacd992dSmrg else 403cacd992dSmrg echo "#dummy" > "$depfile" 404cacd992dSmrg fi 405cacd992dSmrg rm -f "$tmpdepfile" 406cacd992dSmrg ;; 407cacd992dSmrg 408cacd992dSmrg#nosideeffect) 409cacd992dSmrg # This comment above is used by automake to tell side-effect 410cacd992dSmrg # dependency tracking mechanisms from slower ones. 411cacd992dSmrg 412cacd992dSmrgdashmstdout) 413cacd992dSmrg # Important note: in order to support this mode, a compiler *must* 414cacd992dSmrg # always write the preprocessed file to stdout, regardless of -o. 415cacd992dSmrg "$@" || exit $? 416cacd992dSmrg 417cacd992dSmrg # Remove the call to Libtool. 418cacd992dSmrg if test "$libtool" = yes; then 41914ddf674Smrg while test "X$1" != 'X--mode=compile'; do 420cacd992dSmrg shift 421cacd992dSmrg done 422cacd992dSmrg shift 423cacd992dSmrg fi 424cacd992dSmrg 425cacd992dSmrg # Remove `-o $object'. 426cacd992dSmrg IFS=" " 427cacd992dSmrg for arg 428cacd992dSmrg do 429cacd992dSmrg case $arg in 430cacd992dSmrg -o) 431cacd992dSmrg shift 432cacd992dSmrg ;; 433cacd992dSmrg $object) 434cacd992dSmrg shift 435cacd992dSmrg ;; 436cacd992dSmrg *) 437cacd992dSmrg set fnord "$@" "$arg" 438cacd992dSmrg shift # fnord 439cacd992dSmrg shift # $arg 440cacd992dSmrg ;; 441cacd992dSmrg esac 442cacd992dSmrg done 443cacd992dSmrg 444cacd992dSmrg test -z "$dashmflag" && dashmflag=-M 445cacd992dSmrg # Require at least two characters before searching for `:' 446cacd992dSmrg # in the target name. This is to cope with DOS-style filenames: 447cacd992dSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 448cacd992dSmrg "$@" $dashmflag | 449cacd992dSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 450cacd992dSmrg rm -f "$depfile" 451cacd992dSmrg cat < "$tmpdepfile" > "$depfile" 452cacd992dSmrg tr ' ' ' 453cacd992dSmrg' < "$tmpdepfile" | \ 454cacd992dSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 455cacd992dSmrg## correctly. Breaking it into two sed invocations is a workaround. 456cacd992dSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 457cacd992dSmrg rm -f "$tmpdepfile" 458cacd992dSmrg ;; 459cacd992dSmrg 460cacd992dSmrgdashXmstdout) 461cacd992dSmrg # This case only exists to satisfy depend.m4. It is never actually 462cacd992dSmrg # run, as this mode is specially recognized in the preamble. 463cacd992dSmrg exit 1 464cacd992dSmrg ;; 465cacd992dSmrg 466cacd992dSmrgmakedepend) 467cacd992dSmrg "$@" || exit $? 468cacd992dSmrg # Remove any Libtool call 469cacd992dSmrg if test "$libtool" = yes; then 47014ddf674Smrg while test "X$1" != 'X--mode=compile'; do 471cacd992dSmrg shift 472cacd992dSmrg done 473cacd992dSmrg shift 474cacd992dSmrg fi 475cacd992dSmrg # X makedepend 476cacd992dSmrg shift 47714ddf674Smrg cleared=no eat=no 47814ddf674Smrg for arg 47914ddf674Smrg do 480cacd992dSmrg case $cleared in 481cacd992dSmrg no) 482cacd992dSmrg set ""; shift 483cacd992dSmrg cleared=yes ;; 484cacd992dSmrg esac 48514ddf674Smrg if test $eat = yes; then 48614ddf674Smrg eat=no 48714ddf674Smrg continue 48814ddf674Smrg fi 489cacd992dSmrg case "$arg" in 490cacd992dSmrg -D*|-I*) 491cacd992dSmrg set fnord "$@" "$arg"; shift ;; 492cacd992dSmrg # Strip any option that makedepend may not understand. Remove 493cacd992dSmrg # the object too, otherwise makedepend will parse it as a source file. 49414ddf674Smrg -arch) 49514ddf674Smrg eat=yes ;; 496cacd992dSmrg -*|$object) 497cacd992dSmrg ;; 498cacd992dSmrg *) 499cacd992dSmrg set fnord "$@" "$arg"; shift ;; 500cacd992dSmrg esac 501cacd992dSmrg done 50214ddf674Smrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 503cacd992dSmrg touch "$tmpdepfile" 504cacd992dSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 505cacd992dSmrg rm -f "$depfile" 506cacd992dSmrg cat < "$tmpdepfile" > "$depfile" 507cacd992dSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 508cacd992dSmrg' | \ 509cacd992dSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 510cacd992dSmrg## correctly. Breaking it into two sed invocations is a workaround. 511cacd992dSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 512cacd992dSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 513cacd992dSmrg ;; 514cacd992dSmrg 515cacd992dSmrgcpp) 516cacd992dSmrg # Important note: in order to support this mode, a compiler *must* 517cacd992dSmrg # always write the preprocessed file to stdout. 518cacd992dSmrg "$@" || exit $? 519cacd992dSmrg 520cacd992dSmrg # Remove the call to Libtool. 521cacd992dSmrg if test "$libtool" = yes; then 52214ddf674Smrg while test "X$1" != 'X--mode=compile'; do 523cacd992dSmrg shift 524cacd992dSmrg done 525cacd992dSmrg shift 526cacd992dSmrg fi 527cacd992dSmrg 528cacd992dSmrg # Remove `-o $object'. 529cacd992dSmrg IFS=" " 530cacd992dSmrg for arg 531cacd992dSmrg do 532cacd992dSmrg case $arg in 533cacd992dSmrg -o) 534cacd992dSmrg shift 535cacd992dSmrg ;; 536cacd992dSmrg $object) 537cacd992dSmrg shift 538cacd992dSmrg ;; 539cacd992dSmrg *) 540cacd992dSmrg set fnord "$@" "$arg" 541cacd992dSmrg shift # fnord 542cacd992dSmrg shift # $arg 543cacd992dSmrg ;; 544cacd992dSmrg esac 545cacd992dSmrg done 546cacd992dSmrg 547cacd992dSmrg "$@" -E | 54814ddf674Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 54914ddf674Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 550cacd992dSmrg sed '$ s: \\$::' > "$tmpdepfile" 551cacd992dSmrg rm -f "$depfile" 552cacd992dSmrg echo "$object : \\" > "$depfile" 553cacd992dSmrg cat < "$tmpdepfile" >> "$depfile" 554cacd992dSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 555cacd992dSmrg rm -f "$tmpdepfile" 556cacd992dSmrg ;; 557cacd992dSmrg 558cacd992dSmrgmsvisualcpp) 559cacd992dSmrg # Important note: in order to support this mode, a compiler *must* 56014ddf674Smrg # always write the preprocessed file to stdout. 561cacd992dSmrg "$@" || exit $? 56214ddf674Smrg 56314ddf674Smrg # Remove the call to Libtool. 56414ddf674Smrg if test "$libtool" = yes; then 56514ddf674Smrg while test "X$1" != 'X--mode=compile'; do 56614ddf674Smrg shift 56714ddf674Smrg done 56814ddf674Smrg shift 56914ddf674Smrg fi 57014ddf674Smrg 571cacd992dSmrg IFS=" " 572cacd992dSmrg for arg 573cacd992dSmrg do 574cacd992dSmrg case "$arg" in 57514ddf674Smrg -o) 57614ddf674Smrg shift 57714ddf674Smrg ;; 57814ddf674Smrg $object) 57914ddf674Smrg shift 58014ddf674Smrg ;; 581cacd992dSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 582cacd992dSmrg set fnord "$@" 583cacd992dSmrg shift 584cacd992dSmrg shift 585cacd992dSmrg ;; 586cacd992dSmrg *) 587cacd992dSmrg set fnord "$@" "$arg" 588cacd992dSmrg shift 589cacd992dSmrg shift 590cacd992dSmrg ;; 591cacd992dSmrg esac 592cacd992dSmrg done 59314ddf674Smrg "$@" -E 2>/dev/null | 59414ddf674Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 595cacd992dSmrg rm -f "$depfile" 596cacd992dSmrg echo "$object : \\" > "$depfile" 59714ddf674Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 598cacd992dSmrg echo " " >> "$depfile" 59914ddf674Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 600cacd992dSmrg rm -f "$tmpdepfile" 601cacd992dSmrg ;; 602cacd992dSmrg 60314ddf674Smrgmsvcmsys) 60414ddf674Smrg # This case exists only to let depend.m4 do its work. It works by 60514ddf674Smrg # looking at the text of this script. This case will never be run, 60614ddf674Smrg # since it is checked for above. 60714ddf674Smrg exit 1 60814ddf674Smrg ;; 60914ddf674Smrg 610cacd992dSmrgnone) 611cacd992dSmrg exec "$@" 612cacd992dSmrg ;; 613cacd992dSmrg 614cacd992dSmrg*) 615cacd992dSmrg echo "Unknown depmode $depmode" 1>&2 616cacd992dSmrg exit 1 617cacd992dSmrg ;; 618cacd992dSmrgesac 619cacd992dSmrg 620cacd992dSmrgexit 0 62114ddf674Smrg 62214ddf674Smrg# Local Variables: 62314ddf674Smrg# mode: shell-script 62414ddf674Smrg# sh-indentation: 2 62514ddf674Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 62614ddf674Smrg# time-stamp-start: "scriptversion=" 62714ddf674Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 62814ddf674Smrg# time-stamp-time-zone: "UTC" 62914ddf674Smrg# time-stamp-end: "; # UTC" 63014ddf674Smrg# End: 631