depcomp revision 2ddb6cf1
1a1d141d5Smrg#! /bin/sh 2a1d141d5Smrg# depcomp - compile a program generating dependencies as side-effects 32ddb6cf1Smrg 42ddb6cf1Smrgscriptversion=2009-04-28.21; # UTC 52ddb6cf1Smrg 62ddb6cf1Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 72ddb6cf1Smrg# Software Foundation, Inc. 8a1d141d5Smrg 9a1d141d5Smrg# This program is free software; you can redistribute it and/or modify 10a1d141d5Smrg# it under the terms of the GNU General Public License as published by 11a1d141d5Smrg# the Free Software Foundation; either version 2, or (at your option) 12a1d141d5Smrg# any later version. 13a1d141d5Smrg 14a1d141d5Smrg# This program is distributed in the hope that it will be useful, 15a1d141d5Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16a1d141d5Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17a1d141d5Smrg# GNU General Public License for more details. 18a1d141d5Smrg 19a1d141d5Smrg# You should have received a copy of the GNU General Public License 202ddb6cf1Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21a1d141d5Smrg 22a1d141d5Smrg# As a special exception to the GNU General Public License, if you 23a1d141d5Smrg# distribute this file as part of a program that contains a 24a1d141d5Smrg# configuration script generated by Autoconf, you may include it under 25a1d141d5Smrg# the same distribution terms that you use for the rest of that program. 26a1d141d5Smrg 27a1d141d5Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 28a1d141d5Smrg 292ddb6cf1Smrgcase $1 in 302ddb6cf1Smrg '') 312ddb6cf1Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 322ddb6cf1Smrg exit 1; 332ddb6cf1Smrg ;; 342ddb6cf1Smrg -h | --h*) 352ddb6cf1Smrg cat <<\EOF 362ddb6cf1SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 372ddb6cf1Smrg 382ddb6cf1SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 392ddb6cf1Smrgas side-effects. 402ddb6cf1Smrg 412ddb6cf1SmrgEnvironment variables: 422ddb6cf1Smrg depmode Dependency tracking mode. 432ddb6cf1Smrg source Source file read by `PROGRAMS ARGS'. 442ddb6cf1Smrg object Object file output by `PROGRAMS ARGS'. 452ddb6cf1Smrg DEPDIR directory where to store dependencies. 462ddb6cf1Smrg depfile Dependency file to output. 472ddb6cf1Smrg tmpdepfile Temporary file to use when outputing dependencies. 482ddb6cf1Smrg libtool Whether libtool is used (yes/no). 492ddb6cf1Smrg 502ddb6cf1SmrgReport bugs to <bug-automake@gnu.org>. 512ddb6cf1SmrgEOF 522ddb6cf1Smrg exit $? 532ddb6cf1Smrg ;; 542ddb6cf1Smrg -v | --v*) 552ddb6cf1Smrg echo "depcomp $scriptversion" 562ddb6cf1Smrg exit $? 572ddb6cf1Smrg ;; 582ddb6cf1Smrgesac 592ddb6cf1Smrg 60a1d141d5Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 61a1d141d5Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 62a1d141d5Smrg exit 1 63a1d141d5Smrgfi 64a1d141d5Smrg 652ddb6cf1Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 662ddb6cf1Smrgdepfile=${depfile-`echo "$object" | 672ddb6cf1Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 68a1d141d5Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 69a1d141d5Smrg 70a1d141d5Smrgrm -f "$tmpdepfile" 71a1d141d5Smrg 72a1d141d5Smrg# Some modes work just like other modes, but use different flags. We 73a1d141d5Smrg# parameterize here, but still list the modes in the big case below, 74a1d141d5Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 75a1d141d5Smrg# here, because this file can only contain one case statement. 76a1d141d5Smrgif test "$depmode" = hp; then 77a1d141d5Smrg # HP compiler uses -M and no extra arg. 78a1d141d5Smrg gccflag=-M 79a1d141d5Smrg depmode=gcc 80a1d141d5Smrgfi 81a1d141d5Smrg 82a1d141d5Smrgif test "$depmode" = dashXmstdout; then 83a1d141d5Smrg # This is just like dashmstdout with a different argument. 84a1d141d5Smrg dashmflag=-xM 85a1d141d5Smrg depmode=dashmstdout 86a1d141d5Smrgfi 87a1d141d5Smrg 882ddb6cf1Smrgcygpath_u="cygpath -u -f -" 892ddb6cf1Smrgif test "$depmode" = msvcmsys; then 902ddb6cf1Smrg # This is just like msvisualcpp but w/o cygpath translation. 912ddb6cf1Smrg # Just convert the backslash-escaped backslashes to single forward 922ddb6cf1Smrg # slashes to satisfy depend.m4 932ddb6cf1Smrg cygpath_u="sed s,\\\\\\\\,/,g" 942ddb6cf1Smrg depmode=msvisualcpp 952ddb6cf1Smrgfi 962ddb6cf1Smrg 97a1d141d5Smrgcase "$depmode" in 98a1d141d5Smrggcc3) 99a1d141d5Smrg## gcc 3 implements dependency tracking that does exactly what 100a1d141d5Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 101a1d141d5Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 1022ddb6cf1Smrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1032ddb6cf1Smrg## the command line argument order; so add the flags where they 1042ddb6cf1Smrg## appear in depend2.am. Note that the slowdown incurred here 1052ddb6cf1Smrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1062ddb6cf1Smrg for arg 1072ddb6cf1Smrg do 1082ddb6cf1Smrg case $arg in 1092ddb6cf1Smrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1102ddb6cf1Smrg *) set fnord "$@" "$arg" ;; 1112ddb6cf1Smrg esac 1122ddb6cf1Smrg shift # fnord 1132ddb6cf1Smrg shift # $arg 1142ddb6cf1Smrg done 1152ddb6cf1Smrg "$@" 116a1d141d5Smrg stat=$? 117a1d141d5Smrg if test $stat -eq 0; then : 118a1d141d5Smrg else 119a1d141d5Smrg rm -f "$tmpdepfile" 120a1d141d5Smrg exit $stat 121a1d141d5Smrg fi 122a1d141d5Smrg mv "$tmpdepfile" "$depfile" 123a1d141d5Smrg ;; 124a1d141d5Smrg 125a1d141d5Smrggcc) 126a1d141d5Smrg## There are various ways to get dependency output from gcc. Here's 127a1d141d5Smrg## why we pick this rather obscure method: 128a1d141d5Smrg## - Don't want to use -MD because we'd like the dependencies to end 129a1d141d5Smrg## up in a subdir. Having to rename by hand is ugly. 130a1d141d5Smrg## (We might end up doing this anyway to support other compilers.) 131a1d141d5Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 132a1d141d5Smrg## -MM, not -M (despite what the docs say). 133a1d141d5Smrg## - Using -M directly means running the compiler twice (even worse 134a1d141d5Smrg## than renaming). 135a1d141d5Smrg if test -z "$gccflag"; then 136a1d141d5Smrg gccflag=-MD, 137a1d141d5Smrg fi 138a1d141d5Smrg "$@" -Wp,"$gccflag$tmpdepfile" 139a1d141d5Smrg stat=$? 140a1d141d5Smrg if test $stat -eq 0; then : 141a1d141d5Smrg else 142a1d141d5Smrg rm -f "$tmpdepfile" 143a1d141d5Smrg exit $stat 144a1d141d5Smrg fi 145a1d141d5Smrg rm -f "$depfile" 146a1d141d5Smrg echo "$object : \\" > "$depfile" 147a1d141d5Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 148a1d141d5Smrg## The second -e expression handles DOS-style file names with drive letters. 149a1d141d5Smrg sed -e 's/^[^:]*: / /' \ 150a1d141d5Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 151a1d141d5Smrg## This next piece of magic avoids the `deleted header file' problem. 152a1d141d5Smrg## The problem is that when a header file which appears in a .P file 153a1d141d5Smrg## is deleted, the dependency causes make to die (because there is 154a1d141d5Smrg## typically no way to rebuild the header). We avoid this by adding 155a1d141d5Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 156a1d141d5Smrg## this for us directly. 157a1d141d5Smrg tr ' ' ' 158a1d141d5Smrg' < "$tmpdepfile" | 159a1d141d5Smrg## Some versions of gcc put a space before the `:'. On the theory 160a1d141d5Smrg## that the space means something, we add a space to the output as 161a1d141d5Smrg## well. 162a1d141d5Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 163a1d141d5Smrg## correctly. Breaking it into two sed invocations is a workaround. 164a1d141d5Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 165a1d141d5Smrg rm -f "$tmpdepfile" 166a1d141d5Smrg ;; 167a1d141d5Smrg 168a1d141d5Smrghp) 169a1d141d5Smrg # This case exists only to let depend.m4 do its work. It works by 170a1d141d5Smrg # looking at the text of this script. This case will never be run, 171a1d141d5Smrg # since it is checked for above. 172a1d141d5Smrg exit 1 173a1d141d5Smrg ;; 174a1d141d5Smrg 175a1d141d5Smrgsgi) 176a1d141d5Smrg if test "$libtool" = yes; then 177a1d141d5Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 178a1d141d5Smrg else 179a1d141d5Smrg "$@" -MDupdate "$tmpdepfile" 180a1d141d5Smrg fi 181a1d141d5Smrg stat=$? 182a1d141d5Smrg if test $stat -eq 0; then : 183a1d141d5Smrg else 184a1d141d5Smrg rm -f "$tmpdepfile" 185a1d141d5Smrg exit $stat 186a1d141d5Smrg fi 187a1d141d5Smrg rm -f "$depfile" 188a1d141d5Smrg 189a1d141d5Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 190a1d141d5Smrg echo "$object : \\" > "$depfile" 191a1d141d5Smrg 192a1d141d5Smrg # Clip off the initial element (the dependent). Don't try to be 193a1d141d5Smrg # clever and replace this with sed code, as IRIX sed won't handle 194a1d141d5Smrg # lines with more than a fixed number of characters (4096 in 195a1d141d5Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 196a1d141d5Smrg # the IRIX cc adds comments like `#:fec' to the end of the 197a1d141d5Smrg # dependency line. 198a1d141d5Smrg tr ' ' ' 199a1d141d5Smrg' < "$tmpdepfile" \ 200a1d141d5Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 201a1d141d5Smrg tr ' 2022ddb6cf1Smrg' ' ' >> "$depfile" 2032ddb6cf1Smrg echo >> "$depfile" 204a1d141d5Smrg 205a1d141d5Smrg # The second pass generates a dummy entry for each header file. 206a1d141d5Smrg tr ' ' ' 207a1d141d5Smrg' < "$tmpdepfile" \ 208a1d141d5Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2092ddb6cf1Smrg >> "$depfile" 210a1d141d5Smrg else 211a1d141d5Smrg # The sourcefile does not contain any dependencies, so just 212a1d141d5Smrg # store a dummy comment line, to avoid errors with the Makefile 213a1d141d5Smrg # "include basename.Plo" scheme. 214a1d141d5Smrg echo "#dummy" > "$depfile" 215a1d141d5Smrg fi 216a1d141d5Smrg rm -f "$tmpdepfile" 217a1d141d5Smrg ;; 218a1d141d5Smrg 219a1d141d5Smrgaix) 220a1d141d5Smrg # The C for AIX Compiler uses -M and outputs the dependencies 221a1d141d5Smrg # in a .u file. In older versions, this file always lives in the 222a1d141d5Smrg # current directory. Also, the AIX compiler puts `$object:' at the 223a1d141d5Smrg # start of each line; $object doesn't have directory information. 224a1d141d5Smrg # Version 6 uses the directory in both cases. 2252ddb6cf1Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2262ddb6cf1Smrg test "x$dir" = "x$object" && dir= 2272ddb6cf1Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 228a1d141d5Smrg if test "$libtool" = yes; then 2292ddb6cf1Smrg tmpdepfile1=$dir$base.u 2302ddb6cf1Smrg tmpdepfile2=$base.u 2312ddb6cf1Smrg tmpdepfile3=$dir.libs/$base.u 232a1d141d5Smrg "$@" -Wc,-M 233a1d141d5Smrg else 2342ddb6cf1Smrg tmpdepfile1=$dir$base.u 2352ddb6cf1Smrg tmpdepfile2=$dir$base.u 2362ddb6cf1Smrg tmpdepfile3=$dir$base.u 237a1d141d5Smrg "$@" -M 238a1d141d5Smrg fi 239a1d141d5Smrg stat=$? 240a1d141d5Smrg 241a1d141d5Smrg if test $stat -eq 0; then : 242a1d141d5Smrg else 2432ddb6cf1Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 244a1d141d5Smrg exit $stat 245a1d141d5Smrg fi 246a1d141d5Smrg 2472ddb6cf1Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2482ddb6cf1Smrg do 2492ddb6cf1Smrg test -f "$tmpdepfile" && break 2502ddb6cf1Smrg done 251a1d141d5Smrg if test -f "$tmpdepfile"; then 252a1d141d5Smrg # Each line is of the form `foo.o: dependent.h'. 253a1d141d5Smrg # Do two passes, one to just change these to 254a1d141d5Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 2552ddb6cf1Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2562ddb6cf1Smrg # That's a tab and a space in the []. 2572ddb6cf1Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 258a1d141d5Smrg else 259a1d141d5Smrg # The sourcefile does not contain any dependencies, so just 260a1d141d5Smrg # store a dummy comment line, to avoid errors with the Makefile 261a1d141d5Smrg # "include basename.Plo" scheme. 262a1d141d5Smrg echo "#dummy" > "$depfile" 263a1d141d5Smrg fi 264a1d141d5Smrg rm -f "$tmpdepfile" 265a1d141d5Smrg ;; 266a1d141d5Smrg 267a1d141d5Smrgicc) 268a1d141d5Smrg # Intel's C compiler understands `-MD -MF file'. However on 269a1d141d5Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 270a1d141d5Smrg # ICC 7.0 will fill foo.d with something like 271a1d141d5Smrg # foo.o: sub/foo.c 272a1d141d5Smrg # foo.o: sub/foo.h 273a1d141d5Smrg # which is wrong. We want: 274a1d141d5Smrg # sub/foo.o: sub/foo.c 275a1d141d5Smrg # sub/foo.o: sub/foo.h 276a1d141d5Smrg # sub/foo.c: 277a1d141d5Smrg # sub/foo.h: 278a1d141d5Smrg # ICC 7.1 will output 279a1d141d5Smrg # foo.o: sub/foo.c sub/foo.h 280a1d141d5Smrg # and will wrap long lines using \ : 281a1d141d5Smrg # foo.o: sub/foo.c ... \ 282a1d141d5Smrg # sub/foo.h ... \ 283a1d141d5Smrg # ... 284a1d141d5Smrg 285a1d141d5Smrg "$@" -MD -MF "$tmpdepfile" 286a1d141d5Smrg stat=$? 287a1d141d5Smrg if test $stat -eq 0; then : 288a1d141d5Smrg else 289a1d141d5Smrg rm -f "$tmpdepfile" 290a1d141d5Smrg exit $stat 291a1d141d5Smrg fi 292a1d141d5Smrg rm -f "$depfile" 293a1d141d5Smrg # Each line is of the form `foo.o: dependent.h', 294a1d141d5Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 295a1d141d5Smrg # Do two passes, one to just change these to 296a1d141d5Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 297a1d141d5Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 298a1d141d5Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 299a1d141d5Smrg # correctly. Breaking it into two sed invocations is a workaround. 300a1d141d5Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 301a1d141d5Smrg sed -e 's/$/ :/' >> "$depfile" 302a1d141d5Smrg rm -f "$tmpdepfile" 303a1d141d5Smrg ;; 304a1d141d5Smrg 3052ddb6cf1Smrghp2) 3062ddb6cf1Smrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3072ddb6cf1Smrg # compilers, which have integrated preprocessors. The correct option 3082ddb6cf1Smrg # to use with these is +Maked; it writes dependencies to a file named 3092ddb6cf1Smrg # 'foo.d', which lands next to the object file, wherever that 3102ddb6cf1Smrg # happens to be. 3112ddb6cf1Smrg # Much of this is similar to the tru64 case; see comments there. 3122ddb6cf1Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3132ddb6cf1Smrg test "x$dir" = "x$object" && dir= 3142ddb6cf1Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3152ddb6cf1Smrg if test "$libtool" = yes; then 3162ddb6cf1Smrg tmpdepfile1=$dir$base.d 3172ddb6cf1Smrg tmpdepfile2=$dir.libs/$base.d 3182ddb6cf1Smrg "$@" -Wc,+Maked 3192ddb6cf1Smrg else 3202ddb6cf1Smrg tmpdepfile1=$dir$base.d 3212ddb6cf1Smrg tmpdepfile2=$dir$base.d 3222ddb6cf1Smrg "$@" +Maked 3232ddb6cf1Smrg fi 3242ddb6cf1Smrg stat=$? 3252ddb6cf1Smrg if test $stat -eq 0; then : 3262ddb6cf1Smrg else 3272ddb6cf1Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3282ddb6cf1Smrg exit $stat 3292ddb6cf1Smrg fi 3302ddb6cf1Smrg 3312ddb6cf1Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3322ddb6cf1Smrg do 3332ddb6cf1Smrg test -f "$tmpdepfile" && break 3342ddb6cf1Smrg done 3352ddb6cf1Smrg if test -f "$tmpdepfile"; then 3362ddb6cf1Smrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3372ddb6cf1Smrg # Add `dependent.h:' lines. 3382ddb6cf1Smrg sed -ne '2,${ 3392ddb6cf1Smrg s/^ *// 3402ddb6cf1Smrg s/ \\*$// 3412ddb6cf1Smrg s/$/:/ 3422ddb6cf1Smrg p 3432ddb6cf1Smrg }' "$tmpdepfile" >> "$depfile" 3442ddb6cf1Smrg else 3452ddb6cf1Smrg echo "#dummy" > "$depfile" 3462ddb6cf1Smrg fi 3472ddb6cf1Smrg rm -f "$tmpdepfile" "$tmpdepfile2" 3482ddb6cf1Smrg ;; 3492ddb6cf1Smrg 350a1d141d5Smrgtru64) 351a1d141d5Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 352a1d141d5Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 353a1d141d5Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 354a1d141d5Smrg # dependencies in `foo.d' instead, so we check for that too. 355a1d141d5Smrg # Subdirectories are respected. 356a1d141d5Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 357a1d141d5Smrg test "x$dir" = "x$object" && dir= 358a1d141d5Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 359a1d141d5Smrg 360a1d141d5Smrg if test "$libtool" = yes; then 3612ddb6cf1Smrg # With Tru64 cc, shared objects can also be used to make a 3622ddb6cf1Smrg # static library. This mechanism is used in libtool 1.4 series to 3632ddb6cf1Smrg # handle both shared and static libraries in a single compilation. 3642ddb6cf1Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 3652ddb6cf1Smrg # 3662ddb6cf1Smrg # With libtool 1.5 this exception was removed, and libtool now 3672ddb6cf1Smrg # generates 2 separate objects for the 2 libraries. These two 3682ddb6cf1Smrg # compilations output dependencies in $dir.libs/$base.o.d and 3692ddb6cf1Smrg # in $dir$base.o.d. We have to check for both files, because 3702ddb6cf1Smrg # one of the two compilations can be disabled. We should prefer 3712ddb6cf1Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 3722ddb6cf1Smrg # automatically cleaned when .libs/ is deleted, while ignoring 3732ddb6cf1Smrg # the former would cause a distcleancheck panic. 3742ddb6cf1Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 3752ddb6cf1Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 3762ddb6cf1Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 3772ddb6cf1Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 378a1d141d5Smrg "$@" -Wc,-MD 379a1d141d5Smrg else 3802ddb6cf1Smrg tmpdepfile1=$dir$base.o.d 3812ddb6cf1Smrg tmpdepfile2=$dir$base.d 3822ddb6cf1Smrg tmpdepfile3=$dir$base.d 3832ddb6cf1Smrg tmpdepfile4=$dir$base.d 384a1d141d5Smrg "$@" -MD 385a1d141d5Smrg fi 386a1d141d5Smrg 387a1d141d5Smrg stat=$? 388a1d141d5Smrg if test $stat -eq 0; then : 389a1d141d5Smrg else 3902ddb6cf1Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 391a1d141d5Smrg exit $stat 392a1d141d5Smrg fi 393a1d141d5Smrg 3942ddb6cf1Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3952ddb6cf1Smrg do 3962ddb6cf1Smrg test -f "$tmpdepfile" && break 3972ddb6cf1Smrg done 398a1d141d5Smrg if test -f "$tmpdepfile"; then 399a1d141d5Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 400a1d141d5Smrg # That's a tab and a space in the []. 401a1d141d5Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 402a1d141d5Smrg else 403a1d141d5Smrg echo "#dummy" > "$depfile" 404a1d141d5Smrg fi 405a1d141d5Smrg rm -f "$tmpdepfile" 406a1d141d5Smrg ;; 407a1d141d5Smrg 408a1d141d5Smrg#nosideeffect) 409a1d141d5Smrg # This comment above is used by automake to tell side-effect 410a1d141d5Smrg # dependency tracking mechanisms from slower ones. 411a1d141d5Smrg 412a1d141d5Smrgdashmstdout) 413a1d141d5Smrg # Important note: in order to support this mode, a compiler *must* 414a1d141d5Smrg # always write the preprocessed file to stdout, regardless of -o. 415a1d141d5Smrg "$@" || exit $? 416a1d141d5Smrg 417a1d141d5Smrg # Remove the call to Libtool. 418a1d141d5Smrg if test "$libtool" = yes; then 4192ddb6cf1Smrg while test "X$1" != 'X--mode=compile'; do 420a1d141d5Smrg shift 421a1d141d5Smrg done 422a1d141d5Smrg shift 423a1d141d5Smrg fi 424a1d141d5Smrg 425a1d141d5Smrg # Remove `-o $object'. 426a1d141d5Smrg IFS=" " 427a1d141d5Smrg for arg 428a1d141d5Smrg do 429a1d141d5Smrg case $arg in 430a1d141d5Smrg -o) 431a1d141d5Smrg shift 432a1d141d5Smrg ;; 433a1d141d5Smrg $object) 434a1d141d5Smrg shift 435a1d141d5Smrg ;; 436a1d141d5Smrg *) 437a1d141d5Smrg set fnord "$@" "$arg" 438a1d141d5Smrg shift # fnord 439a1d141d5Smrg shift # $arg 440a1d141d5Smrg ;; 441a1d141d5Smrg esac 442a1d141d5Smrg done 443a1d141d5Smrg 444a1d141d5Smrg test -z "$dashmflag" && dashmflag=-M 445a1d141d5Smrg # Require at least two characters before searching for `:' 446a1d141d5Smrg # in the target name. This is to cope with DOS-style filenames: 447a1d141d5Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 448a1d141d5Smrg "$@" $dashmflag | 449a1d141d5Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 450a1d141d5Smrg rm -f "$depfile" 451a1d141d5Smrg cat < "$tmpdepfile" > "$depfile" 452a1d141d5Smrg tr ' ' ' 453a1d141d5Smrg' < "$tmpdepfile" | \ 454a1d141d5Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 455a1d141d5Smrg## correctly. Breaking it into two sed invocations is a workaround. 456a1d141d5Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 457a1d141d5Smrg rm -f "$tmpdepfile" 458a1d141d5Smrg ;; 459a1d141d5Smrg 460a1d141d5SmrgdashXmstdout) 461a1d141d5Smrg # This case only exists to satisfy depend.m4. It is never actually 462a1d141d5Smrg # run, as this mode is specially recognized in the preamble. 463a1d141d5Smrg exit 1 464a1d141d5Smrg ;; 465a1d141d5Smrg 466a1d141d5Smrgmakedepend) 467a1d141d5Smrg "$@" || exit $? 468a1d141d5Smrg # Remove any Libtool call 469a1d141d5Smrg if test "$libtool" = yes; then 4702ddb6cf1Smrg while test "X$1" != 'X--mode=compile'; do 471a1d141d5Smrg shift 472a1d141d5Smrg done 473a1d141d5Smrg shift 474a1d141d5Smrg fi 475a1d141d5Smrg # X makedepend 476a1d141d5Smrg shift 4772ddb6cf1Smrg cleared=no eat=no 4782ddb6cf1Smrg for arg 4792ddb6cf1Smrg do 480a1d141d5Smrg case $cleared in 481a1d141d5Smrg no) 482a1d141d5Smrg set ""; shift 483a1d141d5Smrg cleared=yes ;; 484a1d141d5Smrg esac 4852ddb6cf1Smrg if test $eat = yes; then 4862ddb6cf1Smrg eat=no 4872ddb6cf1Smrg continue 4882ddb6cf1Smrg fi 489a1d141d5Smrg case "$arg" in 490a1d141d5Smrg -D*|-I*) 491a1d141d5Smrg set fnord "$@" "$arg"; shift ;; 492a1d141d5Smrg # Strip any option that makedepend may not understand. Remove 493a1d141d5Smrg # the object too, otherwise makedepend will parse it as a source file. 4942ddb6cf1Smrg -arch) 4952ddb6cf1Smrg eat=yes ;; 496a1d141d5Smrg -*|$object) 497a1d141d5Smrg ;; 498a1d141d5Smrg *) 499a1d141d5Smrg set fnord "$@" "$arg"; shift ;; 500a1d141d5Smrg esac 501a1d141d5Smrg done 5022ddb6cf1Smrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 503a1d141d5Smrg touch "$tmpdepfile" 504a1d141d5Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 505a1d141d5Smrg rm -f "$depfile" 506a1d141d5Smrg cat < "$tmpdepfile" > "$depfile" 507a1d141d5Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 508a1d141d5Smrg' | \ 509a1d141d5Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 510a1d141d5Smrg## correctly. Breaking it into two sed invocations is a workaround. 511a1d141d5Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 512a1d141d5Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 513a1d141d5Smrg ;; 514a1d141d5Smrg 515a1d141d5Smrgcpp) 516a1d141d5Smrg # Important note: in order to support this mode, a compiler *must* 517a1d141d5Smrg # always write the preprocessed file to stdout. 518a1d141d5Smrg "$@" || exit $? 519a1d141d5Smrg 520a1d141d5Smrg # Remove the call to Libtool. 521a1d141d5Smrg if test "$libtool" = yes; then 5222ddb6cf1Smrg while test "X$1" != 'X--mode=compile'; do 523a1d141d5Smrg shift 524a1d141d5Smrg done 525a1d141d5Smrg shift 526a1d141d5Smrg fi 527a1d141d5Smrg 528a1d141d5Smrg # Remove `-o $object'. 529a1d141d5Smrg IFS=" " 530a1d141d5Smrg for arg 531a1d141d5Smrg do 532a1d141d5Smrg case $arg in 533a1d141d5Smrg -o) 534a1d141d5Smrg shift 535a1d141d5Smrg ;; 536a1d141d5Smrg $object) 537a1d141d5Smrg shift 538a1d141d5Smrg ;; 539a1d141d5Smrg *) 540a1d141d5Smrg set fnord "$@" "$arg" 541a1d141d5Smrg shift # fnord 542a1d141d5Smrg shift # $arg 543a1d141d5Smrg ;; 544a1d141d5Smrg esac 545a1d141d5Smrg done 546a1d141d5Smrg 547a1d141d5Smrg "$@" -E | 5482ddb6cf1Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 5492ddb6cf1Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 550a1d141d5Smrg sed '$ s: \\$::' > "$tmpdepfile" 551a1d141d5Smrg rm -f "$depfile" 552a1d141d5Smrg echo "$object : \\" > "$depfile" 553a1d141d5Smrg cat < "$tmpdepfile" >> "$depfile" 554a1d141d5Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 555a1d141d5Smrg rm -f "$tmpdepfile" 556a1d141d5Smrg ;; 557a1d141d5Smrg 558a1d141d5Smrgmsvisualcpp) 559a1d141d5Smrg # Important note: in order to support this mode, a compiler *must* 5602ddb6cf1Smrg # always write the preprocessed file to stdout. 561a1d141d5Smrg "$@" || exit $? 5622ddb6cf1Smrg 5632ddb6cf1Smrg # Remove the call to Libtool. 5642ddb6cf1Smrg if test "$libtool" = yes; then 5652ddb6cf1Smrg while test "X$1" != 'X--mode=compile'; do 5662ddb6cf1Smrg shift 5672ddb6cf1Smrg done 5682ddb6cf1Smrg shift 5692ddb6cf1Smrg fi 5702ddb6cf1Smrg 571a1d141d5Smrg IFS=" " 572a1d141d5Smrg for arg 573a1d141d5Smrg do 574a1d141d5Smrg case "$arg" in 5752ddb6cf1Smrg -o) 5762ddb6cf1Smrg shift 5772ddb6cf1Smrg ;; 5782ddb6cf1Smrg $object) 5792ddb6cf1Smrg shift 5802ddb6cf1Smrg ;; 581a1d141d5Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 582a1d141d5Smrg set fnord "$@" 583a1d141d5Smrg shift 584a1d141d5Smrg shift 585a1d141d5Smrg ;; 586a1d141d5Smrg *) 587a1d141d5Smrg set fnord "$@" "$arg" 588a1d141d5Smrg shift 589a1d141d5Smrg shift 590a1d141d5Smrg ;; 591a1d141d5Smrg esac 592a1d141d5Smrg done 5932ddb6cf1Smrg "$@" -E 2>/dev/null | 5942ddb6cf1Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 595a1d141d5Smrg rm -f "$depfile" 596a1d141d5Smrg echo "$object : \\" > "$depfile" 5972ddb6cf1Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 598a1d141d5Smrg echo " " >> "$depfile" 5992ddb6cf1Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 600a1d141d5Smrg rm -f "$tmpdepfile" 601a1d141d5Smrg ;; 602a1d141d5Smrg 6032ddb6cf1Smrgmsvcmsys) 6042ddb6cf1Smrg # This case exists only to let depend.m4 do its work. It works by 6052ddb6cf1Smrg # looking at the text of this script. This case will never be run, 6062ddb6cf1Smrg # since it is checked for above. 6072ddb6cf1Smrg exit 1 6082ddb6cf1Smrg ;; 6092ddb6cf1Smrg 610a1d141d5Smrgnone) 611a1d141d5Smrg exec "$@" 612a1d141d5Smrg ;; 613a1d141d5Smrg 614a1d141d5Smrg*) 615a1d141d5Smrg echo "Unknown depmode $depmode" 1>&2 616a1d141d5Smrg exit 1 617a1d141d5Smrg ;; 618a1d141d5Smrgesac 619a1d141d5Smrg 620a1d141d5Smrgexit 0 6212ddb6cf1Smrg 6222ddb6cf1Smrg# Local Variables: 6232ddb6cf1Smrg# mode: shell-script 6242ddb6cf1Smrg# sh-indentation: 2 6252ddb6cf1Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 6262ddb6cf1Smrg# time-stamp-start: "scriptversion=" 6272ddb6cf1Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6282ddb6cf1Smrg# time-stamp-time-zone: "UTC" 6292ddb6cf1Smrg# time-stamp-end: "; # UTC" 6302ddb6cf1Smrg# End: 631