annotate src/libvorbis-1.3.3/depcomp @ 83:ae30d91d2ffe

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