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