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