annotate src/libsndfile-1.0.25/Cfg/depcomp @ 0:c7265573341e

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