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