1132451Sroberto#! /bin/sh 2132451Sroberto# depcomp - compile a program generating dependencies as side-effects 3132451Sroberto 4182007Srobertoscriptversion=2005-07-09.11 5182007Sroberto 6182007Sroberto# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 7182007Sroberto 8132451Sroberto# This program is free software; you can redistribute it and/or modify 9132451Sroberto# it under the terms of the GNU General Public License as published by 10132451Sroberto# the Free Software Foundation; either version 2, or (at your option) 11132451Sroberto# any later version. 12132451Sroberto 13132451Sroberto# This program is distributed in the hope that it will be useful, 14132451Sroberto# but WITHOUT ANY WARRANTY; without even the implied warranty of 15132451Sroberto# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16132451Sroberto# GNU General Public License for more details. 17132451Sroberto 18132451Sroberto# You should have received a copy of the GNU General Public License 19132451Sroberto# along with this program; if not, write to the Free Software 20182007Sroberto# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21182007Sroberto# 02110-1301, USA. 22132451Sroberto 23132451Sroberto# As a special exception to the GNU General Public License, if you 24132451Sroberto# distribute this file as part of a program that contains a 25132451Sroberto# configuration script generated by Autoconf, you may include it under 26132451Sroberto# the same distribution terms that you use for the rest of that program. 27132451Sroberto 28132451Sroberto# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 29132451Sroberto 30182007Srobertocase $1 in 31182007Sroberto '') 32182007Sroberto echo "$0: No command. Try \`$0 --help' for more information." 1>&2 33182007Sroberto exit 1; 34182007Sroberto ;; 35182007Sroberto -h | --h*) 36182007Sroberto cat <<\EOF 37182007SrobertoUsage: depcomp [--help] [--version] PROGRAM [ARGS] 38182007Sroberto 39182007SrobertoRun PROGRAMS ARGS to compile a file, generating dependencies 40182007Srobertoas side-effects. 41182007Sroberto 42182007SrobertoEnvironment variables: 43182007Sroberto depmode Dependency tracking mode. 44182007Sroberto source Source file read by `PROGRAMS ARGS'. 45182007Sroberto object Object file output by `PROGRAMS ARGS'. 46182007Sroberto DEPDIR directory where to store dependencies. 47182007Sroberto depfile Dependency file to output. 48182007Sroberto tmpdepfile Temporary file to use when outputing dependencies. 49182007Sroberto libtool Whether libtool is used (yes/no). 50182007Sroberto 51182007SrobertoReport bugs to <bug-automake@gnu.org>. 52182007SrobertoEOF 53182007Sroberto exit $? 54182007Sroberto ;; 55182007Sroberto -v | --v*) 56182007Sroberto echo "depcomp $scriptversion" 57182007Sroberto exit $? 58182007Sroberto ;; 59182007Srobertoesac 60182007Sroberto 61132451Srobertoif test -z "$depmode" || test -z "$source" || test -z "$object"; then 62132451Sroberto echo "depcomp: Variables source, object and depmode must be set" 1>&2 63132451Sroberto exit 1 64132451Srobertofi 65132451Sroberto 66182007Sroberto# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 67182007Srobertodepfile=${depfile-`echo "$object" | 68182007Sroberto sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 69132451Srobertotmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 70132451Sroberto 71132451Srobertorm -f "$tmpdepfile" 72132451Sroberto 73132451Sroberto# Some modes work just like other modes, but use different flags. We 74132451Sroberto# parameterize here, but still list the modes in the big case below, 75132451Sroberto# to make depend.m4 easier to write. Note that we *cannot* use a case 76132451Sroberto# here, because this file can only contain one case statement. 77132451Srobertoif test "$depmode" = hp; then 78132451Sroberto # HP compiler uses -M and no extra arg. 79132451Sroberto gccflag=-M 80132451Sroberto depmode=gcc 81132451Srobertofi 82132451Sroberto 83132451Srobertoif test "$depmode" = dashXmstdout; then 84132451Sroberto # This is just like dashmstdout with a different argument. 85132451Sroberto dashmflag=-xM 86132451Sroberto depmode=dashmstdout 87132451Srobertofi 88132451Sroberto 89132451Srobertocase "$depmode" in 90132451Srobertogcc3) 91132451Sroberto## gcc 3 implements dependency tracking that does exactly what 92132451Sroberto## we want. Yay! Note: for some reason libtool 1.4 doesn't like 93132451Sroberto## it if -MD -MP comes after the -MF stuff. Hmm. 94132451Sroberto "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 95132451Sroberto stat=$? 96132451Sroberto if test $stat -eq 0; then : 97132451Sroberto else 98132451Sroberto rm -f "$tmpdepfile" 99132451Sroberto exit $stat 100132451Sroberto fi 101132451Sroberto mv "$tmpdepfile" "$depfile" 102132451Sroberto ;; 103132451Sroberto 104132451Srobertogcc) 105132451Sroberto## There are various ways to get dependency output from gcc. Here's 106132451Sroberto## why we pick this rather obscure method: 107132451Sroberto## - Don't want to use -MD because we'd like the dependencies to end 108132451Sroberto## up in a subdir. Having to rename by hand is ugly. 109132451Sroberto## (We might end up doing this anyway to support other compilers.) 110132451Sroberto## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 111132451Sroberto## -MM, not -M (despite what the docs say). 112132451Sroberto## - Using -M directly means running the compiler twice (even worse 113132451Sroberto## than renaming). 114132451Sroberto if test -z "$gccflag"; then 115132451Sroberto gccflag=-MD, 116132451Sroberto fi 117132451Sroberto "$@" -Wp,"$gccflag$tmpdepfile" 118132451Sroberto stat=$? 119132451Sroberto if test $stat -eq 0; then : 120132451Sroberto else 121132451Sroberto rm -f "$tmpdepfile" 122132451Sroberto exit $stat 123132451Sroberto fi 124132451Sroberto rm -f "$depfile" 125132451Sroberto echo "$object : \\" > "$depfile" 126132451Sroberto alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 127132451Sroberto## The second -e expression handles DOS-style file names with drive letters. 128132451Sroberto sed -e 's/^[^:]*: / /' \ 129132451Sroberto -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 130132451Sroberto## This next piece of magic avoids the `deleted header file' problem. 131132451Sroberto## The problem is that when a header file which appears in a .P file 132132451Sroberto## is deleted, the dependency causes make to die (because there is 133132451Sroberto## typically no way to rebuild the header). We avoid this by adding 134132451Sroberto## dummy dependencies for each header file. Too bad gcc doesn't do 135132451Sroberto## this for us directly. 136132451Sroberto tr ' ' ' 137132451Sroberto' < "$tmpdepfile" | 138132451Sroberto## Some versions of gcc put a space before the `:'. On the theory 139132451Sroberto## that the space means something, we add a space to the output as 140132451Sroberto## well. 141132451Sroberto## Some versions of the HPUX 10.20 sed can't process this invocation 142132451Sroberto## correctly. Breaking it into two sed invocations is a workaround. 143132451Sroberto sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 144132451Sroberto rm -f "$tmpdepfile" 145132451Sroberto ;; 146132451Sroberto 147132451Srobertohp) 148132451Sroberto # This case exists only to let depend.m4 do its work. It works by 149132451Sroberto # looking at the text of this script. This case will never be run, 150132451Sroberto # since it is checked for above. 151132451Sroberto exit 1 152132451Sroberto ;; 153132451Sroberto 154132451Srobertosgi) 155132451Sroberto if test "$libtool" = yes; then 156132451Sroberto "$@" "-Wp,-MDupdate,$tmpdepfile" 157132451Sroberto else 158132451Sroberto "$@" -MDupdate "$tmpdepfile" 159132451Sroberto fi 160132451Sroberto stat=$? 161132451Sroberto if test $stat -eq 0; then : 162132451Sroberto else 163132451Sroberto rm -f "$tmpdepfile" 164132451Sroberto exit $stat 165132451Sroberto fi 166132451Sroberto rm -f "$depfile" 167132451Sroberto 168132451Sroberto if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 169132451Sroberto echo "$object : \\" > "$depfile" 170132451Sroberto 171132451Sroberto # Clip off the initial element (the dependent). Don't try to be 172132451Sroberto # clever and replace this with sed code, as IRIX sed won't handle 173132451Sroberto # lines with more than a fixed number of characters (4096 in 174132451Sroberto # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 175132451Sroberto # the IRIX cc adds comments like `#:fec' to the end of the 176132451Sroberto # dependency line. 177132451Sroberto tr ' ' ' 178132451Sroberto' < "$tmpdepfile" \ 179132451Sroberto | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 180132451Sroberto tr ' 181132451Sroberto' ' ' >> $depfile 182132451Sroberto echo >> $depfile 183132451Sroberto 184132451Sroberto # The second pass generates a dummy entry for each header file. 185132451Sroberto tr ' ' ' 186132451Sroberto' < "$tmpdepfile" \ 187132451Sroberto | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 188132451Sroberto >> $depfile 189132451Sroberto else 190132451Sroberto # The sourcefile does not contain any dependencies, so just 191132451Sroberto # store a dummy comment line, to avoid errors with the Makefile 192132451Sroberto # "include basename.Plo" scheme. 193132451Sroberto echo "#dummy" > "$depfile" 194132451Sroberto fi 195132451Sroberto rm -f "$tmpdepfile" 196132451Sroberto ;; 197132451Sroberto 198132451Srobertoaix) 199132451Sroberto # The C for AIX Compiler uses -M and outputs the dependencies 200182007Sroberto # in a .u file. In older versions, this file always lives in the 201182007Sroberto # current directory. Also, the AIX compiler puts `$object:' at the 202182007Sroberto # start of each line; $object doesn't have directory information. 203182007Sroberto # Version 6 uses the directory in both cases. 204182007Sroberto stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 205132451Sroberto tmpdepfile="$stripped.u" 206132451Sroberto if test "$libtool" = yes; then 207132451Sroberto "$@" -Wc,-M 208132451Sroberto else 209132451Sroberto "$@" -M 210132451Sroberto fi 211182007Sroberto stat=$? 212132451Sroberto 213182007Sroberto if test -f "$tmpdepfile"; then : 214182007Sroberto else 215182007Sroberto stripped=`echo "$stripped" | sed 's,^.*/,,'` 216182007Sroberto tmpdepfile="$stripped.u" 217182007Sroberto fi 218182007Sroberto 219132451Sroberto if test $stat -eq 0; then : 220132451Sroberto else 221132451Sroberto rm -f "$tmpdepfile" 222132451Sroberto exit $stat 223132451Sroberto fi 224132451Sroberto 225132451Sroberto if test -f "$tmpdepfile"; then 226182007Sroberto outname="$stripped.o" 227132451Sroberto # Each line is of the form `foo.o: dependent.h'. 228132451Sroberto # Do two passes, one to just change these to 229132451Sroberto # `$object: dependent.h' and one to simply `dependent.h:'. 230132451Sroberto sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 231132451Sroberto sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 232132451Sroberto else 233132451Sroberto # The sourcefile does not contain any dependencies, so just 234132451Sroberto # store a dummy comment line, to avoid errors with the Makefile 235132451Sroberto # "include basename.Plo" scheme. 236132451Sroberto echo "#dummy" > "$depfile" 237132451Sroberto fi 238132451Sroberto rm -f "$tmpdepfile" 239132451Sroberto ;; 240132451Sroberto 241132451Srobertoicc) 242132451Sroberto # Intel's C compiler understands `-MD -MF file'. However on 243132451Sroberto # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 244132451Sroberto # ICC 7.0 will fill foo.d with something like 245132451Sroberto # foo.o: sub/foo.c 246132451Sroberto # foo.o: sub/foo.h 247132451Sroberto # which is wrong. We want: 248132451Sroberto # sub/foo.o: sub/foo.c 249132451Sroberto # sub/foo.o: sub/foo.h 250132451Sroberto # sub/foo.c: 251132451Sroberto # sub/foo.h: 252132451Sroberto # ICC 7.1 will output 253132451Sroberto # foo.o: sub/foo.c sub/foo.h 254132451Sroberto # and will wrap long lines using \ : 255132451Sroberto # foo.o: sub/foo.c ... \ 256132451Sroberto # sub/foo.h ... \ 257132451Sroberto # ... 258132451Sroberto 259132451Sroberto "$@" -MD -MF "$tmpdepfile" 260132451Sroberto stat=$? 261132451Sroberto if test $stat -eq 0; then : 262132451Sroberto else 263132451Sroberto rm -f "$tmpdepfile" 264132451Sroberto exit $stat 265132451Sroberto fi 266132451Sroberto rm -f "$depfile" 267132451Sroberto # Each line is of the form `foo.o: dependent.h', 268132451Sroberto # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 269132451Sroberto # Do two passes, one to just change these to 270132451Sroberto # `$object: dependent.h' and one to simply `dependent.h:'. 271132451Sroberto sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 272132451Sroberto # Some versions of the HPUX 10.20 sed can't process this invocation 273132451Sroberto # correctly. Breaking it into two sed invocations is a workaround. 274132451Sroberto sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 275132451Sroberto sed -e 's/$/ :/' >> "$depfile" 276132451Sroberto rm -f "$tmpdepfile" 277132451Sroberto ;; 278132451Sroberto 279132451Srobertotru64) 280132451Sroberto # The Tru64 compiler uses -MD to generate dependencies as a side 281132451Sroberto # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 282132451Sroberto # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 283132451Sroberto # dependencies in `foo.d' instead, so we check for that too. 284132451Sroberto # Subdirectories are respected. 285132451Sroberto dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 286132451Sroberto test "x$dir" = "x$object" && dir= 287132451Sroberto base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 288132451Sroberto 289132451Sroberto if test "$libtool" = yes; then 290182007Sroberto # With Tru64 cc, shared objects can also be used to make a 291182007Sroberto # static library. This mecanism is used in libtool 1.4 series to 292182007Sroberto # handle both shared and static libraries in a single compilation. 293182007Sroberto # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 294182007Sroberto # 295182007Sroberto # With libtool 1.5 this exception was removed, and libtool now 296182007Sroberto # generates 2 separate objects for the 2 libraries. These two 297182007Sroberto # compilations output dependencies in in $dir.libs/$base.o.d and 298182007Sroberto # in $dir$base.o.d. We have to check for both files, because 299182007Sroberto # one of the two compilations can be disabled. We should prefer 300182007Sroberto # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 301182007Sroberto # automatically cleaned when .libs/ is deleted, while ignoring 302182007Sroberto # the former would cause a distcleancheck panic. 303182007Sroberto tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 304182007Sroberto tmpdepfile2=$dir$base.o.d # libtool 1.5 305182007Sroberto tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 306182007Sroberto tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 307132451Sroberto "$@" -Wc,-MD 308132451Sroberto else 309182007Sroberto tmpdepfile1=$dir$base.o.d 310182007Sroberto tmpdepfile2=$dir$base.d 311182007Sroberto tmpdepfile3=$dir$base.d 312182007Sroberto tmpdepfile4=$dir$base.d 313132451Sroberto "$@" -MD 314132451Sroberto fi 315132451Sroberto 316132451Sroberto stat=$? 317132451Sroberto if test $stat -eq 0; then : 318132451Sroberto else 319182007Sroberto rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 320132451Sroberto exit $stat 321132451Sroberto fi 322132451Sroberto 323182007Sroberto for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 324182007Sroberto do 325182007Sroberto test -f "$tmpdepfile" && break 326182007Sroberto done 327132451Sroberto if test -f "$tmpdepfile"; then 328132451Sroberto sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 329182007Sroberto # That's a tab and a space in the []. 330182007Sroberto sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 331132451Sroberto else 332132451Sroberto echo "#dummy" > "$depfile" 333132451Sroberto fi 334132451Sroberto rm -f "$tmpdepfile" 335132451Sroberto ;; 336132451Sroberto 337132451Sroberto#nosideeffect) 338132451Sroberto # This comment above is used by automake to tell side-effect 339132451Sroberto # dependency tracking mechanisms from slower ones. 340132451Sroberto 341132451Srobertodashmstdout) 342132451Sroberto # Important note: in order to support this mode, a compiler *must* 343182007Sroberto # always write the preprocessed file to stdout, regardless of -o. 344132451Sroberto "$@" || exit $? 345132451Sroberto 346132451Sroberto # Remove the call to Libtool. 347132451Sroberto if test "$libtool" = yes; then 348132451Sroberto while test $1 != '--mode=compile'; do 349132451Sroberto shift 350132451Sroberto done 351132451Sroberto shift 352132451Sroberto fi 353132451Sroberto 354132451Sroberto # Remove `-o $object'. 355132451Sroberto IFS=" " 356132451Sroberto for arg 357132451Sroberto do 358132451Sroberto case $arg in 359132451Sroberto -o) 360132451Sroberto shift 361132451Sroberto ;; 362132451Sroberto $object) 363132451Sroberto shift 364132451Sroberto ;; 365132451Sroberto *) 366132451Sroberto set fnord "$@" "$arg" 367132451Sroberto shift # fnord 368132451Sroberto shift # $arg 369132451Sroberto ;; 370132451Sroberto esac 371132451Sroberto done 372132451Sroberto 373132451Sroberto test -z "$dashmflag" && dashmflag=-M 374132451Sroberto # Require at least two characters before searching for `:' 375132451Sroberto # in the target name. This is to cope with DOS-style filenames: 376132451Sroberto # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 377132451Sroberto "$@" $dashmflag | 378132451Sroberto sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 379132451Sroberto rm -f "$depfile" 380132451Sroberto cat < "$tmpdepfile" > "$depfile" 381132451Sroberto tr ' ' ' 382132451Sroberto' < "$tmpdepfile" | \ 383132451Sroberto## Some versions of the HPUX 10.20 sed can't process this invocation 384132451Sroberto## correctly. Breaking it into two sed invocations is a workaround. 385132451Sroberto sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 386132451Sroberto rm -f "$tmpdepfile" 387132451Sroberto ;; 388132451Sroberto 389132451SrobertodashXmstdout) 390132451Sroberto # This case only exists to satisfy depend.m4. It is never actually 391132451Sroberto # run, as this mode is specially recognized in the preamble. 392132451Sroberto exit 1 393132451Sroberto ;; 394132451Sroberto 395132451Srobertomakedepend) 396132451Sroberto "$@" || exit $? 397132451Sroberto # Remove any Libtool call 398132451Sroberto if test "$libtool" = yes; then 399132451Sroberto while test $1 != '--mode=compile'; do 400132451Sroberto shift 401132451Sroberto done 402132451Sroberto shift 403132451Sroberto fi 404132451Sroberto # X makedepend 405132451Sroberto shift 406132451Sroberto cleared=no 407132451Sroberto for arg in "$@"; do 408132451Sroberto case $cleared in 409132451Sroberto no) 410132451Sroberto set ""; shift 411132451Sroberto cleared=yes ;; 412132451Sroberto esac 413132451Sroberto case "$arg" in 414132451Sroberto -D*|-I*) 415132451Sroberto set fnord "$@" "$arg"; shift ;; 416132451Sroberto # Strip any option that makedepend may not understand. Remove 417132451Sroberto # the object too, otherwise makedepend will parse it as a source file. 418132451Sroberto -*|$object) 419132451Sroberto ;; 420132451Sroberto *) 421132451Sroberto set fnord "$@" "$arg"; shift ;; 422132451Sroberto esac 423132451Sroberto done 424132451Sroberto obj_suffix="`echo $object | sed 's/^.*\././'`" 425132451Sroberto touch "$tmpdepfile" 426132451Sroberto ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 427132451Sroberto rm -f "$depfile" 428132451Sroberto cat < "$tmpdepfile" > "$depfile" 429132451Sroberto sed '1,2d' "$tmpdepfile" | tr ' ' ' 430132451Sroberto' | \ 431132451Sroberto## Some versions of the HPUX 10.20 sed can't process this invocation 432132451Sroberto## correctly. Breaking it into two sed invocations is a workaround. 433132451Sroberto sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 434132451Sroberto rm -f "$tmpdepfile" "$tmpdepfile".bak 435132451Sroberto ;; 436132451Sroberto 437132451Srobertocpp) 438132451Sroberto # Important note: in order to support this mode, a compiler *must* 439182007Sroberto # always write the preprocessed file to stdout. 440132451Sroberto "$@" || exit $? 441132451Sroberto 442132451Sroberto # Remove the call to Libtool. 443132451Sroberto if test "$libtool" = yes; then 444132451Sroberto while test $1 != '--mode=compile'; do 445132451Sroberto shift 446132451Sroberto done 447132451Sroberto shift 448132451Sroberto fi 449132451Sroberto 450132451Sroberto # Remove `-o $object'. 451132451Sroberto IFS=" " 452132451Sroberto for arg 453132451Sroberto do 454132451Sroberto case $arg in 455132451Sroberto -o) 456132451Sroberto shift 457132451Sroberto ;; 458132451Sroberto $object) 459132451Sroberto shift 460132451Sroberto ;; 461132451Sroberto *) 462132451Sroberto set fnord "$@" "$arg" 463132451Sroberto shift # fnord 464132451Sroberto shift # $arg 465132451Sroberto ;; 466132451Sroberto esac 467132451Sroberto done 468132451Sroberto 469132451Sroberto "$@" -E | 470182007Sroberto sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 471182007Sroberto -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 472132451Sroberto sed '$ s: \\$::' > "$tmpdepfile" 473132451Sroberto rm -f "$depfile" 474132451Sroberto echo "$object : \\" > "$depfile" 475132451Sroberto cat < "$tmpdepfile" >> "$depfile" 476132451Sroberto sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 477132451Sroberto rm -f "$tmpdepfile" 478132451Sroberto ;; 479132451Sroberto 480132451Srobertomsvisualcpp) 481132451Sroberto # Important note: in order to support this mode, a compiler *must* 482182007Sroberto # always write the preprocessed file to stdout, regardless of -o, 483132451Sroberto # because we must use -o when running libtool. 484132451Sroberto "$@" || exit $? 485132451Sroberto IFS=" " 486132451Sroberto for arg 487132451Sroberto do 488132451Sroberto case "$arg" in 489132451Sroberto "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 490132451Sroberto set fnord "$@" 491132451Sroberto shift 492132451Sroberto shift 493132451Sroberto ;; 494132451Sroberto *) 495132451Sroberto set fnord "$@" "$arg" 496132451Sroberto shift 497132451Sroberto shift 498132451Sroberto ;; 499132451Sroberto esac 500132451Sroberto done 501132451Sroberto "$@" -E | 502132451Sroberto sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 503132451Sroberto rm -f "$depfile" 504132451Sroberto echo "$object : \\" > "$depfile" 505132451Sroberto . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 506132451Sroberto echo " " >> "$depfile" 507132451Sroberto . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 508132451Sroberto rm -f "$tmpdepfile" 509132451Sroberto ;; 510132451Sroberto 511132451Srobertonone) 512132451Sroberto exec "$@" 513132451Sroberto ;; 514132451Sroberto 515132451Sroberto*) 516132451Sroberto echo "Unknown depmode $depmode" 1>&2 517132451Sroberto exit 1 518132451Sroberto ;; 519132451Srobertoesac 520132451Sroberto 521132451Srobertoexit 0 522182007Sroberto 523182007Sroberto# Local Variables: 524182007Sroberto# mode: shell-script 525182007Sroberto# sh-indentation: 2 526182007Sroberto# eval: (add-hook 'write-file-hooks 'time-stamp) 527182007Sroberto# time-stamp-start: "scriptversion=" 528182007Sroberto# time-stamp-format: "%:y-%02m-%02d.%02H" 529182007Sroberto# time-stamp-end: "$" 530182007Sroberto# End: 531