annotate src/libmad-0.15.1b/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
cannam@85 3 # depcomp - compile a program generating dependencies as side-effects
cannam@85 4 # Copyright 1999, 2000 Free Software Foundation, Inc.
cannam@85 5
cannam@85 6 # This program is free software; you can redistribute it and/or modify
cannam@85 7 # it under the terms of the GNU General Public License as published by
cannam@85 8 # the Free Software Foundation; either version 2, or (at your option)
cannam@85 9 # any later version.
cannam@85 10
cannam@85 11 # This program is distributed in the hope that it will be useful,
cannam@85 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@85 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cannam@85 14 # GNU General Public License for more details.
cannam@85 15
cannam@85 16 # You should have received a copy of the GNU General Public License
cannam@85 17 # along with this program; if not, write to the Free Software
cannam@85 18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
cannam@85 19 # 02111-1307, USA.
cannam@85 20
cannam@85 21 # As a special exception to the GNU General Public License, if you
cannam@85 22 # distribute this file as part of a program that contains a
cannam@85 23 # configuration script generated by Autoconf, you may include it under
cannam@85 24 # the same distribution terms that you use for the rest of that program.
cannam@85 25
cannam@85 26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
cannam@85 27
cannam@85 28 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
cannam@85 29 echo "depcomp: Variables source, object and depmode must be set" 1>&2
cannam@85 30 exit 1
cannam@85 31 fi
cannam@85 32 # `libtool' can also be set to `yes' or `no'.
cannam@85 33
cannam@85 34 if test -z "$depfile"; then
cannam@85 35 base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
cannam@85 36 dir=`echo "$object" | sed 's,/.*$,/,'`
cannam@85 37 if test "$dir" = "$object"; then
cannam@85 38 dir=
cannam@85 39 fi
cannam@85 40 # FIXME: should be _deps on DOS.
cannam@85 41 depfile="$dir.deps/$base"
cannam@85 42 fi
cannam@85 43
cannam@85 44 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
cannam@85 45
cannam@85 46 rm -f "$tmpdepfile"
cannam@85 47
cannam@85 48 # Some modes work just like other modes, but use different flags. We
cannam@85 49 # parameterize here, but still list the modes in the big case below,
cannam@85 50 # to make depend.m4 easier to write. Note that we *cannot* use a case
cannam@85 51 # here, because this file can only contain one case statement.
cannam@85 52 if test "$depmode" = hp; then
cannam@85 53 # HP compiler uses -M and no extra arg.
cannam@85 54 gccflag=-M
cannam@85 55 depmode=gcc
cannam@85 56 fi
cannam@85 57
cannam@85 58 if test "$depmode" = dashXmstdout; then
cannam@85 59 # This is just like dashmstdout with a different argument.
cannam@85 60 dashmflag=-xM
cannam@85 61 depmode=dashmstdout
cannam@85 62 fi
cannam@85 63
cannam@85 64 case "$depmode" in
cannam@85 65 gcc3)
cannam@85 66 ## gcc 3 implements dependency tracking that does exactly what
cannam@85 67 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
cannam@85 68 ## it if -MD -MP comes after the -MF stuff. Hmm.
cannam@85 69 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
cannam@85 70 stat=$?
cannam@85 71 if test $stat -eq 0; then :
cannam@85 72 else
cannam@85 73 rm -f "$tmpdepfile"
cannam@85 74 exit $stat
cannam@85 75 fi
cannam@85 76 mv "$tmpdepfile" "$depfile"
cannam@85 77 ;;
cannam@85 78
cannam@85 79 gcc)
cannam@85 80 ## There are various ways to get dependency output from gcc. Here's
cannam@85 81 ## why we pick this rather obscure method:
cannam@85 82 ## - Don't want to use -MD because we'd like the dependencies to end
cannam@85 83 ## up in a subdir. Having to rename by hand is ugly.
cannam@85 84 ## (We might end up doing this anyway to support other compilers.)
cannam@85 85 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
cannam@85 86 ## -MM, not -M (despite what the docs say).
cannam@85 87 ## - Using -M directly means running the compiler twice (even worse
cannam@85 88 ## than renaming).
cannam@85 89 if test -z "$gccflag"; then
cannam@85 90 gccflag=-MD,
cannam@85 91 fi
cannam@85 92 "$@" -Wp,"$gccflag$tmpdepfile"
cannam@85 93 stat=$?
cannam@85 94 if test $stat -eq 0; then :
cannam@85 95 else
cannam@85 96 rm -f "$tmpdepfile"
cannam@85 97 exit $stat
cannam@85 98 fi
cannam@85 99 rm -f "$depfile"
cannam@85 100 echo "$object : \\" > "$depfile"
cannam@85 101 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
cannam@85 102 ## The second -e expression handles DOS-style file names with drive letters.
cannam@85 103 sed -e 's/^[^:]*: / /' \
cannam@85 104 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
cannam@85 105 ## This next piece of magic avoids the `deleted header file' problem.
cannam@85 106 ## The problem is that when a header file which appears in a .P file
cannam@85 107 ## is deleted, the dependency causes make to die (because there is
cannam@85 108 ## typically no way to rebuild the header). We avoid this by adding
cannam@85 109 ## dummy dependencies for each header file. Too bad gcc doesn't do
cannam@85 110 ## this for us directly.
cannam@85 111 tr ' ' '
cannam@85 112 ' < "$tmpdepfile" |
cannam@85 113 ## Some versions of gcc put a space before the `:'. On the theory
cannam@85 114 ## that the space means something, we add a space to the output as
cannam@85 115 ## well.
cannam@85 116 ## Some versions of the HPUX 10.20 sed can't process this invocation
cannam@85 117 ## correctly. Breaking it into two sed invocations is a workaround.
cannam@85 118 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
cannam@85 119 rm -f "$tmpdepfile"
cannam@85 120 ;;
cannam@85 121
cannam@85 122 hp)
cannam@85 123 # This case exists only to let depend.m4 do its work. It works by
cannam@85 124 # looking at the text of this script. This case will never be run,
cannam@85 125 # since it is checked for above.
cannam@85 126 exit 1
cannam@85 127 ;;
cannam@85 128
cannam@85 129 sgi)
cannam@85 130 if test "$libtool" = yes; then
cannam@85 131 "$@" "-Wp,-MDupdate,$tmpdepfile"
cannam@85 132 else
cannam@85 133 "$@" -MDupdate "$tmpdepfile"
cannam@85 134 fi
cannam@85 135 stat=$?
cannam@85 136 if test $stat -eq 0; then :
cannam@85 137 else
cannam@85 138 rm -f "$tmpdepfile"
cannam@85 139 exit $stat
cannam@85 140 fi
cannam@85 141 rm -f "$depfile"
cannam@85 142
cannam@85 143 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
cannam@85 144 echo "$object : \\" > "$depfile"
cannam@85 145
cannam@85 146 # Clip off the initial element (the dependent). Don't try to be
cannam@85 147 # clever and replace this with sed code, as IRIX sed won't handle
cannam@85 148 # lines with more than a fixed number of characters (4096 in
cannam@85 149 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
cannam@85 150 # the IRIX cc adds comments like `#:fec' to the end of the
cannam@85 151 # dependency line.
cannam@85 152 tr ' ' '
cannam@85 153 ' < "$tmpdepfile" \
cannam@85 154 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
cannam@85 155 tr '
cannam@85 156 ' ' ' >> $depfile
cannam@85 157 echo >> $depfile
cannam@85 158
cannam@85 159 # The second pass generates a dummy entry for each header file.
cannam@85 160 tr ' ' '
cannam@85 161 ' < "$tmpdepfile" \
cannam@85 162 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
cannam@85 163 >> $depfile
cannam@85 164 else
cannam@85 165 # The sourcefile does not contain any dependencies, so just
cannam@85 166 # store a dummy comment line, to avoid errors with the Makefile
cannam@85 167 # "include basename.Plo" scheme.
cannam@85 168 echo "#dummy" > "$depfile"
cannam@85 169 fi
cannam@85 170 rm -f "$tmpdepfile"
cannam@85 171 ;;
cannam@85 172
cannam@85 173 aix)
cannam@85 174 # The C for AIX Compiler uses -M and outputs the dependencies
cannam@85 175 # in a .u file. This file always lives in the current directory.
cannam@85 176 # Also, the AIX compiler puts `$object:' at the start of each line;
cannam@85 177 # $object doesn't have directory information.
cannam@85 178 stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
cannam@85 179 tmpdepfile="$stripped.u"
cannam@85 180 outname="$stripped.o"
cannam@85 181 if test "$libtool" = yes; then
cannam@85 182 "$@" -Wc,-M
cannam@85 183 else
cannam@85 184 "$@" -M
cannam@85 185 fi
cannam@85 186
cannam@85 187 stat=$?
cannam@85 188 if test $stat -eq 0; then :
cannam@85 189 else
cannam@85 190 rm -f "$tmpdepfile"
cannam@85 191 exit $stat
cannam@85 192 fi
cannam@85 193
cannam@85 194 if test -f "$tmpdepfile"; then
cannam@85 195 # Each line is of the form `foo.o: dependent.h'.
cannam@85 196 # Do two passes, one to just change these to
cannam@85 197 # `$object: dependent.h' and one to simply `dependent.h:'.
cannam@85 198 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
cannam@85 199 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
cannam@85 200 else
cannam@85 201 # The sourcefile does not contain any dependencies, so just
cannam@85 202 # store a dummy comment line, to avoid errors with the Makefile
cannam@85 203 # "include basename.Plo" scheme.
cannam@85 204 echo "#dummy" > "$depfile"
cannam@85 205 fi
cannam@85 206 rm -f "$tmpdepfile"
cannam@85 207 ;;
cannam@85 208
cannam@85 209 icc)
cannam@85 210 # Must come before tru64.
cannam@85 211
cannam@85 212 # Intel's C compiler understands `-MD -MF file'. However
cannam@85 213 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
cannam@85 214 # will fill foo.d with something like
cannam@85 215 # foo.o: sub/foo.c
cannam@85 216 # foo.o: sub/foo.h
cannam@85 217 # which is wrong. We want:
cannam@85 218 # sub/foo.o: sub/foo.c
cannam@85 219 # sub/foo.o: sub/foo.h
cannam@85 220 # sub/foo.c:
cannam@85 221 # sub/foo.h:
cannam@85 222
cannam@85 223 "$@" -MD -MF "$tmpdepfile"
cannam@85 224 stat=$?
cannam@85 225 if test $stat -eq 0; then :
cannam@85 226 else
cannam@85 227 rm -f "$tmpdepfile"
cannam@85 228 exit $stat
cannam@85 229 fi
cannam@85 230 rm -f "$depfile"
cannam@85 231 # Each line is of the form `foo.o: dependent.h'.
cannam@85 232 # Do two passes, one to just change these to
cannam@85 233 # `$object: dependent.h' and one to simply `dependent.h:'.
cannam@85 234 sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
cannam@85 235 sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
cannam@85 236 rm -f "$tmpdepfile"
cannam@85 237 ;;
cannam@85 238
cannam@85 239 tru64)
cannam@85 240 # The Tru64 compiler uses -MD to generate dependencies as a side
cannam@85 241 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
cannam@85 242 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
cannam@85 243 # dependencies in `foo.d' instead, so we check for that too.
cannam@85 244 # Subdirectories are respected.
cannam@85 245 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
cannam@85 246 test "x$dir" = "x$object" && dir=
cannam@85 247 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
cannam@85 248
cannam@85 249 if test "$libtool" = yes; then
cannam@85 250 tmpdepfile1="$dir.libs/$base.lo.d"
cannam@85 251 tmpdepfile2="$dir.libs/$base.d"
cannam@85 252 "$@" -Wc,-MD
cannam@85 253 else
cannam@85 254 tmpdepfile1="$dir$base.o.d"
cannam@85 255 tmpdepfile2="$dir$base.d"
cannam@85 256 "$@" -MD
cannam@85 257 fi
cannam@85 258
cannam@85 259 stat=$?
cannam@85 260 if test $stat -eq 0; then :
cannam@85 261 else
cannam@85 262 rm -f "$tmpdepfile1" "$tmpdepfile2"
cannam@85 263 exit $stat
cannam@85 264 fi
cannam@85 265
cannam@85 266 if test -f "$tmpdepfile1"; then
cannam@85 267 tmpdepfile="$tmpdepfile1"
cannam@85 268 else
cannam@85 269 tmpdepfile="$tmpdepfile2"
cannam@85 270 fi
cannam@85 271 if test -f "$tmpdepfile"; then
cannam@85 272 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
cannam@85 273 # That's a space and a tab in the [].
cannam@85 274 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
cannam@85 275 else
cannam@85 276 echo "#dummy" > "$depfile"
cannam@85 277 fi
cannam@85 278 rm -f "$tmpdepfile"
cannam@85 279 ;;
cannam@85 280
cannam@85 281 #nosideeffect)
cannam@85 282 # This comment above is used by automake to tell side-effect
cannam@85 283 # dependency tracking mechanisms from slower ones.
cannam@85 284
cannam@85 285 dashmstdout)
cannam@85 286 # Important note: in order to support this mode, a compiler *must*
cannam@85 287 # always write the proprocessed file to stdout, regardless of -o.
cannam@85 288 "$@" || exit $?
cannam@85 289
cannam@85 290 # Remove the call to Libtool.
cannam@85 291 if test "$libtool" = yes; then
cannam@85 292 while test $1 != '--mode=compile'; do
cannam@85 293 shift
cannam@85 294 done
cannam@85 295 shift
cannam@85 296 fi
cannam@85 297
cannam@85 298 # Remove `-o $object'.
cannam@85 299 IFS=" "
cannam@85 300 for arg
cannam@85 301 do
cannam@85 302 case $arg in
cannam@85 303 -o)
cannam@85 304 shift
cannam@85 305 ;;
cannam@85 306 $object)
cannam@85 307 shift
cannam@85 308 ;;
cannam@85 309 *)
cannam@85 310 set fnord "$@" "$arg"
cannam@85 311 shift # fnord
cannam@85 312 shift # $arg
cannam@85 313 ;;
cannam@85 314 esac
cannam@85 315 done
cannam@85 316
cannam@85 317 test -z "$dashmflag" && dashmflag=-M
cannam@85 318 # Require at least two characters before searching for `:'
cannam@85 319 # in the target name. This is to cope with DOS-style filenames:
cannam@85 320 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
cannam@85 321 "$@" $dashmflag |
cannam@85 322 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
cannam@85 323 rm -f "$depfile"
cannam@85 324 cat < "$tmpdepfile" > "$depfile"
cannam@85 325 tr ' ' '
cannam@85 326 ' < "$tmpdepfile" | \
cannam@85 327 ## Some versions of the HPUX 10.20 sed can't process this invocation
cannam@85 328 ## correctly. Breaking it into two sed invocations is a workaround.
cannam@85 329 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
cannam@85 330 rm -f "$tmpdepfile"
cannam@85 331 ;;
cannam@85 332
cannam@85 333 dashXmstdout)
cannam@85 334 # This case only exists to satisfy depend.m4. It is never actually
cannam@85 335 # run, as this mode is specially recognized in the preamble.
cannam@85 336 exit 1
cannam@85 337 ;;
cannam@85 338
cannam@85 339 makedepend)
cannam@85 340 "$@" || exit $?
cannam@85 341 # Remove any Libtool call
cannam@85 342 if test "$libtool" = yes; then
cannam@85 343 while test $1 != '--mode=compile'; do
cannam@85 344 shift
cannam@85 345 done
cannam@85 346 shift
cannam@85 347 fi
cannam@85 348 # X makedepend
cannam@85 349 shift
cannam@85 350 cleared=no
cannam@85 351 for arg in "$@"; do
cannam@85 352 case $cleared in
cannam@85 353 no)
cannam@85 354 set ""; shift
cannam@85 355 cleared=yes ;;
cannam@85 356 esac
cannam@85 357 case "$arg" in
cannam@85 358 -D*|-I*)
cannam@85 359 set fnord "$@" "$arg"; shift ;;
cannam@85 360 # Strip any option that makedepend may not understand. Remove
cannam@85 361 # the object too, otherwise makedepend will parse it as a source file.
cannam@85 362 -*|$object)
cannam@85 363 ;;
cannam@85 364 *)
cannam@85 365 set fnord "$@" "$arg"; shift ;;
cannam@85 366 esac
cannam@85 367 done
cannam@85 368 obj_suffix="`echo $object | sed 's/^.*\././'`"
cannam@85 369 touch "$tmpdepfile"
cannam@85 370 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
cannam@85 371 rm -f "$depfile"
cannam@85 372 cat < "$tmpdepfile" > "$depfile"
cannam@85 373 sed '1,2d' "$tmpdepfile" | tr ' ' '
cannam@85 374 ' | \
cannam@85 375 ## Some versions of the HPUX 10.20 sed can't process this invocation
cannam@85 376 ## correctly. Breaking it into two sed invocations is a workaround.
cannam@85 377 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
cannam@85 378 rm -f "$tmpdepfile" "$tmpdepfile".bak
cannam@85 379 ;;
cannam@85 380
cannam@85 381 cpp)
cannam@85 382 # Important note: in order to support this mode, a compiler *must*
cannam@85 383 # always write the proprocessed file to stdout.
cannam@85 384 "$@" || exit $?
cannam@85 385
cannam@85 386 # Remove the call to Libtool.
cannam@85 387 if test "$libtool" = yes; then
cannam@85 388 while test $1 != '--mode=compile'; do
cannam@85 389 shift
cannam@85 390 done
cannam@85 391 shift
cannam@85 392 fi
cannam@85 393
cannam@85 394 # Remove `-o $object'.
cannam@85 395 IFS=" "
cannam@85 396 for arg
cannam@85 397 do
cannam@85 398 case $arg in
cannam@85 399 -o)
cannam@85 400 shift
cannam@85 401 ;;
cannam@85 402 $object)
cannam@85 403 shift
cannam@85 404 ;;
cannam@85 405 *)
cannam@85 406 set fnord "$@" "$arg"
cannam@85 407 shift # fnord
cannam@85 408 shift # $arg
cannam@85 409 ;;
cannam@85 410 esac
cannam@85 411 done
cannam@85 412
cannam@85 413 "$@" -E |
cannam@85 414 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
cannam@85 415 sed '$ s: \\$::' > "$tmpdepfile"
cannam@85 416 rm -f "$depfile"
cannam@85 417 echo "$object : \\" > "$depfile"
cannam@85 418 cat < "$tmpdepfile" >> "$depfile"
cannam@85 419 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
cannam@85 420 rm -f "$tmpdepfile"
cannam@85 421 ;;
cannam@85 422
cannam@85 423 msvisualcpp)
cannam@85 424 # Important note: in order to support this mode, a compiler *must*
cannam@85 425 # always write the proprocessed file to stdout, regardless of -o,
cannam@85 426 # because we must use -o when running libtool.
cannam@85 427 "$@" || exit $?
cannam@85 428 IFS=" "
cannam@85 429 for arg
cannam@85 430 do
cannam@85 431 case "$arg" in
cannam@85 432 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
cannam@85 433 set fnord "$@"
cannam@85 434 shift
cannam@85 435 shift
cannam@85 436 ;;
cannam@85 437 *)
cannam@85 438 set fnord "$@" "$arg"
cannam@85 439 shift
cannam@85 440 shift
cannam@85 441 ;;
cannam@85 442 esac
cannam@85 443 done
cannam@85 444 "$@" -E |
cannam@85 445 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
cannam@85 446 rm -f "$depfile"
cannam@85 447 echo "$object : \\" > "$depfile"
cannam@85 448 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
cannam@85 449 echo " " >> "$depfile"
cannam@85 450 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
cannam@85 451 rm -f "$tmpdepfile"
cannam@85 452 ;;
cannam@85 453
cannam@85 454 none)
cannam@85 455 exec "$@"
cannam@85 456 ;;
cannam@85 457
cannam@85 458 *)
cannam@85 459 echo "Unknown depmode $depmode" 1>&2
cannam@85 460 exit 1
cannam@85 461 ;;
cannam@85 462 esac
cannam@85 463
cannam@85 464 exit 0