annotate src/portaudio/depcomp @ 16:7f77decdb26d

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