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