depcomp revision fd7d9bd3
1fd7d9bd3Smrg#! /bin/sh 2fd7d9bd3Smrg 3fd7d9bd3Smrg# depcomp - compile a program generating dependencies as side-effects 4fd7d9bd3Smrg# Copyright 1999, 2000, 2003 Free Software Foundation, Inc. 5fd7d9bd3Smrg 6fd7d9bd3Smrg# This program is free software; you can redistribute it and/or modify 7fd7d9bd3Smrg# it under the terms of the GNU General Public License as published by 8fd7d9bd3Smrg# the Free Software Foundation; either version 2, or (at your option) 9fd7d9bd3Smrg# any later version. 10fd7d9bd3Smrg 11fd7d9bd3Smrg# This program is distributed in the hope that it will be useful, 12fd7d9bd3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 13fd7d9bd3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14fd7d9bd3Smrg# GNU General Public License for more details. 15fd7d9bd3Smrg 16fd7d9bd3Smrg# You should have received a copy of the GNU General Public License 17fd7d9bd3Smrg# along with this program; if not, write to the Free Software 18fd7d9bd3Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19fd7d9bd3Smrg# 02111-1307, USA. 20fd7d9bd3Smrg 21fd7d9bd3Smrg# As a special exception to the GNU General Public License, if you 22fd7d9bd3Smrg# distribute this file as part of a program that contains a 23fd7d9bd3Smrg# configuration script generated by Autoconf, you may include it under 24fd7d9bd3Smrg# the same distribution terms that you use for the rest of that program. 25fd7d9bd3Smrg 26fd7d9bd3Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 27fd7d9bd3Smrg 28fd7d9bd3Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 29fd7d9bd3Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 30fd7d9bd3Smrg exit 1 31fd7d9bd3Smrgfi 32fd7d9bd3Smrg# `libtool' can also be set to `yes' or `no'. 33fd7d9bd3Smrg 34fd7d9bd3Smrgif test -z "$depfile"; then 35fd7d9bd3Smrg base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` 36fd7d9bd3Smrg dir=`echo "$object" | sed 's,/.*$,/,'` 37fd7d9bd3Smrg if test "$dir" = "$object"; then 38fd7d9bd3Smrg dir= 39fd7d9bd3Smrg fi 40fd7d9bd3Smrg # FIXME: should be _deps on DOS. 41fd7d9bd3Smrg depfile="$dir.deps/$base" 42fd7d9bd3Smrgfi 43fd7d9bd3Smrg 44fd7d9bd3Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 45fd7d9bd3Smrg 46fd7d9bd3Smrgrm -f "$tmpdepfile" 47fd7d9bd3Smrg 48fd7d9bd3Smrg# Some modes work just like other modes, but use different flags. We 49fd7d9bd3Smrg# parameterize here, but still list the modes in the big case below, 50fd7d9bd3Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 51fd7d9bd3Smrg# here, because this file can only contain one case statement. 52fd7d9bd3Smrgif test "$depmode" = hp; then 53fd7d9bd3Smrg # HP compiler uses -M and no extra arg. 54fd7d9bd3Smrg gccflag=-M 55fd7d9bd3Smrg depmode=gcc 56fd7d9bd3Smrgfi 57fd7d9bd3Smrg 58fd7d9bd3Smrgif test "$depmode" = dashXmstdout; then 59fd7d9bd3Smrg # This is just like dashmstdout with a different argument. 60fd7d9bd3Smrg dashmflag=-xM 61fd7d9bd3Smrg depmode=dashmstdout 62fd7d9bd3Smrgfi 63fd7d9bd3Smrg 64fd7d9bd3Smrgcase "$depmode" in 65fd7d9bd3Smrggcc3) 66fd7d9bd3Smrg## gcc 3 implements dependency tracking that does exactly what 67fd7d9bd3Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 68fd7d9bd3Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 69fd7d9bd3Smrg "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 70fd7d9bd3Smrg stat=$? 71fd7d9bd3Smrg if test $stat -eq 0; then : 72fd7d9bd3Smrg else 73fd7d9bd3Smrg rm -f "$tmpdepfile" 74fd7d9bd3Smrg exit $stat 75fd7d9bd3Smrg fi 76fd7d9bd3Smrg mv "$tmpdepfile" "$depfile" 77fd7d9bd3Smrg ;; 78fd7d9bd3Smrg 79fd7d9bd3Smrggcc) 80fd7d9bd3Smrg## There are various ways to get dependency output from gcc. Here's 81fd7d9bd3Smrg## why we pick this rather obscure method: 82fd7d9bd3Smrg## - Don't want to use -MD because we'd like the dependencies to end 83fd7d9bd3Smrg## up in a subdir. Having to rename by hand is ugly. 84fd7d9bd3Smrg## (We might end up doing this anyway to support other compilers.) 85fd7d9bd3Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 86fd7d9bd3Smrg## -MM, not -M (despite what the docs say). 87fd7d9bd3Smrg## - Using -M directly means running the compiler twice (even worse 88fd7d9bd3Smrg## than renaming). 89fd7d9bd3Smrg if test -z "$gccflag"; then 90fd7d9bd3Smrg gccflag=-MD, 91fd7d9bd3Smrg fi 92fd7d9bd3Smrg "$@" -Wp,"$gccflag$tmpdepfile" 93fd7d9bd3Smrg stat=$? 94fd7d9bd3Smrg if test $stat -eq 0; then : 95fd7d9bd3Smrg else 96fd7d9bd3Smrg rm -f "$tmpdepfile" 97fd7d9bd3Smrg exit $stat 98fd7d9bd3Smrg fi 99fd7d9bd3Smrg rm -f "$depfile" 100fd7d9bd3Smrg echo "$object : \\" > "$depfile" 101fd7d9bd3Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 102fd7d9bd3Smrg## The second -e expression handles DOS-style file names with drive letters. 103fd7d9bd3Smrg sed -e 's/^[^:]*: / /' \ 104fd7d9bd3Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 105fd7d9bd3Smrg## This next piece of magic avoids the `deleted header file' problem. 106fd7d9bd3Smrg## The problem is that when a header file which appears in a .P file 107fd7d9bd3Smrg## is deleted, the dependency causes make to die (because there is 108fd7d9bd3Smrg## typically no way to rebuild the header). We avoid this by adding 109fd7d9bd3Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 110fd7d9bd3Smrg## this for us directly. 111fd7d9bd3Smrg tr ' ' ' 112fd7d9bd3Smrg' < "$tmpdepfile" | 113fd7d9bd3Smrg## Some versions of gcc put a space before the `:'. On the theory 114fd7d9bd3Smrg## that the space means something, we add a space to the output as 115fd7d9bd3Smrg## well. 116fd7d9bd3Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 117fd7d9bd3Smrg## correctly. Breaking it into two sed invocations is a workaround. 118fd7d9bd3Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 119fd7d9bd3Smrg rm -f "$tmpdepfile" 120fd7d9bd3Smrg ;; 121fd7d9bd3Smrg 122fd7d9bd3Smrghp) 123fd7d9bd3Smrg # This case exists only to let depend.m4 do its work. It works by 124fd7d9bd3Smrg # looking at the text of this script. This case will never be run, 125fd7d9bd3Smrg # since it is checked for above. 126fd7d9bd3Smrg exit 1 127fd7d9bd3Smrg ;; 128fd7d9bd3Smrg 129fd7d9bd3Smrgsgi) 130fd7d9bd3Smrg if test "$libtool" = yes; then 131fd7d9bd3Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 132fd7d9bd3Smrg else 133fd7d9bd3Smrg "$@" -MDupdate "$tmpdepfile" 134fd7d9bd3Smrg fi 135fd7d9bd3Smrg stat=$? 136fd7d9bd3Smrg if test $stat -eq 0; then : 137fd7d9bd3Smrg else 138fd7d9bd3Smrg rm -f "$tmpdepfile" 139fd7d9bd3Smrg exit $stat 140fd7d9bd3Smrg fi 141fd7d9bd3Smrg rm -f "$depfile" 142fd7d9bd3Smrg 143fd7d9bd3Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 144fd7d9bd3Smrg echo "$object : \\" > "$depfile" 145fd7d9bd3Smrg 146fd7d9bd3Smrg # Clip off the initial element (the dependent). Don't try to be 147fd7d9bd3Smrg # clever and replace this with sed code, as IRIX sed won't handle 148fd7d9bd3Smrg # lines with more than a fixed number of characters (4096 in 149fd7d9bd3Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 150fd7d9bd3Smrg # the IRIX cc adds comments like `#:fec' to the end of the 151fd7d9bd3Smrg # dependency line. 152fd7d9bd3Smrg tr ' ' ' 153fd7d9bd3Smrg' < "$tmpdepfile" \ 154fd7d9bd3Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 155fd7d9bd3Smrg tr ' 156fd7d9bd3Smrg' ' ' >> $depfile 157fd7d9bd3Smrg echo >> $depfile 158fd7d9bd3Smrg 159fd7d9bd3Smrg # The second pass generates a dummy entry for each header file. 160fd7d9bd3Smrg tr ' ' ' 161fd7d9bd3Smrg' < "$tmpdepfile" \ 162fd7d9bd3Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 163fd7d9bd3Smrg >> $depfile 164fd7d9bd3Smrg else 165fd7d9bd3Smrg # The sourcefile does not contain any dependencies, so just 166fd7d9bd3Smrg # store a dummy comment line, to avoid errors with the Makefile 167fd7d9bd3Smrg # "include basename.Plo" scheme. 168fd7d9bd3Smrg echo "#dummy" > "$depfile" 169fd7d9bd3Smrg fi 170fd7d9bd3Smrg rm -f "$tmpdepfile" 171fd7d9bd3Smrg ;; 172fd7d9bd3Smrg 173fd7d9bd3Smrgaix) 174fd7d9bd3Smrg # The C for AIX Compiler uses -M and outputs the dependencies 175fd7d9bd3Smrg # in a .u file. In older versions, this file always lives in the 176fd7d9bd3Smrg # current directory. Also, the AIX compiler puts `$object:' at the 177fd7d9bd3Smrg # start of each line; $object doesn't have directory information. 178fd7d9bd3Smrg # Version 6 uses the directory in both cases. 179fd7d9bd3Smrg stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 180fd7d9bd3Smrg tmpdepfile="$stripped.u" 181fd7d9bd3Smrg if test "$libtool" = yes; then 182fd7d9bd3Smrg "$@" -Wc,-M 183fd7d9bd3Smrg else 184fd7d9bd3Smrg "$@" -M 185fd7d9bd3Smrg fi 186fd7d9bd3Smrg stat=$? 187fd7d9bd3Smrg 188fd7d9bd3Smrg if test -f "$tmpdepfile"; then : 189fd7d9bd3Smrg else 190fd7d9bd3Smrg stripped=`echo "$stripped" | sed 's,^.*/,,'` 191fd7d9bd3Smrg tmpdepfile="$stripped.u" 192fd7d9bd3Smrg fi 193fd7d9bd3Smrg 194fd7d9bd3Smrg if test $stat -eq 0; then : 195fd7d9bd3Smrg else 196fd7d9bd3Smrg rm -f "$tmpdepfile" 197fd7d9bd3Smrg exit $stat 198fd7d9bd3Smrg fi 199fd7d9bd3Smrg 200fd7d9bd3Smrg if test -f "$tmpdepfile"; then 201fd7d9bd3Smrg outname="$stripped.o" 202fd7d9bd3Smrg # Each line is of the form `foo.o: dependent.h'. 203fd7d9bd3Smrg # Do two passes, one to just change these to 204fd7d9bd3Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 205fd7d9bd3Smrg sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 206fd7d9bd3Smrg sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 207fd7d9bd3Smrg else 208fd7d9bd3Smrg # The sourcefile does not contain any dependencies, so just 209fd7d9bd3Smrg # store a dummy comment line, to avoid errors with the Makefile 210fd7d9bd3Smrg # "include basename.Plo" scheme. 211fd7d9bd3Smrg echo "#dummy" > "$depfile" 212fd7d9bd3Smrg fi 213fd7d9bd3Smrg rm -f "$tmpdepfile" 214fd7d9bd3Smrg ;; 215fd7d9bd3Smrg 216fd7d9bd3Smrgicc) 217fd7d9bd3Smrg # Intel's C compiler understands `-MD -MF file'. However on 218fd7d9bd3Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 219fd7d9bd3Smrg # ICC 7.0 will fill foo.d with something like 220fd7d9bd3Smrg # foo.o: sub/foo.c 221fd7d9bd3Smrg # foo.o: sub/foo.h 222fd7d9bd3Smrg # which is wrong. We want: 223fd7d9bd3Smrg # sub/foo.o: sub/foo.c 224fd7d9bd3Smrg # sub/foo.o: sub/foo.h 225fd7d9bd3Smrg # sub/foo.c: 226fd7d9bd3Smrg # sub/foo.h: 227fd7d9bd3Smrg # ICC 7.1 will output 228fd7d9bd3Smrg # foo.o: sub/foo.c sub/foo.h 229fd7d9bd3Smrg # and will wrap long lines using \ : 230fd7d9bd3Smrg # foo.o: sub/foo.c ... \ 231fd7d9bd3Smrg # sub/foo.h ... \ 232fd7d9bd3Smrg # ... 233fd7d9bd3Smrg 234fd7d9bd3Smrg "$@" -MD -MF "$tmpdepfile" 235fd7d9bd3Smrg stat=$? 236fd7d9bd3Smrg if test $stat -eq 0; then : 237fd7d9bd3Smrg else 238fd7d9bd3Smrg rm -f "$tmpdepfile" 239fd7d9bd3Smrg exit $stat 240fd7d9bd3Smrg fi 241fd7d9bd3Smrg rm -f "$depfile" 242fd7d9bd3Smrg # Each line is of the form `foo.o: dependent.h', 243fd7d9bd3Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 244fd7d9bd3Smrg # Do two passes, one to just change these to 245fd7d9bd3Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 246fd7d9bd3Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 247fd7d9bd3Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 248fd7d9bd3Smrg # correctly. Breaking it into two sed invocations is a workaround. 249fd7d9bd3Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 250fd7d9bd3Smrg sed -e 's/$/ :/' >> "$depfile" 251fd7d9bd3Smrg rm -f "$tmpdepfile" 252fd7d9bd3Smrg ;; 253fd7d9bd3Smrg 254fd7d9bd3Smrgtru64) 255fd7d9bd3Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 256fd7d9bd3Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 257fd7d9bd3Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 258fd7d9bd3Smrg # dependencies in `foo.d' instead, so we check for that too. 259fd7d9bd3Smrg # Subdirectories are respected. 260fd7d9bd3Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 261fd7d9bd3Smrg test "x$dir" = "x$object" && dir= 262fd7d9bd3Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 263fd7d9bd3Smrg 264fd7d9bd3Smrg if test "$libtool" = yes; then 265fd7d9bd3Smrg tmpdepfile1="$dir.libs/$base.lo.d" 266fd7d9bd3Smrg tmpdepfile2="$dir.libs/$base.d" 267fd7d9bd3Smrg "$@" -Wc,-MD 268fd7d9bd3Smrg else 269fd7d9bd3Smrg tmpdepfile1="$dir$base.o.d" 270fd7d9bd3Smrg tmpdepfile2="$dir$base.d" 271fd7d9bd3Smrg "$@" -MD 272fd7d9bd3Smrg fi 273fd7d9bd3Smrg 274fd7d9bd3Smrg stat=$? 275fd7d9bd3Smrg if test $stat -eq 0; then : 276fd7d9bd3Smrg else 277fd7d9bd3Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 278fd7d9bd3Smrg exit $stat 279fd7d9bd3Smrg fi 280fd7d9bd3Smrg 281fd7d9bd3Smrg if test -f "$tmpdepfile1"; then 282fd7d9bd3Smrg tmpdepfile="$tmpdepfile1" 283fd7d9bd3Smrg else 284fd7d9bd3Smrg tmpdepfile="$tmpdepfile2" 285fd7d9bd3Smrg fi 286fd7d9bd3Smrg if test -f "$tmpdepfile"; then 287fd7d9bd3Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 288fd7d9bd3Smrg # That's a tab and a space in the []. 289fd7d9bd3Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 290fd7d9bd3Smrg else 291fd7d9bd3Smrg echo "#dummy" > "$depfile" 292fd7d9bd3Smrg fi 293fd7d9bd3Smrg rm -f "$tmpdepfile" 294fd7d9bd3Smrg ;; 295fd7d9bd3Smrg 296fd7d9bd3Smrg#nosideeffect) 297fd7d9bd3Smrg # This comment above is used by automake to tell side-effect 298fd7d9bd3Smrg # dependency tracking mechanisms from slower ones. 299fd7d9bd3Smrg 300fd7d9bd3Smrgdashmstdout) 301fd7d9bd3Smrg # Important note: in order to support this mode, a compiler *must* 302fd7d9bd3Smrg # always write the preprocessed file to stdout, regardless of -o. 303fd7d9bd3Smrg "$@" || exit $? 304fd7d9bd3Smrg 305fd7d9bd3Smrg # Remove the call to Libtool. 306fd7d9bd3Smrg if test "$libtool" = yes; then 307fd7d9bd3Smrg while test $1 != '--mode=compile'; do 308fd7d9bd3Smrg shift 309fd7d9bd3Smrg done 310fd7d9bd3Smrg shift 311fd7d9bd3Smrg fi 312fd7d9bd3Smrg 313fd7d9bd3Smrg # Remove `-o $object'. 314fd7d9bd3Smrg IFS=" " 315fd7d9bd3Smrg for arg 316fd7d9bd3Smrg do 317fd7d9bd3Smrg case $arg in 318fd7d9bd3Smrg -o) 319fd7d9bd3Smrg shift 320fd7d9bd3Smrg ;; 321fd7d9bd3Smrg $object) 322fd7d9bd3Smrg shift 323fd7d9bd3Smrg ;; 324fd7d9bd3Smrg *) 325fd7d9bd3Smrg set fnord "$@" "$arg" 326fd7d9bd3Smrg shift # fnord 327fd7d9bd3Smrg shift # $arg 328fd7d9bd3Smrg ;; 329fd7d9bd3Smrg esac 330fd7d9bd3Smrg done 331fd7d9bd3Smrg 332fd7d9bd3Smrg test -z "$dashmflag" && dashmflag=-M 333fd7d9bd3Smrg # Require at least two characters before searching for `:' 334fd7d9bd3Smrg # in the target name. This is to cope with DOS-style filenames: 335fd7d9bd3Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 336fd7d9bd3Smrg "$@" $dashmflag | 337fd7d9bd3Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 338fd7d9bd3Smrg rm -f "$depfile" 339fd7d9bd3Smrg cat < "$tmpdepfile" > "$depfile" 340fd7d9bd3Smrg tr ' ' ' 341fd7d9bd3Smrg' < "$tmpdepfile" | \ 342fd7d9bd3Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 343fd7d9bd3Smrg## correctly. Breaking it into two sed invocations is a workaround. 344fd7d9bd3Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 345fd7d9bd3Smrg rm -f "$tmpdepfile" 346fd7d9bd3Smrg ;; 347fd7d9bd3Smrg 348fd7d9bd3SmrgdashXmstdout) 349fd7d9bd3Smrg # This case only exists to satisfy depend.m4. It is never actually 350fd7d9bd3Smrg # run, as this mode is specially recognized in the preamble. 351fd7d9bd3Smrg exit 1 352fd7d9bd3Smrg ;; 353fd7d9bd3Smrg 354fd7d9bd3Smrgmakedepend) 355fd7d9bd3Smrg "$@" || exit $? 356fd7d9bd3Smrg # Remove any Libtool call 357fd7d9bd3Smrg if test "$libtool" = yes; then 358fd7d9bd3Smrg while test $1 != '--mode=compile'; do 359fd7d9bd3Smrg shift 360fd7d9bd3Smrg done 361fd7d9bd3Smrg shift 362fd7d9bd3Smrg fi 363fd7d9bd3Smrg # X makedepend 364fd7d9bd3Smrg shift 365fd7d9bd3Smrg cleared=no 366fd7d9bd3Smrg for arg in "$@"; do 367fd7d9bd3Smrg case $cleared in 368fd7d9bd3Smrg no) 369fd7d9bd3Smrg set ""; shift 370fd7d9bd3Smrg cleared=yes ;; 371fd7d9bd3Smrg esac 372fd7d9bd3Smrg case "$arg" in 373fd7d9bd3Smrg -D*|-I*) 374fd7d9bd3Smrg set fnord "$@" "$arg"; shift ;; 375fd7d9bd3Smrg # Strip any option that makedepend may not understand. Remove 376fd7d9bd3Smrg # the object too, otherwise makedepend will parse it as a source file. 377fd7d9bd3Smrg -*|$object) 378fd7d9bd3Smrg ;; 379fd7d9bd3Smrg *) 380fd7d9bd3Smrg set fnord "$@" "$arg"; shift ;; 381fd7d9bd3Smrg esac 382fd7d9bd3Smrg done 383fd7d9bd3Smrg obj_suffix="`echo $object | sed 's/^.*\././'`" 384fd7d9bd3Smrg touch "$tmpdepfile" 385fd7d9bd3Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 386fd7d9bd3Smrg rm -f "$depfile" 387fd7d9bd3Smrg cat < "$tmpdepfile" > "$depfile" 388fd7d9bd3Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 389fd7d9bd3Smrg' | \ 390fd7d9bd3Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 391fd7d9bd3Smrg## correctly. Breaking it into two sed invocations is a workaround. 392fd7d9bd3Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 393fd7d9bd3Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 394fd7d9bd3Smrg ;; 395fd7d9bd3Smrg 396fd7d9bd3Smrgcpp) 397fd7d9bd3Smrg # Important note: in order to support this mode, a compiler *must* 398fd7d9bd3Smrg # always write the preprocessed file to stdout. 399fd7d9bd3Smrg "$@" || exit $? 400fd7d9bd3Smrg 401fd7d9bd3Smrg # Remove the call to Libtool. 402fd7d9bd3Smrg if test "$libtool" = yes; then 403fd7d9bd3Smrg while test $1 != '--mode=compile'; do 404fd7d9bd3Smrg shift 405fd7d9bd3Smrg done 406fd7d9bd3Smrg shift 407fd7d9bd3Smrg fi 408fd7d9bd3Smrg 409fd7d9bd3Smrg # Remove `-o $object'. 410fd7d9bd3Smrg IFS=" " 411fd7d9bd3Smrg for arg 412fd7d9bd3Smrg do 413fd7d9bd3Smrg case $arg in 414fd7d9bd3Smrg -o) 415fd7d9bd3Smrg shift 416fd7d9bd3Smrg ;; 417fd7d9bd3Smrg $object) 418fd7d9bd3Smrg shift 419fd7d9bd3Smrg ;; 420fd7d9bd3Smrg *) 421fd7d9bd3Smrg set fnord "$@" "$arg" 422fd7d9bd3Smrg shift # fnord 423fd7d9bd3Smrg shift # $arg 424fd7d9bd3Smrg ;; 425fd7d9bd3Smrg esac 426fd7d9bd3Smrg done 427fd7d9bd3Smrg 428fd7d9bd3Smrg "$@" -E | 429fd7d9bd3Smrg sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 430fd7d9bd3Smrg sed '$ s: \\$::' > "$tmpdepfile" 431fd7d9bd3Smrg rm -f "$depfile" 432fd7d9bd3Smrg echo "$object : \\" > "$depfile" 433fd7d9bd3Smrg cat < "$tmpdepfile" >> "$depfile" 434fd7d9bd3Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 435fd7d9bd3Smrg rm -f "$tmpdepfile" 436fd7d9bd3Smrg ;; 437fd7d9bd3Smrg 438fd7d9bd3Smrgmsvisualcpp) 439fd7d9bd3Smrg # Important note: in order to support this mode, a compiler *must* 440fd7d9bd3Smrg # always write the preprocessed file to stdout, regardless of -o, 441fd7d9bd3Smrg # because we must use -o when running libtool. 442fd7d9bd3Smrg "$@" || exit $? 443fd7d9bd3Smrg IFS=" " 444fd7d9bd3Smrg for arg 445fd7d9bd3Smrg do 446fd7d9bd3Smrg case "$arg" in 447fd7d9bd3Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 448fd7d9bd3Smrg set fnord "$@" 449fd7d9bd3Smrg shift 450fd7d9bd3Smrg shift 451fd7d9bd3Smrg ;; 452fd7d9bd3Smrg *) 453fd7d9bd3Smrg set fnord "$@" "$arg" 454fd7d9bd3Smrg shift 455fd7d9bd3Smrg shift 456fd7d9bd3Smrg ;; 457fd7d9bd3Smrg esac 458fd7d9bd3Smrg done 459fd7d9bd3Smrg "$@" -E | 460fd7d9bd3Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 461fd7d9bd3Smrg rm -f "$depfile" 462fd7d9bd3Smrg echo "$object : \\" > "$depfile" 463fd7d9bd3Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 464fd7d9bd3Smrg echo " " >> "$depfile" 465fd7d9bd3Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 466fd7d9bd3Smrg rm -f "$tmpdepfile" 467fd7d9bd3Smrg ;; 468fd7d9bd3Smrg 469fd7d9bd3Smrgnone) 470fd7d9bd3Smrg exec "$@" 471fd7d9bd3Smrg ;; 472fd7d9bd3Smrg 473fd7d9bd3Smrg*) 474fd7d9bd3Smrg echo "Unknown depmode $depmode" 1>&2 475fd7d9bd3Smrg exit 1 476fd7d9bd3Smrg ;; 477fd7d9bd3Smrgesac 478fd7d9bd3Smrg 479fd7d9bd3Smrgexit 0 480