annotate src/portaudio/depcomp @ 98:4188fd8db918

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