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