annotate src/portaudio_20140130/depcomp @ 71:388bd4da45bf

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