annotate src/portaudio_20140130/depcomp @ 169:223a55898ab9 tip default

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