1ecce36beSmrg#! /bin/sh 2ecce36beSmrg# depcomp - compile a program generating dependencies as side-effects 3ecce36beSmrg 4ecce36beSmrgscriptversion=2009-04-28.21; # UTC 5ecce36beSmrg 6ecce36beSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 7ecce36beSmrg# Software Foundation, Inc. 8ecce36beSmrg 9ecce36beSmrg# This program is free software; you can redistribute it and/or modify 10ecce36beSmrg# it under the terms of the GNU General Public License as published by 11ecce36beSmrg# the Free Software Foundation; either version 2, or (at your option) 12ecce36beSmrg# any later version. 13ecce36beSmrg 14ecce36beSmrg# This program is distributed in the hope that it will be useful, 15ecce36beSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16ecce36beSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17ecce36beSmrg# GNU General Public License for more details. 18ecce36beSmrg 19ecce36beSmrg# You should have received a copy of the GNU General Public License 20ecce36beSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21ecce36beSmrg 22ecce36beSmrg# As a special exception to the GNU General Public License, if you 23ecce36beSmrg# distribute this file as part of a program that contains a 24ecce36beSmrg# configuration script generated by Autoconf, you may include it under 25ecce36beSmrg# the same distribution terms that you use for the rest of that program. 26ecce36beSmrg 27ecce36beSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 28ecce36beSmrg 29ecce36beSmrgcase $1 in 30ecce36beSmrg '') 31ecce36beSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 32ecce36beSmrg exit 1; 33ecce36beSmrg ;; 34ecce36beSmrg -h | --h*) 35ecce36beSmrg cat <<\EOF 36ecce36beSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 37ecce36beSmrg 38ecce36beSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 39ecce36beSmrgas side-effects. 40ecce36beSmrg 41ecce36beSmrgEnvironment variables: 42ecce36beSmrg depmode Dependency tracking mode. 43ecce36beSmrg source Source file read by `PROGRAMS ARGS'. 44ecce36beSmrg object Object file output by `PROGRAMS ARGS'. 45ecce36beSmrg DEPDIR directory where to store dependencies. 46ecce36beSmrg depfile Dependency file to output. 47ecce36beSmrg tmpdepfile Temporary file to use when outputing dependencies. 48ecce36beSmrg libtool Whether libtool is used (yes/no). 49ecce36beSmrg 50ecce36beSmrgReport bugs to <bug-automake@gnu.org>. 51ecce36beSmrgEOF 52ecce36beSmrg exit $? 53ecce36beSmrg ;; 54ecce36beSmrg -v | --v*) 55ecce36beSmrg echo "depcomp $scriptversion" 56ecce36beSmrg exit $? 57ecce36beSmrg ;; 58ecce36beSmrgesac 59ecce36beSmrg 60ecce36beSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 61ecce36beSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 62ecce36beSmrg exit 1 63ecce36beSmrgfi 64ecce36beSmrg 65ecce36beSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 66ecce36beSmrgdepfile=${depfile-`echo "$object" | 67ecce36beSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 68ecce36beSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 69ecce36beSmrg 70ecce36beSmrgrm -f "$tmpdepfile" 71ecce36beSmrg 72ecce36beSmrg# Some modes work just like other modes, but use different flags. We 73ecce36beSmrg# parameterize here, but still list the modes in the big case below, 74ecce36beSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 75ecce36beSmrg# here, because this file can only contain one case statement. 76ecce36beSmrgif test "$depmode" = hp; then 77ecce36beSmrg # HP compiler uses -M and no extra arg. 78ecce36beSmrg gccflag=-M 79ecce36beSmrg depmode=gcc 80ecce36beSmrgfi 81ecce36beSmrg 82ecce36beSmrgif test "$depmode" = dashXmstdout; then 83ecce36beSmrg # This is just like dashmstdout with a different argument. 84ecce36beSmrg dashmflag=-xM 85ecce36beSmrg depmode=dashmstdout 86ecce36beSmrgfi 87ecce36beSmrg 88ecce36beSmrgcygpath_u="cygpath -u -f -" 89ecce36beSmrgif test "$depmode" = msvcmsys; then 90ecce36beSmrg # This is just like msvisualcpp but w/o cygpath translation. 91ecce36beSmrg # Just convert the backslash-escaped backslashes to single forward 92ecce36beSmrg # slashes to satisfy depend.m4 93ecce36beSmrg cygpath_u="sed s,\\\\\\\\,/,g" 94ecce36beSmrg depmode=msvisualcpp 95ecce36beSmrgfi 96ecce36beSmrg 97ecce36beSmrgcase "$depmode" in 98ecce36beSmrggcc3) 99ecce36beSmrg## gcc 3 implements dependency tracking that does exactly what 100ecce36beSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 101ecce36beSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 102ecce36beSmrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 103ecce36beSmrg## the command line argument order; so add the flags where they 104ecce36beSmrg## appear in depend2.am. Note that the slowdown incurred here 105ecce36beSmrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 106ecce36beSmrg for arg 107ecce36beSmrg do 108ecce36beSmrg case $arg in 109ecce36beSmrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 110ecce36beSmrg *) set fnord "$@" "$arg" ;; 111ecce36beSmrg esac 112ecce36beSmrg shift # fnord 113ecce36beSmrg shift # $arg 114ecce36beSmrg done 115ecce36beSmrg "$@" 116ecce36beSmrg stat=$? 117ecce36beSmrg if test $stat -eq 0; then : 118ecce36beSmrg else 119ecce36beSmrg rm -f "$tmpdepfile" 120ecce36beSmrg exit $stat 121ecce36beSmrg fi 122ecce36beSmrg mv "$tmpdepfile" "$depfile" 123ecce36beSmrg ;; 124ecce36beSmrg 125ecce36beSmrggcc) 126ecce36beSmrg## There are various ways to get dependency output from gcc. Here's 127ecce36beSmrg## why we pick this rather obscure method: 128ecce36beSmrg## - Don't want to use -MD because we'd like the dependencies to end 129ecce36beSmrg## up in a subdir. Having to rename by hand is ugly. 130ecce36beSmrg## (We might end up doing this anyway to support other compilers.) 131ecce36beSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 132ecce36beSmrg## -MM, not -M (despite what the docs say). 133ecce36beSmrg## - Using -M directly means running the compiler twice (even worse 134ecce36beSmrg## than renaming). 135ecce36beSmrg if test -z "$gccflag"; then 136ecce36beSmrg gccflag=-MD, 137ecce36beSmrg fi 138ecce36beSmrg "$@" -Wp,"$gccflag$tmpdepfile" 139ecce36beSmrg stat=$? 140ecce36beSmrg if test $stat -eq 0; then : 141ecce36beSmrg else 142ecce36beSmrg rm -f "$tmpdepfile" 143ecce36beSmrg exit $stat 144ecce36beSmrg fi 145ecce36beSmrg rm -f "$depfile" 146ecce36beSmrg echo "$object : \\" > "$depfile" 147ecce36beSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 148ecce36beSmrg## The second -e expression handles DOS-style file names with drive letters. 149ecce36beSmrg sed -e 's/^[^:]*: / /' \ 150ecce36beSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 151ecce36beSmrg## This next piece of magic avoids the `deleted header file' problem. 152ecce36beSmrg## The problem is that when a header file which appears in a .P file 153ecce36beSmrg## is deleted, the dependency causes make to die (because there is 154ecce36beSmrg## typically no way to rebuild the header). We avoid this by adding 155ecce36beSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 156ecce36beSmrg## this for us directly. 157ecce36beSmrg tr ' ' ' 158ecce36beSmrg' < "$tmpdepfile" | 159ecce36beSmrg## Some versions of gcc put a space before the `:'. On the theory 160ecce36beSmrg## that the space means something, we add a space to the output as 161ecce36beSmrg## well. 162ecce36beSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 163ecce36beSmrg## correctly. Breaking it into two sed invocations is a workaround. 164ecce36beSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 165ecce36beSmrg rm -f "$tmpdepfile" 166ecce36beSmrg ;; 167ecce36beSmrg 168ecce36beSmrghp) 169ecce36beSmrg # This case exists only to let depend.m4 do its work. It works by 170ecce36beSmrg # looking at the text of this script. This case will never be run, 171ecce36beSmrg # since it is checked for above. 172ecce36beSmrg exit 1 173ecce36beSmrg ;; 174ecce36beSmrg 175ecce36beSmrgsgi) 176ecce36beSmrg if test "$libtool" = yes; then 177ecce36beSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 178ecce36beSmrg else 179ecce36beSmrg "$@" -MDupdate "$tmpdepfile" 180ecce36beSmrg fi 181ecce36beSmrg stat=$? 182ecce36beSmrg if test $stat -eq 0; then : 183ecce36beSmrg else 184ecce36beSmrg rm -f "$tmpdepfile" 185ecce36beSmrg exit $stat 186ecce36beSmrg fi 187ecce36beSmrg rm -f "$depfile" 188ecce36beSmrg 189ecce36beSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 190ecce36beSmrg echo "$object : \\" > "$depfile" 191ecce36beSmrg 192ecce36beSmrg # Clip off the initial element (the dependent). Don't try to be 193ecce36beSmrg # clever and replace this with sed code, as IRIX sed won't handle 194ecce36beSmrg # lines with more than a fixed number of characters (4096 in 195ecce36beSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 196ecce36beSmrg # the IRIX cc adds comments like `#:fec' to the end of the 197ecce36beSmrg # dependency line. 198ecce36beSmrg tr ' ' ' 199ecce36beSmrg' < "$tmpdepfile" \ 200ecce36beSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 201ecce36beSmrg tr ' 202ecce36beSmrg' ' ' >> "$depfile" 203ecce36beSmrg echo >> "$depfile" 204ecce36beSmrg 205ecce36beSmrg # The second pass generates a dummy entry for each header file. 206ecce36beSmrg tr ' ' ' 207ecce36beSmrg' < "$tmpdepfile" \ 208ecce36beSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 209ecce36beSmrg >> "$depfile" 210ecce36beSmrg else 211ecce36beSmrg # The sourcefile does not contain any dependencies, so just 212ecce36beSmrg # store a dummy comment line, to avoid errors with the Makefile 213ecce36beSmrg # "include basename.Plo" scheme. 214ecce36beSmrg echo "#dummy" > "$depfile" 215ecce36beSmrg fi 216ecce36beSmrg rm -f "$tmpdepfile" 217ecce36beSmrg ;; 218ecce36beSmrg 219ecce36beSmrgaix) 220ecce36beSmrg # The C for AIX Compiler uses -M and outputs the dependencies 221ecce36beSmrg # in a .u file. In older versions, this file always lives in the 222ecce36beSmrg # current directory. Also, the AIX compiler puts `$object:' at the 223ecce36beSmrg # start of each line; $object doesn't have directory information. 224ecce36beSmrg # Version 6 uses the directory in both cases. 225ecce36beSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 226ecce36beSmrg test "x$dir" = "x$object" && dir= 227ecce36beSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 228ecce36beSmrg if test "$libtool" = yes; then 229ecce36beSmrg tmpdepfile1=$dir$base.u 230ecce36beSmrg tmpdepfile2=$base.u 231ecce36beSmrg tmpdepfile3=$dir.libs/$base.u 232ecce36beSmrg "$@" -Wc,-M 233ecce36beSmrg else 234ecce36beSmrg tmpdepfile1=$dir$base.u 235ecce36beSmrg tmpdepfile2=$dir$base.u 236ecce36beSmrg tmpdepfile3=$dir$base.u 237ecce36beSmrg "$@" -M 238ecce36beSmrg fi 239ecce36beSmrg stat=$? 240ecce36beSmrg 241ecce36beSmrg if test $stat -eq 0; then : 242ecce36beSmrg else 243ecce36beSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 244ecce36beSmrg exit $stat 245ecce36beSmrg fi 246ecce36beSmrg 247ecce36beSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 248ecce36beSmrg do 249ecce36beSmrg test -f "$tmpdepfile" && break 250ecce36beSmrg done 251ecce36beSmrg if test -f "$tmpdepfile"; then 252ecce36beSmrg # Each line is of the form `foo.o: dependent.h'. 253ecce36beSmrg # Do two passes, one to just change these to 254ecce36beSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 255ecce36beSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 256ecce36beSmrg # That's a tab and a space in the []. 257ecce36beSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 258ecce36beSmrg else 259ecce36beSmrg # The sourcefile does not contain any dependencies, so just 260ecce36beSmrg # store a dummy comment line, to avoid errors with the Makefile 261ecce36beSmrg # "include basename.Plo" scheme. 262ecce36beSmrg echo "#dummy" > "$depfile" 263ecce36beSmrg fi 264ecce36beSmrg rm -f "$tmpdepfile" 265ecce36beSmrg ;; 266ecce36beSmrg 267ecce36beSmrgicc) 268ecce36beSmrg # Intel's C compiler understands `-MD -MF file'. However on 269ecce36beSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 270ecce36beSmrg # ICC 7.0 will fill foo.d with something like 271ecce36beSmrg # foo.o: sub/foo.c 272ecce36beSmrg # foo.o: sub/foo.h 273ecce36beSmrg # which is wrong. We want: 274ecce36beSmrg # sub/foo.o: sub/foo.c 275ecce36beSmrg # sub/foo.o: sub/foo.h 276ecce36beSmrg # sub/foo.c: 277ecce36beSmrg # sub/foo.h: 278ecce36beSmrg # ICC 7.1 will output 279ecce36beSmrg # foo.o: sub/foo.c sub/foo.h 280ecce36beSmrg # and will wrap long lines using \ : 281ecce36beSmrg # foo.o: sub/foo.c ... \ 282ecce36beSmrg # sub/foo.h ... \ 283ecce36beSmrg # ... 284ecce36beSmrg 285ecce36beSmrg "$@" -MD -MF "$tmpdepfile" 286ecce36beSmrg stat=$? 287ecce36beSmrg if test $stat -eq 0; then : 288ecce36beSmrg else 289ecce36beSmrg rm -f "$tmpdepfile" 290ecce36beSmrg exit $stat 291ecce36beSmrg fi 292ecce36beSmrg rm -f "$depfile" 293ecce36beSmrg # Each line is of the form `foo.o: dependent.h', 294ecce36beSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 295ecce36beSmrg # Do two passes, one to just change these to 296ecce36beSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 297ecce36beSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 298ecce36beSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 299ecce36beSmrg # correctly. Breaking it into two sed invocations is a workaround. 300ecce36beSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 301ecce36beSmrg sed -e 's/$/ :/' >> "$depfile" 302ecce36beSmrg rm -f "$tmpdepfile" 303ecce36beSmrg ;; 304ecce36beSmrg 305ecce36beSmrghp2) 306ecce36beSmrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 307ecce36beSmrg # compilers, which have integrated preprocessors. The correct option 308ecce36beSmrg # to use with these is +Maked; it writes dependencies to a file named 309ecce36beSmrg # 'foo.d', which lands next to the object file, wherever that 310ecce36beSmrg # happens to be. 311ecce36beSmrg # Much of this is similar to the tru64 case; see comments there. 312ecce36beSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 313ecce36beSmrg test "x$dir" = "x$object" && dir= 314ecce36beSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 315ecce36beSmrg if test "$libtool" = yes; then 316ecce36beSmrg tmpdepfile1=$dir$base.d 317ecce36beSmrg tmpdepfile2=$dir.libs/$base.d 318ecce36beSmrg "$@" -Wc,+Maked 319ecce36beSmrg else 320ecce36beSmrg tmpdepfile1=$dir$base.d 321ecce36beSmrg tmpdepfile2=$dir$base.d 322ecce36beSmrg "$@" +Maked 323ecce36beSmrg fi 324ecce36beSmrg stat=$? 325ecce36beSmrg if test $stat -eq 0; then : 326ecce36beSmrg else 327ecce36beSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" 328ecce36beSmrg exit $stat 329ecce36beSmrg fi 330ecce36beSmrg 331ecce36beSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 332ecce36beSmrg do 333ecce36beSmrg test -f "$tmpdepfile" && break 334ecce36beSmrg done 335ecce36beSmrg if test -f "$tmpdepfile"; then 336ecce36beSmrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 337ecce36beSmrg # Add `dependent.h:' lines. 338ecce36beSmrg sed -ne '2,${ 339ecce36beSmrg s/^ *// 340ecce36beSmrg s/ \\*$// 341ecce36beSmrg s/$/:/ 342ecce36beSmrg p 343ecce36beSmrg }' "$tmpdepfile" >> "$depfile" 344ecce36beSmrg else 345ecce36beSmrg echo "#dummy" > "$depfile" 346ecce36beSmrg fi 347ecce36beSmrg rm -f "$tmpdepfile" "$tmpdepfile2" 348ecce36beSmrg ;; 349ecce36beSmrg 350ecce36beSmrgtru64) 351ecce36beSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 352ecce36beSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 353ecce36beSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 354ecce36beSmrg # dependencies in `foo.d' instead, so we check for that too. 355ecce36beSmrg # Subdirectories are respected. 356ecce36beSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 357ecce36beSmrg test "x$dir" = "x$object" && dir= 358ecce36beSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 359ecce36beSmrg 360ecce36beSmrg if test "$libtool" = yes; then 361ecce36beSmrg # With Tru64 cc, shared objects can also be used to make a 362ecce36beSmrg # static library. This mechanism is used in libtool 1.4 series to 363ecce36beSmrg # handle both shared and static libraries in a single compilation. 364ecce36beSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 365ecce36beSmrg # 366ecce36beSmrg # With libtool 1.5 this exception was removed, and libtool now 367ecce36beSmrg # generates 2 separate objects for the 2 libraries. These two 368ecce36beSmrg # compilations output dependencies in $dir.libs/$base.o.d and 369ecce36beSmrg # in $dir$base.o.d. We have to check for both files, because 370ecce36beSmrg # one of the two compilations can be disabled. We should prefer 371ecce36beSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 372ecce36beSmrg # automatically cleaned when .libs/ is deleted, while ignoring 373ecce36beSmrg # the former would cause a distcleancheck panic. 374ecce36beSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 375ecce36beSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 376ecce36beSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 377ecce36beSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 378ecce36beSmrg "$@" -Wc,-MD 379ecce36beSmrg else 380ecce36beSmrg tmpdepfile1=$dir$base.o.d 381ecce36beSmrg tmpdepfile2=$dir$base.d 382ecce36beSmrg tmpdepfile3=$dir$base.d 383ecce36beSmrg tmpdepfile4=$dir$base.d 384ecce36beSmrg "$@" -MD 385ecce36beSmrg fi 386ecce36beSmrg 387ecce36beSmrg stat=$? 388ecce36beSmrg if test $stat -eq 0; then : 389ecce36beSmrg else 390ecce36beSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 391ecce36beSmrg exit $stat 392ecce36beSmrg fi 393ecce36beSmrg 394ecce36beSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 395ecce36beSmrg do 396ecce36beSmrg test -f "$tmpdepfile" && break 397ecce36beSmrg done 398ecce36beSmrg if test -f "$tmpdepfile"; then 399ecce36beSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 400ecce36beSmrg # That's a tab and a space in the []. 401ecce36beSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 402ecce36beSmrg else 403ecce36beSmrg echo "#dummy" > "$depfile" 404ecce36beSmrg fi 405ecce36beSmrg rm -f "$tmpdepfile" 406ecce36beSmrg ;; 407ecce36beSmrg 408ecce36beSmrg#nosideeffect) 409ecce36beSmrg # This comment above is used by automake to tell side-effect 410ecce36beSmrg # dependency tracking mechanisms from slower ones. 411ecce36beSmrg 412ecce36beSmrgdashmstdout) 413ecce36beSmrg # Important note: in order to support this mode, a compiler *must* 414ecce36beSmrg # always write the preprocessed file to stdout, regardless of -o. 415ecce36beSmrg "$@" || exit $? 416ecce36beSmrg 417ecce36beSmrg # Remove the call to Libtool. 418ecce36beSmrg if test "$libtool" = yes; then 419ecce36beSmrg while test "X$1" != 'X--mode=compile'; do 420ecce36beSmrg shift 421ecce36beSmrg done 422ecce36beSmrg shift 423ecce36beSmrg fi 424ecce36beSmrg 425ecce36beSmrg # Remove `-o $object'. 426ecce36beSmrg IFS=" " 427ecce36beSmrg for arg 428ecce36beSmrg do 429ecce36beSmrg case $arg in 430ecce36beSmrg -o) 431ecce36beSmrg shift 432ecce36beSmrg ;; 433ecce36beSmrg $object) 434ecce36beSmrg shift 435ecce36beSmrg ;; 436ecce36beSmrg *) 437ecce36beSmrg set fnord "$@" "$arg" 438ecce36beSmrg shift # fnord 439ecce36beSmrg shift # $arg 440ecce36beSmrg ;; 441ecce36beSmrg esac 442ecce36beSmrg done 443ecce36beSmrg 444ecce36beSmrg test -z "$dashmflag" && dashmflag=-M 445ecce36beSmrg # Require at least two characters before searching for `:' 446ecce36beSmrg # in the target name. This is to cope with DOS-style filenames: 447ecce36beSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 448ecce36beSmrg "$@" $dashmflag | 449ecce36beSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 450ecce36beSmrg rm -f "$depfile" 451ecce36beSmrg cat < "$tmpdepfile" > "$depfile" 452ecce36beSmrg tr ' ' ' 453ecce36beSmrg' < "$tmpdepfile" | \ 454ecce36beSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 455ecce36beSmrg## correctly. Breaking it into two sed invocations is a workaround. 456ecce36beSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 457ecce36beSmrg rm -f "$tmpdepfile" 458ecce36beSmrg ;; 459ecce36beSmrg 460ecce36beSmrgdashXmstdout) 461ecce36beSmrg # This case only exists to satisfy depend.m4. It is never actually 462ecce36beSmrg # run, as this mode is specially recognized in the preamble. 463ecce36beSmrg exit 1 464ecce36beSmrg ;; 465ecce36beSmrg 466ecce36beSmrgmakedepend) 467ecce36beSmrg "$@" || exit $? 468ecce36beSmrg # Remove any Libtool call 469ecce36beSmrg if test "$libtool" = yes; then 470ecce36beSmrg while test "X$1" != 'X--mode=compile'; do 471ecce36beSmrg shift 472ecce36beSmrg done 473ecce36beSmrg shift 474ecce36beSmrg fi 475ecce36beSmrg # X makedepend 476ecce36beSmrg shift 477ecce36beSmrg cleared=no eat=no 478ecce36beSmrg for arg 479ecce36beSmrg do 480ecce36beSmrg case $cleared in 481ecce36beSmrg no) 482ecce36beSmrg set ""; shift 483ecce36beSmrg cleared=yes ;; 484ecce36beSmrg esac 485ecce36beSmrg if test $eat = yes; then 486ecce36beSmrg eat=no 487ecce36beSmrg continue 488ecce36beSmrg fi 489ecce36beSmrg case "$arg" in 490ecce36beSmrg -D*|-I*) 491ecce36beSmrg set fnord "$@" "$arg"; shift ;; 492ecce36beSmrg # Strip any option that makedepend may not understand. Remove 493ecce36beSmrg # the object too, otherwise makedepend will parse it as a source file. 494ecce36beSmrg -arch) 495ecce36beSmrg eat=yes ;; 496ecce36beSmrg -*|$object) 497ecce36beSmrg ;; 498ecce36beSmrg *) 499ecce36beSmrg set fnord "$@" "$arg"; shift ;; 500ecce36beSmrg esac 501ecce36beSmrg done 502ecce36beSmrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 503ecce36beSmrg touch "$tmpdepfile" 504ecce36beSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 505ecce36beSmrg rm -f "$depfile" 506ecce36beSmrg cat < "$tmpdepfile" > "$depfile" 507ecce36beSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 508ecce36beSmrg' | \ 509ecce36beSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 510ecce36beSmrg## correctly. Breaking it into two sed invocations is a workaround. 511ecce36beSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 512ecce36beSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 513ecce36beSmrg ;; 514ecce36beSmrg 515ecce36beSmrgcpp) 516ecce36beSmrg # Important note: in order to support this mode, a compiler *must* 517ecce36beSmrg # always write the preprocessed file to stdout. 518ecce36beSmrg "$@" || exit $? 519ecce36beSmrg 520ecce36beSmrg # Remove the call to Libtool. 521ecce36beSmrg if test "$libtool" = yes; then 522ecce36beSmrg while test "X$1" != 'X--mode=compile'; do 523ecce36beSmrg shift 524ecce36beSmrg done 525ecce36beSmrg shift 526ecce36beSmrg fi 527ecce36beSmrg 528ecce36beSmrg # Remove `-o $object'. 529ecce36beSmrg IFS=" " 530ecce36beSmrg for arg 531ecce36beSmrg do 532ecce36beSmrg case $arg in 533ecce36beSmrg -o) 534ecce36beSmrg shift 535ecce36beSmrg ;; 536ecce36beSmrg $object) 537ecce36beSmrg shift 538ecce36beSmrg ;; 539ecce36beSmrg *) 540ecce36beSmrg set fnord "$@" "$arg" 541ecce36beSmrg shift # fnord 542ecce36beSmrg shift # $arg 543ecce36beSmrg ;; 544ecce36beSmrg esac 545ecce36beSmrg done 546ecce36beSmrg 547ecce36beSmrg "$@" -E | 548ecce36beSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 549ecce36beSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 550ecce36beSmrg sed '$ s: \\$::' > "$tmpdepfile" 551ecce36beSmrg rm -f "$depfile" 552ecce36beSmrg echo "$object : \\" > "$depfile" 553ecce36beSmrg cat < "$tmpdepfile" >> "$depfile" 554ecce36beSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 555ecce36beSmrg rm -f "$tmpdepfile" 556ecce36beSmrg ;; 557ecce36beSmrg 558ecce36beSmrgmsvisualcpp) 559ecce36beSmrg # Important note: in order to support this mode, a compiler *must* 560ecce36beSmrg # always write the preprocessed file to stdout. 561ecce36beSmrg "$@" || exit $? 562ecce36beSmrg 563ecce36beSmrg # Remove the call to Libtool. 564ecce36beSmrg if test "$libtool" = yes; then 565ecce36beSmrg while test "X$1" != 'X--mode=compile'; do 566ecce36beSmrg shift 567ecce36beSmrg done 568ecce36beSmrg shift 569ecce36beSmrg fi 570ecce36beSmrg 571ecce36beSmrg IFS=" " 572ecce36beSmrg for arg 573ecce36beSmrg do 574ecce36beSmrg case "$arg" in 575ecce36beSmrg -o) 576ecce36beSmrg shift 577ecce36beSmrg ;; 578ecce36beSmrg $object) 579ecce36beSmrg shift 580ecce36beSmrg ;; 581ecce36beSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 582ecce36beSmrg set fnord "$@" 583ecce36beSmrg shift 584ecce36beSmrg shift 585ecce36beSmrg ;; 586ecce36beSmrg *) 587ecce36beSmrg set fnord "$@" "$arg" 588ecce36beSmrg shift 589ecce36beSmrg shift 590ecce36beSmrg ;; 591ecce36beSmrg esac 592ecce36beSmrg done 593ecce36beSmrg "$@" -E 2>/dev/null | 594ecce36beSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 595ecce36beSmrg rm -f "$depfile" 596ecce36beSmrg echo "$object : \\" > "$depfile" 597ecce36beSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 598ecce36beSmrg echo " " >> "$depfile" 599ecce36beSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 600ecce36beSmrg rm -f "$tmpdepfile" 601ecce36beSmrg ;; 602ecce36beSmrg 603ecce36beSmrgmsvcmsys) 604ecce36beSmrg # This case exists only to let depend.m4 do its work. It works by 605ecce36beSmrg # looking at the text of this script. This case will never be run, 606ecce36beSmrg # since it is checked for above. 607ecce36beSmrg exit 1 608ecce36beSmrg ;; 609ecce36beSmrg 610ecce36beSmrgnone) 611ecce36beSmrg exec "$@" 612ecce36beSmrg ;; 613ecce36beSmrg 614ecce36beSmrg*) 615ecce36beSmrg echo "Unknown depmode $depmode" 1>&2 616ecce36beSmrg exit 1 617ecce36beSmrg ;; 618ecce36beSmrgesac 619ecce36beSmrg 620ecce36beSmrgexit 0 621ecce36beSmrg 622ecce36beSmrg# Local Variables: 623ecce36beSmrg# mode: shell-script 624ecce36beSmrg# sh-indentation: 2 625ecce36beSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 626ecce36beSmrg# time-stamp-start: "scriptversion=" 627ecce36beSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 628ecce36beSmrg# time-stamp-time-zone: "UTC" 629ecce36beSmrg# time-stamp-end: "; # UTC" 630ecce36beSmrg# End: 631