depcomp revision 5bcb6992
1bd1da9d7Smrg#! /bin/sh 2bd1da9d7Smrg# depcomp - compile a program generating dependencies as side-effects 3bd1da9d7Smrg 45bcb6992Smrgscriptversion=2009-04-28.21; # UTC 5bd1da9d7Smrg 65bcb6992Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 75bcb6992Smrg# Software Foundation, Inc. 8bd1da9d7Smrg 9bd1da9d7Smrg# This program is free software; you can redistribute it and/or modify 10bd1da9d7Smrg# it under the terms of the GNU General Public License as published by 11bd1da9d7Smrg# the Free Software Foundation; either version 2, or (at your option) 12bd1da9d7Smrg# any later version. 13bd1da9d7Smrg 14bd1da9d7Smrg# This program is distributed in the hope that it will be useful, 15bd1da9d7Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16bd1da9d7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17bd1da9d7Smrg# GNU General Public License for more details. 18bd1da9d7Smrg 19bd1da9d7Smrg# You should have received a copy of the GNU General Public License 205bcb6992Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21bd1da9d7Smrg 22bd1da9d7Smrg# As a special exception to the GNU General Public License, if you 23bd1da9d7Smrg# distribute this file as part of a program that contains a 24bd1da9d7Smrg# configuration script generated by Autoconf, you may include it under 25bd1da9d7Smrg# the same distribution terms that you use for the rest of that program. 26bd1da9d7Smrg 27bd1da9d7Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 28bd1da9d7Smrg 29bd1da9d7Smrgcase $1 in 30bd1da9d7Smrg '') 31bd1da9d7Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 32bd1da9d7Smrg exit 1; 33bd1da9d7Smrg ;; 34bd1da9d7Smrg -h | --h*) 35bd1da9d7Smrg cat <<\EOF 36bd1da9d7SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 37bd1da9d7Smrg 38bd1da9d7SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 39bd1da9d7Smrgas side-effects. 40bd1da9d7Smrg 41bd1da9d7SmrgEnvironment variables: 42bd1da9d7Smrg depmode Dependency tracking mode. 43bd1da9d7Smrg source Source file read by `PROGRAMS ARGS'. 44bd1da9d7Smrg object Object file output by `PROGRAMS ARGS'. 45bd1da9d7Smrg DEPDIR directory where to store dependencies. 46bd1da9d7Smrg depfile Dependency file to output. 47bd1da9d7Smrg tmpdepfile Temporary file to use when outputing dependencies. 48bd1da9d7Smrg libtool Whether libtool is used (yes/no). 49bd1da9d7Smrg 50bd1da9d7SmrgReport bugs to <bug-automake@gnu.org>. 51bd1da9d7SmrgEOF 52bd1da9d7Smrg exit $? 53bd1da9d7Smrg ;; 54bd1da9d7Smrg -v | --v*) 55bd1da9d7Smrg echo "depcomp $scriptversion" 56bd1da9d7Smrg exit $? 57bd1da9d7Smrg ;; 58bd1da9d7Smrgesac 59bd1da9d7Smrg 60bd1da9d7Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 61bd1da9d7Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 62bd1da9d7Smrg exit 1 63bd1da9d7Smrgfi 64bd1da9d7Smrg 65bd1da9d7Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 66bd1da9d7Smrgdepfile=${depfile-`echo "$object" | 67bd1da9d7Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 68bd1da9d7Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 69bd1da9d7Smrg 70bd1da9d7Smrgrm -f "$tmpdepfile" 71bd1da9d7Smrg 72bd1da9d7Smrg# Some modes work just like other modes, but use different flags. We 73bd1da9d7Smrg# parameterize here, but still list the modes in the big case below, 74bd1da9d7Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 75bd1da9d7Smrg# here, because this file can only contain one case statement. 76bd1da9d7Smrgif test "$depmode" = hp; then 77bd1da9d7Smrg # HP compiler uses -M and no extra arg. 78bd1da9d7Smrg gccflag=-M 79bd1da9d7Smrg depmode=gcc 80bd1da9d7Smrgfi 81bd1da9d7Smrg 82bd1da9d7Smrgif test "$depmode" = dashXmstdout; then 83bd1da9d7Smrg # This is just like dashmstdout with a different argument. 84bd1da9d7Smrg dashmflag=-xM 85bd1da9d7Smrg depmode=dashmstdout 86bd1da9d7Smrgfi 87bd1da9d7Smrg 885bcb6992Smrgcygpath_u="cygpath -u -f -" 895bcb6992Smrgif test "$depmode" = msvcmsys; then 905bcb6992Smrg # This is just like msvisualcpp but w/o cygpath translation. 915bcb6992Smrg # Just convert the backslash-escaped backslashes to single forward 925bcb6992Smrg # slashes to satisfy depend.m4 935bcb6992Smrg cygpath_u="sed s,\\\\\\\\,/,g" 945bcb6992Smrg depmode=msvisualcpp 955bcb6992Smrgfi 965bcb6992Smrg 97bd1da9d7Smrgcase "$depmode" in 98bd1da9d7Smrggcc3) 99bd1da9d7Smrg## gcc 3 implements dependency tracking that does exactly what 100bd1da9d7Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 101bd1da9d7Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 1025bcb6992Smrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1035bcb6992Smrg## the command line argument order; so add the flags where they 1045bcb6992Smrg## appear in depend2.am. Note that the slowdown incurred here 1055bcb6992Smrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1065bcb6992Smrg for arg 1075bcb6992Smrg do 1085bcb6992Smrg case $arg in 1095bcb6992Smrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1105bcb6992Smrg *) set fnord "$@" "$arg" ;; 1115bcb6992Smrg esac 1125bcb6992Smrg shift # fnord 1135bcb6992Smrg shift # $arg 1145bcb6992Smrg done 1155bcb6992Smrg "$@" 116bd1da9d7Smrg stat=$? 117bd1da9d7Smrg if test $stat -eq 0; then : 118bd1da9d7Smrg else 119bd1da9d7Smrg rm -f "$tmpdepfile" 120bd1da9d7Smrg exit $stat 121bd1da9d7Smrg fi 122bd1da9d7Smrg mv "$tmpdepfile" "$depfile" 123bd1da9d7Smrg ;; 124bd1da9d7Smrg 125bd1da9d7Smrggcc) 126bd1da9d7Smrg## There are various ways to get dependency output from gcc. Here's 127bd1da9d7Smrg## why we pick this rather obscure method: 128bd1da9d7Smrg## - Don't want to use -MD because we'd like the dependencies to end 129bd1da9d7Smrg## up in a subdir. Having to rename by hand is ugly. 130bd1da9d7Smrg## (We might end up doing this anyway to support other compilers.) 131bd1da9d7Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 132bd1da9d7Smrg## -MM, not -M (despite what the docs say). 133bd1da9d7Smrg## - Using -M directly means running the compiler twice (even worse 134bd1da9d7Smrg## than renaming). 135bd1da9d7Smrg if test -z "$gccflag"; then 136bd1da9d7Smrg gccflag=-MD, 137bd1da9d7Smrg fi 138bd1da9d7Smrg "$@" -Wp,"$gccflag$tmpdepfile" 139bd1da9d7Smrg stat=$? 140bd1da9d7Smrg if test $stat -eq 0; then : 141bd1da9d7Smrg else 142bd1da9d7Smrg rm -f "$tmpdepfile" 143bd1da9d7Smrg exit $stat 144bd1da9d7Smrg fi 145bd1da9d7Smrg rm -f "$depfile" 146bd1da9d7Smrg echo "$object : \\" > "$depfile" 147bd1da9d7Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 148bd1da9d7Smrg## The second -e expression handles DOS-style file names with drive letters. 149bd1da9d7Smrg sed -e 's/^[^:]*: / /' \ 150bd1da9d7Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 151bd1da9d7Smrg## This next piece of magic avoids the `deleted header file' problem. 152bd1da9d7Smrg## The problem is that when a header file which appears in a .P file 153bd1da9d7Smrg## is deleted, the dependency causes make to die (because there is 154bd1da9d7Smrg## typically no way to rebuild the header). We avoid this by adding 155bd1da9d7Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 156bd1da9d7Smrg## this for us directly. 157bd1da9d7Smrg tr ' ' ' 158bd1da9d7Smrg' < "$tmpdepfile" | 159bd1da9d7Smrg## Some versions of gcc put a space before the `:'. On the theory 160bd1da9d7Smrg## that the space means something, we add a space to the output as 161bd1da9d7Smrg## well. 162bd1da9d7Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 163bd1da9d7Smrg## correctly. Breaking it into two sed invocations is a workaround. 164bd1da9d7Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 165bd1da9d7Smrg rm -f "$tmpdepfile" 166bd1da9d7Smrg ;; 167bd1da9d7Smrg 168bd1da9d7Smrghp) 169bd1da9d7Smrg # This case exists only to let depend.m4 do its work. It works by 170bd1da9d7Smrg # looking at the text of this script. This case will never be run, 171bd1da9d7Smrg # since it is checked for above. 172bd1da9d7Smrg exit 1 173bd1da9d7Smrg ;; 174bd1da9d7Smrg 175bd1da9d7Smrgsgi) 176bd1da9d7Smrg if test "$libtool" = yes; then 177bd1da9d7Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 178bd1da9d7Smrg else 179bd1da9d7Smrg "$@" -MDupdate "$tmpdepfile" 180bd1da9d7Smrg fi 181bd1da9d7Smrg stat=$? 182bd1da9d7Smrg if test $stat -eq 0; then : 183bd1da9d7Smrg else 184bd1da9d7Smrg rm -f "$tmpdepfile" 185bd1da9d7Smrg exit $stat 186bd1da9d7Smrg fi 187bd1da9d7Smrg rm -f "$depfile" 188bd1da9d7Smrg 189bd1da9d7Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 190bd1da9d7Smrg echo "$object : \\" > "$depfile" 191bd1da9d7Smrg 192bd1da9d7Smrg # Clip off the initial element (the dependent). Don't try to be 193bd1da9d7Smrg # clever and replace this with sed code, as IRIX sed won't handle 194bd1da9d7Smrg # lines with more than a fixed number of characters (4096 in 195bd1da9d7Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 196bd1da9d7Smrg # the IRIX cc adds comments like `#:fec' to the end of the 197bd1da9d7Smrg # dependency line. 198bd1da9d7Smrg tr ' ' ' 199bd1da9d7Smrg' < "$tmpdepfile" \ 200bd1da9d7Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 201bd1da9d7Smrg tr ' 2025bcb6992Smrg' ' ' >> "$depfile" 2035bcb6992Smrg echo >> "$depfile" 204bd1da9d7Smrg 205bd1da9d7Smrg # The second pass generates a dummy entry for each header file. 206bd1da9d7Smrg tr ' ' ' 207bd1da9d7Smrg' < "$tmpdepfile" \ 208bd1da9d7Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2095bcb6992Smrg >> "$depfile" 210bd1da9d7Smrg else 211bd1da9d7Smrg # The sourcefile does not contain any dependencies, so just 212bd1da9d7Smrg # store a dummy comment line, to avoid errors with the Makefile 213bd1da9d7Smrg # "include basename.Plo" scheme. 214bd1da9d7Smrg echo "#dummy" > "$depfile" 215bd1da9d7Smrg fi 216bd1da9d7Smrg rm -f "$tmpdepfile" 217bd1da9d7Smrg ;; 218bd1da9d7Smrg 219bd1da9d7Smrgaix) 220bd1da9d7Smrg # The C for AIX Compiler uses -M and outputs the dependencies 221bd1da9d7Smrg # in a .u file. In older versions, this file always lives in the 222bd1da9d7Smrg # current directory. Also, the AIX compiler puts `$object:' at the 223bd1da9d7Smrg # start of each line; $object doesn't have directory information. 224bd1da9d7Smrg # Version 6 uses the directory in both cases. 2255bcb6992Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2265bcb6992Smrg test "x$dir" = "x$object" && dir= 2275bcb6992Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 228bd1da9d7Smrg if test "$libtool" = yes; then 2295bcb6992Smrg tmpdepfile1=$dir$base.u 2305bcb6992Smrg tmpdepfile2=$base.u 2315bcb6992Smrg tmpdepfile3=$dir.libs/$base.u 232bd1da9d7Smrg "$@" -Wc,-M 233bd1da9d7Smrg else 2345bcb6992Smrg tmpdepfile1=$dir$base.u 2355bcb6992Smrg tmpdepfile2=$dir$base.u 2365bcb6992Smrg tmpdepfile3=$dir$base.u 237bd1da9d7Smrg "$@" -M 238bd1da9d7Smrg fi 239bd1da9d7Smrg stat=$? 240bd1da9d7Smrg 241bd1da9d7Smrg if test $stat -eq 0; then : 242bd1da9d7Smrg else 2435bcb6992Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 244bd1da9d7Smrg exit $stat 245bd1da9d7Smrg fi 246bd1da9d7Smrg 2475bcb6992Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2485bcb6992Smrg do 2495bcb6992Smrg test -f "$tmpdepfile" && break 2505bcb6992Smrg done 251bd1da9d7Smrg if test -f "$tmpdepfile"; then 252bd1da9d7Smrg # Each line is of the form `foo.o: dependent.h'. 253bd1da9d7Smrg # Do two passes, one to just change these to 254bd1da9d7Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 2555bcb6992Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2565bcb6992Smrg # That's a tab and a space in the []. 2575bcb6992Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 258bd1da9d7Smrg else 259bd1da9d7Smrg # The sourcefile does not contain any dependencies, so just 260bd1da9d7Smrg # store a dummy comment line, to avoid errors with the Makefile 261bd1da9d7Smrg # "include basename.Plo" scheme. 262bd1da9d7Smrg echo "#dummy" > "$depfile" 263bd1da9d7Smrg fi 264bd1da9d7Smrg rm -f "$tmpdepfile" 265bd1da9d7Smrg ;; 266bd1da9d7Smrg 267bd1da9d7Smrgicc) 268bd1da9d7Smrg # Intel's C compiler understands `-MD -MF file'. However on 269bd1da9d7Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 270bd1da9d7Smrg # ICC 7.0 will fill foo.d with something like 271bd1da9d7Smrg # foo.o: sub/foo.c 272bd1da9d7Smrg # foo.o: sub/foo.h 273bd1da9d7Smrg # which is wrong. We want: 274bd1da9d7Smrg # sub/foo.o: sub/foo.c 275bd1da9d7Smrg # sub/foo.o: sub/foo.h 276bd1da9d7Smrg # sub/foo.c: 277bd1da9d7Smrg # sub/foo.h: 278bd1da9d7Smrg # ICC 7.1 will output 279bd1da9d7Smrg # foo.o: sub/foo.c sub/foo.h 280bd1da9d7Smrg # and will wrap long lines using \ : 281bd1da9d7Smrg # foo.o: sub/foo.c ... \ 282bd1da9d7Smrg # sub/foo.h ... \ 283bd1da9d7Smrg # ... 284bd1da9d7Smrg 285bd1da9d7Smrg "$@" -MD -MF "$tmpdepfile" 286bd1da9d7Smrg stat=$? 287bd1da9d7Smrg if test $stat -eq 0; then : 288bd1da9d7Smrg else 289bd1da9d7Smrg rm -f "$tmpdepfile" 290bd1da9d7Smrg exit $stat 291bd1da9d7Smrg fi 292bd1da9d7Smrg rm -f "$depfile" 293bd1da9d7Smrg # Each line is of the form `foo.o: dependent.h', 294bd1da9d7Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 295bd1da9d7Smrg # Do two passes, one to just change these to 296bd1da9d7Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 297bd1da9d7Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 298bd1da9d7Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 299bd1da9d7Smrg # correctly. Breaking it into two sed invocations is a workaround. 300bd1da9d7Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 301bd1da9d7Smrg sed -e 's/$/ :/' >> "$depfile" 302bd1da9d7Smrg rm -f "$tmpdepfile" 303bd1da9d7Smrg ;; 304bd1da9d7Smrg 3055bcb6992Smrghp2) 3065bcb6992Smrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3075bcb6992Smrg # compilers, which have integrated preprocessors. The correct option 3085bcb6992Smrg # to use with these is +Maked; it writes dependencies to a file named 3095bcb6992Smrg # 'foo.d', which lands next to the object file, wherever that 3105bcb6992Smrg # happens to be. 3115bcb6992Smrg # Much of this is similar to the tru64 case; see comments there. 3125bcb6992Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3135bcb6992Smrg test "x$dir" = "x$object" && dir= 3145bcb6992Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3155bcb6992Smrg if test "$libtool" = yes; then 3165bcb6992Smrg tmpdepfile1=$dir$base.d 3175bcb6992Smrg tmpdepfile2=$dir.libs/$base.d 3185bcb6992Smrg "$@" -Wc,+Maked 3195bcb6992Smrg else 3205bcb6992Smrg tmpdepfile1=$dir$base.d 3215bcb6992Smrg tmpdepfile2=$dir$base.d 3225bcb6992Smrg "$@" +Maked 3235bcb6992Smrg fi 3245bcb6992Smrg stat=$? 3255bcb6992Smrg if test $stat -eq 0; then : 3265bcb6992Smrg else 3275bcb6992Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3285bcb6992Smrg exit $stat 3295bcb6992Smrg fi 3305bcb6992Smrg 3315bcb6992Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3325bcb6992Smrg do 3335bcb6992Smrg test -f "$tmpdepfile" && break 3345bcb6992Smrg done 3355bcb6992Smrg if test -f "$tmpdepfile"; then 3365bcb6992Smrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3375bcb6992Smrg # Add `dependent.h:' lines. 3385bcb6992Smrg sed -ne '2,${ 3395bcb6992Smrg s/^ *// 3405bcb6992Smrg s/ \\*$// 3415bcb6992Smrg s/$/:/ 3425bcb6992Smrg p 3435bcb6992Smrg }' "$tmpdepfile" >> "$depfile" 3445bcb6992Smrg else 3455bcb6992Smrg echo "#dummy" > "$depfile" 3465bcb6992Smrg fi 3475bcb6992Smrg rm -f "$tmpdepfile" "$tmpdepfile2" 3485bcb6992Smrg ;; 3495bcb6992Smrg 350bd1da9d7Smrgtru64) 351bd1da9d7Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 352bd1da9d7Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 353bd1da9d7Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 354bd1da9d7Smrg # dependencies in `foo.d' instead, so we check for that too. 355bd1da9d7Smrg # Subdirectories are respected. 356bd1da9d7Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 357bd1da9d7Smrg test "x$dir" = "x$object" && dir= 358bd1da9d7Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 359bd1da9d7Smrg 360bd1da9d7Smrg if test "$libtool" = yes; then 361bd1da9d7Smrg # With Tru64 cc, shared objects can also be used to make a 3625bcb6992Smrg # static library. This mechanism is used in libtool 1.4 series to 363bd1da9d7Smrg # handle both shared and static libraries in a single compilation. 364bd1da9d7Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 365bd1da9d7Smrg # 366bd1da9d7Smrg # With libtool 1.5 this exception was removed, and libtool now 367bd1da9d7Smrg # generates 2 separate objects for the 2 libraries. These two 3685bcb6992Smrg # compilations output dependencies in $dir.libs/$base.o.d and 369bd1da9d7Smrg # in $dir$base.o.d. We have to check for both files, because 370bd1da9d7Smrg # one of the two compilations can be disabled. We should prefer 371bd1da9d7Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 372bd1da9d7Smrg # automatically cleaned when .libs/ is deleted, while ignoring 373bd1da9d7Smrg # the former would cause a distcleancheck panic. 374bd1da9d7Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 375bd1da9d7Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 376bd1da9d7Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 377bd1da9d7Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 378bd1da9d7Smrg "$@" -Wc,-MD 379bd1da9d7Smrg else 380bd1da9d7Smrg tmpdepfile1=$dir$base.o.d 381bd1da9d7Smrg tmpdepfile2=$dir$base.d 382bd1da9d7Smrg tmpdepfile3=$dir$base.d 383bd1da9d7Smrg tmpdepfile4=$dir$base.d 384bd1da9d7Smrg "$@" -MD 385bd1da9d7Smrg fi 386bd1da9d7Smrg 387bd1da9d7Smrg stat=$? 388bd1da9d7Smrg if test $stat -eq 0; then : 389bd1da9d7Smrg else 390bd1da9d7Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 391bd1da9d7Smrg exit $stat 392bd1da9d7Smrg fi 393bd1da9d7Smrg 394bd1da9d7Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 395bd1da9d7Smrg do 396bd1da9d7Smrg test -f "$tmpdepfile" && break 397bd1da9d7Smrg done 398bd1da9d7Smrg if test -f "$tmpdepfile"; then 399bd1da9d7Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 400bd1da9d7Smrg # That's a tab and a space in the []. 401bd1da9d7Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 402bd1da9d7Smrg else 403bd1da9d7Smrg echo "#dummy" > "$depfile" 404bd1da9d7Smrg fi 405bd1da9d7Smrg rm -f "$tmpdepfile" 406bd1da9d7Smrg ;; 407bd1da9d7Smrg 408bd1da9d7Smrg#nosideeffect) 409bd1da9d7Smrg # This comment above is used by automake to tell side-effect 410bd1da9d7Smrg # dependency tracking mechanisms from slower ones. 411bd1da9d7Smrg 412bd1da9d7Smrgdashmstdout) 413bd1da9d7Smrg # Important note: in order to support this mode, a compiler *must* 414bd1da9d7Smrg # always write the preprocessed file to stdout, regardless of -o. 415bd1da9d7Smrg "$@" || exit $? 416bd1da9d7Smrg 417bd1da9d7Smrg # Remove the call to Libtool. 418bd1da9d7Smrg if test "$libtool" = yes; then 4195bcb6992Smrg while test "X$1" != 'X--mode=compile'; do 420bd1da9d7Smrg shift 421bd1da9d7Smrg done 422bd1da9d7Smrg shift 423bd1da9d7Smrg fi 424bd1da9d7Smrg 425bd1da9d7Smrg # Remove `-o $object'. 426bd1da9d7Smrg IFS=" " 427bd1da9d7Smrg for arg 428bd1da9d7Smrg do 429bd1da9d7Smrg case $arg in 430bd1da9d7Smrg -o) 431bd1da9d7Smrg shift 432bd1da9d7Smrg ;; 433bd1da9d7Smrg $object) 434bd1da9d7Smrg shift 435bd1da9d7Smrg ;; 436bd1da9d7Smrg *) 437bd1da9d7Smrg set fnord "$@" "$arg" 438bd1da9d7Smrg shift # fnord 439bd1da9d7Smrg shift # $arg 440bd1da9d7Smrg ;; 441bd1da9d7Smrg esac 442bd1da9d7Smrg done 443bd1da9d7Smrg 444bd1da9d7Smrg test -z "$dashmflag" && dashmflag=-M 445bd1da9d7Smrg # Require at least two characters before searching for `:' 446bd1da9d7Smrg # in the target name. This is to cope with DOS-style filenames: 447bd1da9d7Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 448bd1da9d7Smrg "$@" $dashmflag | 449bd1da9d7Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 450bd1da9d7Smrg rm -f "$depfile" 451bd1da9d7Smrg cat < "$tmpdepfile" > "$depfile" 452bd1da9d7Smrg tr ' ' ' 453bd1da9d7Smrg' < "$tmpdepfile" | \ 454bd1da9d7Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 455bd1da9d7Smrg## correctly. Breaking it into two sed invocations is a workaround. 456bd1da9d7Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 457bd1da9d7Smrg rm -f "$tmpdepfile" 458bd1da9d7Smrg ;; 459bd1da9d7Smrg 460bd1da9d7SmrgdashXmstdout) 461bd1da9d7Smrg # This case only exists to satisfy depend.m4. It is never actually 462bd1da9d7Smrg # run, as this mode is specially recognized in the preamble. 463bd1da9d7Smrg exit 1 464bd1da9d7Smrg ;; 465bd1da9d7Smrg 466bd1da9d7Smrgmakedepend) 467bd1da9d7Smrg "$@" || exit $? 468bd1da9d7Smrg # Remove any Libtool call 469bd1da9d7Smrg if test "$libtool" = yes; then 4705bcb6992Smrg while test "X$1" != 'X--mode=compile'; do 471bd1da9d7Smrg shift 472bd1da9d7Smrg done 473bd1da9d7Smrg shift 474bd1da9d7Smrg fi 475bd1da9d7Smrg # X makedepend 476bd1da9d7Smrg shift 4775bcb6992Smrg cleared=no eat=no 4785bcb6992Smrg for arg 4795bcb6992Smrg do 480bd1da9d7Smrg case $cleared in 481bd1da9d7Smrg no) 482bd1da9d7Smrg set ""; shift 483bd1da9d7Smrg cleared=yes ;; 484bd1da9d7Smrg esac 4855bcb6992Smrg if test $eat = yes; then 4865bcb6992Smrg eat=no 4875bcb6992Smrg continue 4885bcb6992Smrg fi 489bd1da9d7Smrg case "$arg" in 490bd1da9d7Smrg -D*|-I*) 491bd1da9d7Smrg set fnord "$@" "$arg"; shift ;; 492bd1da9d7Smrg # Strip any option that makedepend may not understand. Remove 493bd1da9d7Smrg # the object too, otherwise makedepend will parse it as a source file. 4945bcb6992Smrg -arch) 4955bcb6992Smrg eat=yes ;; 496bd1da9d7Smrg -*|$object) 497bd1da9d7Smrg ;; 498bd1da9d7Smrg *) 499bd1da9d7Smrg set fnord "$@" "$arg"; shift ;; 500bd1da9d7Smrg esac 501bd1da9d7Smrg done 5025bcb6992Smrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 503bd1da9d7Smrg touch "$tmpdepfile" 504bd1da9d7Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 505bd1da9d7Smrg rm -f "$depfile" 506bd1da9d7Smrg cat < "$tmpdepfile" > "$depfile" 507bd1da9d7Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 508bd1da9d7Smrg' | \ 509bd1da9d7Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 510bd1da9d7Smrg## correctly. Breaking it into two sed invocations is a workaround. 511bd1da9d7Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 512bd1da9d7Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 513bd1da9d7Smrg ;; 514bd1da9d7Smrg 515bd1da9d7Smrgcpp) 516bd1da9d7Smrg # Important note: in order to support this mode, a compiler *must* 517bd1da9d7Smrg # always write the preprocessed file to stdout. 518bd1da9d7Smrg "$@" || exit $? 519bd1da9d7Smrg 520bd1da9d7Smrg # Remove the call to Libtool. 521bd1da9d7Smrg if test "$libtool" = yes; then 5225bcb6992Smrg while test "X$1" != 'X--mode=compile'; do 523bd1da9d7Smrg shift 524bd1da9d7Smrg done 525bd1da9d7Smrg shift 526bd1da9d7Smrg fi 527bd1da9d7Smrg 528bd1da9d7Smrg # Remove `-o $object'. 529bd1da9d7Smrg IFS=" " 530bd1da9d7Smrg for arg 531bd1da9d7Smrg do 532bd1da9d7Smrg case $arg in 533bd1da9d7Smrg -o) 534bd1da9d7Smrg shift 535bd1da9d7Smrg ;; 536bd1da9d7Smrg $object) 537bd1da9d7Smrg shift 538bd1da9d7Smrg ;; 539bd1da9d7Smrg *) 540bd1da9d7Smrg set fnord "$@" "$arg" 541bd1da9d7Smrg shift # fnord 542bd1da9d7Smrg shift # $arg 543bd1da9d7Smrg ;; 544bd1da9d7Smrg esac 545bd1da9d7Smrg done 546bd1da9d7Smrg 547bd1da9d7Smrg "$@" -E | 548bd1da9d7Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 549bd1da9d7Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 550bd1da9d7Smrg sed '$ s: \\$::' > "$tmpdepfile" 551bd1da9d7Smrg rm -f "$depfile" 552bd1da9d7Smrg echo "$object : \\" > "$depfile" 553bd1da9d7Smrg cat < "$tmpdepfile" >> "$depfile" 554bd1da9d7Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 555bd1da9d7Smrg rm -f "$tmpdepfile" 556bd1da9d7Smrg ;; 557bd1da9d7Smrg 558bd1da9d7Smrgmsvisualcpp) 559bd1da9d7Smrg # Important note: in order to support this mode, a compiler *must* 5605bcb6992Smrg # always write the preprocessed file to stdout. 561bd1da9d7Smrg "$@" || exit $? 5625bcb6992Smrg 5635bcb6992Smrg # Remove the call to Libtool. 5645bcb6992Smrg if test "$libtool" = yes; then 5655bcb6992Smrg while test "X$1" != 'X--mode=compile'; do 5665bcb6992Smrg shift 5675bcb6992Smrg done 5685bcb6992Smrg shift 5695bcb6992Smrg fi 5705bcb6992Smrg 571bd1da9d7Smrg IFS=" " 572bd1da9d7Smrg for arg 573bd1da9d7Smrg do 574bd1da9d7Smrg case "$arg" in 5755bcb6992Smrg -o) 5765bcb6992Smrg shift 5775bcb6992Smrg ;; 5785bcb6992Smrg $object) 5795bcb6992Smrg shift 5805bcb6992Smrg ;; 581bd1da9d7Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 582bd1da9d7Smrg set fnord "$@" 583bd1da9d7Smrg shift 584bd1da9d7Smrg shift 585bd1da9d7Smrg ;; 586bd1da9d7Smrg *) 587bd1da9d7Smrg set fnord "$@" "$arg" 588bd1da9d7Smrg shift 589bd1da9d7Smrg shift 590bd1da9d7Smrg ;; 591bd1da9d7Smrg esac 592bd1da9d7Smrg done 5935bcb6992Smrg "$@" -E 2>/dev/null | 5945bcb6992Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 595bd1da9d7Smrg rm -f "$depfile" 596bd1da9d7Smrg echo "$object : \\" > "$depfile" 5975bcb6992Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 598bd1da9d7Smrg echo " " >> "$depfile" 5995bcb6992Smrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 600bd1da9d7Smrg rm -f "$tmpdepfile" 601bd1da9d7Smrg ;; 602bd1da9d7Smrg 6035bcb6992Smrgmsvcmsys) 6045bcb6992Smrg # This case exists only to let depend.m4 do its work. It works by 6055bcb6992Smrg # looking at the text of this script. This case will never be run, 6065bcb6992Smrg # since it is checked for above. 6075bcb6992Smrg exit 1 6085bcb6992Smrg ;; 6095bcb6992Smrg 610bd1da9d7Smrgnone) 611bd1da9d7Smrg exec "$@" 612bd1da9d7Smrg ;; 613bd1da9d7Smrg 614bd1da9d7Smrg*) 615bd1da9d7Smrg echo "Unknown depmode $depmode" 1>&2 616bd1da9d7Smrg exit 1 617bd1da9d7Smrg ;; 618bd1da9d7Smrgesac 619bd1da9d7Smrg 620bd1da9d7Smrgexit 0 621bd1da9d7Smrg 622bd1da9d7Smrg# Local Variables: 623bd1da9d7Smrg# mode: shell-script 624bd1da9d7Smrg# sh-indentation: 2 625bd1da9d7Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 626bd1da9d7Smrg# time-stamp-start: "scriptversion=" 627bd1da9d7Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6285bcb6992Smrg# time-stamp-time-zone: "UTC" 6295bcb6992Smrg# time-stamp-end: "; # UTC" 630bd1da9d7Smrg# End: 631