annotate src/libsamplerate-0.1.9/Cfg/depcomp @ 41:481f5f8c5634

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