annotate src/libogg-1.3.0/depcomp @ 23:619f715526df sv_v2.1

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