annotate src/fftw-3.3.8/depcomp @ 84:08ae793730bd

Add null config files
author Chris Cannam
date Mon, 02 Mar 2020 14:03:47 +0000
parents d0c2a83c1364
children
rev   line source
Chris@82 1 #! /bin/sh
Chris@82 2 # depcomp - compile a program generating dependencies as side-effects
Chris@82 3
Chris@82 4 scriptversion=2013-05-30.07; # UTC
Chris@82 5
Chris@82 6 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
Chris@82 7
Chris@82 8 # This program is free software; you can redistribute it and/or modify
Chris@82 9 # it under the terms of the GNU General Public License as published by
Chris@82 10 # the Free Software Foundation; either version 2, or (at your option)
Chris@82 11 # any later version.
Chris@82 12
Chris@82 13 # This program is distributed in the hope that it will be useful,
Chris@82 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@82 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@82 16 # GNU General Public License for more details.
Chris@82 17
Chris@82 18 # You should have received a copy of the GNU General Public License
Chris@82 19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
Chris@82 20
Chris@82 21 # As a special exception to the GNU General Public License, if you
Chris@82 22 # distribute this file as part of a program that contains a
Chris@82 23 # configuration script generated by Autoconf, you may include it under
Chris@82 24 # the same distribution terms that you use for the rest of that program.
Chris@82 25
Chris@82 26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
Chris@82 27
Chris@82 28 case $1 in
Chris@82 29 '')
Chris@82 30 echo "$0: No command. Try '$0 --help' for more information." 1>&2
Chris@82 31 exit 1;
Chris@82 32 ;;
Chris@82 33 -h | --h*)
Chris@82 34 cat <<\EOF
Chris@82 35 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Chris@82 36
Chris@82 37 Run PROGRAMS ARGS to compile a file, generating dependencies
Chris@82 38 as side-effects.
Chris@82 39
Chris@82 40 Environment variables:
Chris@82 41 depmode Dependency tracking mode.
Chris@82 42 source Source file read by 'PROGRAMS ARGS'.
Chris@82 43 object Object file output by 'PROGRAMS ARGS'.
Chris@82 44 DEPDIR directory where to store dependencies.
Chris@82 45 depfile Dependency file to output.
Chris@82 46 tmpdepfile Temporary file to use when outputting dependencies.
Chris@82 47 libtool Whether libtool is used (yes/no).
Chris@82 48
Chris@82 49 Report bugs to <bug-automake@gnu.org>.
Chris@82 50 EOF
Chris@82 51 exit $?
Chris@82 52 ;;
Chris@82 53 -v | --v*)
Chris@82 54 echo "depcomp $scriptversion"
Chris@82 55 exit $?
Chris@82 56 ;;
Chris@82 57 esac
Chris@82 58
Chris@82 59 # Get the directory component of the given path, and save it in the
Chris@82 60 # global variables '$dir'. Note that this directory component will
Chris@82 61 # be either empty or ending with a '/' character. This is deliberate.
Chris@82 62 set_dir_from ()
Chris@82 63 {
Chris@82 64 case $1 in
Chris@82 65 */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
Chris@82 66 *) dir=;;
Chris@82 67 esac
Chris@82 68 }
Chris@82 69
Chris@82 70 # Get the suffix-stripped basename of the given path, and save it the
Chris@82 71 # global variable '$base'.
Chris@82 72 set_base_from ()
Chris@82 73 {
Chris@82 74 base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
Chris@82 75 }
Chris@82 76
Chris@82 77 # If no dependency file was actually created by the compiler invocation,
Chris@82 78 # we still have to create a dummy depfile, to avoid errors with the
Chris@82 79 # Makefile "include basename.Plo" scheme.
Chris@82 80 make_dummy_depfile ()
Chris@82 81 {
Chris@82 82 echo "#dummy" > "$depfile"
Chris@82 83 }
Chris@82 84
Chris@82 85 # Factor out some common post-processing of the generated depfile.
Chris@82 86 # Requires the auxiliary global variable '$tmpdepfile' to be set.
Chris@82 87 aix_post_process_depfile ()
Chris@82 88 {
Chris@82 89 # If the compiler actually managed to produce a dependency file,
Chris@82 90 # post-process it.
Chris@82 91 if test -f "$tmpdepfile"; then
Chris@82 92 # Each line is of the form 'foo.o: dependency.h'.
Chris@82 93 # Do two passes, one to just change these to
Chris@82 94 # $object: dependency.h
Chris@82 95 # and one to simply output
Chris@82 96 # dependency.h:
Chris@82 97 # which is needed to avoid the deleted-header problem.
Chris@82 98 { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
Chris@82 99 sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
Chris@82 100 } > "$depfile"
Chris@82 101 rm -f "$tmpdepfile"
Chris@82 102 else
Chris@82 103 make_dummy_depfile
Chris@82 104 fi
Chris@82 105 }
Chris@82 106
Chris@82 107 # A tabulation character.
Chris@82 108 tab=' '
Chris@82 109 # A newline character.
Chris@82 110 nl='
Chris@82 111 '
Chris@82 112 # Character ranges might be problematic outside the C locale.
Chris@82 113 # These definitions help.
Chris@82 114 upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
Chris@82 115 lower=abcdefghijklmnopqrstuvwxyz
Chris@82 116 digits=0123456789
Chris@82 117 alpha=${upper}${lower}
Chris@82 118
Chris@82 119 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
Chris@82 120 echo "depcomp: Variables source, object and depmode must be set" 1>&2
Chris@82 121 exit 1
Chris@82 122 fi
Chris@82 123
Chris@82 124 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
Chris@82 125 depfile=${depfile-`echo "$object" |
Chris@82 126 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
Chris@82 127 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
Chris@82 128
Chris@82 129 rm -f "$tmpdepfile"
Chris@82 130
Chris@82 131 # Avoid interferences from the environment.
Chris@82 132 gccflag= dashmflag=
Chris@82 133
Chris@82 134 # Some modes work just like other modes, but use different flags. We
Chris@82 135 # parameterize here, but still list the modes in the big case below,
Chris@82 136 # to make depend.m4 easier to write. Note that we *cannot* use a case
Chris@82 137 # here, because this file can only contain one case statement.
Chris@82 138 if test "$depmode" = hp; then
Chris@82 139 # HP compiler uses -M and no extra arg.
Chris@82 140 gccflag=-M
Chris@82 141 depmode=gcc
Chris@82 142 fi
Chris@82 143
Chris@82 144 if test "$depmode" = dashXmstdout; then
Chris@82 145 # This is just like dashmstdout with a different argument.
Chris@82 146 dashmflag=-xM
Chris@82 147 depmode=dashmstdout
Chris@82 148 fi
Chris@82 149
Chris@82 150 cygpath_u="cygpath -u -f -"
Chris@82 151 if test "$depmode" = msvcmsys; then
Chris@82 152 # This is just like msvisualcpp but w/o cygpath translation.
Chris@82 153 # Just convert the backslash-escaped backslashes to single forward
Chris@82 154 # slashes to satisfy depend.m4
Chris@82 155 cygpath_u='sed s,\\\\,/,g'
Chris@82 156 depmode=msvisualcpp
Chris@82 157 fi
Chris@82 158
Chris@82 159 if test "$depmode" = msvc7msys; then
Chris@82 160 # This is just like msvc7 but w/o cygpath translation.
Chris@82 161 # Just convert the backslash-escaped backslashes to single forward
Chris@82 162 # slashes to satisfy depend.m4
Chris@82 163 cygpath_u='sed s,\\\\,/,g'
Chris@82 164 depmode=msvc7
Chris@82 165 fi
Chris@82 166
Chris@82 167 if test "$depmode" = xlc; then
Chris@82 168 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
Chris@82 169 gccflag=-qmakedep=gcc,-MF
Chris@82 170 depmode=gcc
Chris@82 171 fi
Chris@82 172
Chris@82 173 case "$depmode" in
Chris@82 174 gcc3)
Chris@82 175 ## gcc 3 implements dependency tracking that does exactly what
Chris@82 176 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
Chris@82 177 ## it if -MD -MP comes after the -MF stuff. Hmm.
Chris@82 178 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
Chris@82 179 ## the command line argument order; so add the flags where they
Chris@82 180 ## appear in depend2.am. Note that the slowdown incurred here
Chris@82 181 ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
Chris@82 182 for arg
Chris@82 183 do
Chris@82 184 case $arg in
Chris@82 185 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
Chris@82 186 *) set fnord "$@" "$arg" ;;
Chris@82 187 esac
Chris@82 188 shift # fnord
Chris@82 189 shift # $arg
Chris@82 190 done
Chris@82 191 "$@"
Chris@82 192 stat=$?
Chris@82 193 if test $stat -ne 0; then
Chris@82 194 rm -f "$tmpdepfile"
Chris@82 195 exit $stat
Chris@82 196 fi
Chris@82 197 mv "$tmpdepfile" "$depfile"
Chris@82 198 ;;
Chris@82 199
Chris@82 200 gcc)
Chris@82 201 ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
Chris@82 202 ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
Chris@82 203 ## (see the conditional assignment to $gccflag above).
Chris@82 204 ## There are various ways to get dependency output from gcc. Here's
Chris@82 205 ## why we pick this rather obscure method:
Chris@82 206 ## - Don't want to use -MD because we'd like the dependencies to end
Chris@82 207 ## up in a subdir. Having to rename by hand is ugly.
Chris@82 208 ## (We might end up doing this anyway to support other compilers.)
Chris@82 209 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
Chris@82 210 ## -MM, not -M (despite what the docs say). Also, it might not be
Chris@82 211 ## supported by the other compilers which use the 'gcc' depmode.
Chris@82 212 ## - Using -M directly means running the compiler twice (even worse
Chris@82 213 ## than renaming).
Chris@82 214 if test -z "$gccflag"; then
Chris@82 215 gccflag=-MD,
Chris@82 216 fi
Chris@82 217 "$@" -Wp,"$gccflag$tmpdepfile"
Chris@82 218 stat=$?
Chris@82 219 if test $stat -ne 0; then
Chris@82 220 rm -f "$tmpdepfile"
Chris@82 221 exit $stat
Chris@82 222 fi
Chris@82 223 rm -f "$depfile"
Chris@82 224 echo "$object : \\" > "$depfile"
Chris@82 225 # The second -e expression handles DOS-style file names with drive
Chris@82 226 # letters.
Chris@82 227 sed -e 's/^[^:]*: / /' \
Chris@82 228 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
Chris@82 229 ## This next piece of magic avoids the "deleted header file" problem.
Chris@82 230 ## The problem is that when a header file which appears in a .P file
Chris@82 231 ## is deleted, the dependency causes make to die (because there is
Chris@82 232 ## typically no way to rebuild the header). We avoid this by adding
Chris@82 233 ## dummy dependencies for each header file. Too bad gcc doesn't do
Chris@82 234 ## this for us directly.
Chris@82 235 ## Some versions of gcc put a space before the ':'. On the theory
Chris@82 236 ## that the space means something, we add a space to the output as
Chris@82 237 ## well. hp depmode also adds that space, but also prefixes the VPATH
Chris@82 238 ## to the object. Take care to not repeat it in the output.
Chris@82 239 ## Some versions of the HPUX 10.20 sed can't process this invocation
Chris@82 240 ## correctly. Breaking it into two sed invocations is a workaround.
Chris@82 241 tr ' ' "$nl" < "$tmpdepfile" \
Chris@82 242 | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
Chris@82 243 | sed -e 's/$/ :/' >> "$depfile"
Chris@82 244 rm -f "$tmpdepfile"
Chris@82 245 ;;
Chris@82 246
Chris@82 247 hp)
Chris@82 248 # This case exists only to let depend.m4 do its work. It works by
Chris@82 249 # looking at the text of this script. This case will never be run,
Chris@82 250 # since it is checked for above.
Chris@82 251 exit 1
Chris@82 252 ;;
Chris@82 253
Chris@82 254 sgi)
Chris@82 255 if test "$libtool" = yes; then
Chris@82 256 "$@" "-Wp,-MDupdate,$tmpdepfile"
Chris@82 257 else
Chris@82 258 "$@" -MDupdate "$tmpdepfile"
Chris@82 259 fi
Chris@82 260 stat=$?
Chris@82 261 if test $stat -ne 0; then
Chris@82 262 rm -f "$tmpdepfile"
Chris@82 263 exit $stat
Chris@82 264 fi
Chris@82 265 rm -f "$depfile"
Chris@82 266
Chris@82 267 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
Chris@82 268 echo "$object : \\" > "$depfile"
Chris@82 269 # Clip off the initial element (the dependent). Don't try to be
Chris@82 270 # clever and replace this with sed code, as IRIX sed won't handle
Chris@82 271 # lines with more than a fixed number of characters (4096 in
Chris@82 272 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
Chris@82 273 # the IRIX cc adds comments like '#:fec' to the end of the
Chris@82 274 # dependency line.
Chris@82 275 tr ' ' "$nl" < "$tmpdepfile" \
Chris@82 276 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
Chris@82 277 | tr "$nl" ' ' >> "$depfile"
Chris@82 278 echo >> "$depfile"
Chris@82 279 # The second pass generates a dummy entry for each header file.
Chris@82 280 tr ' ' "$nl" < "$tmpdepfile" \
Chris@82 281 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
Chris@82 282 >> "$depfile"
Chris@82 283 else
Chris@82 284 make_dummy_depfile
Chris@82 285 fi
Chris@82 286 rm -f "$tmpdepfile"
Chris@82 287 ;;
Chris@82 288
Chris@82 289 xlc)
Chris@82 290 # This case exists only to let depend.m4 do its work. It works by
Chris@82 291 # looking at the text of this script. This case will never be run,
Chris@82 292 # since it is checked for above.
Chris@82 293 exit 1
Chris@82 294 ;;
Chris@82 295
Chris@82 296 aix)
Chris@82 297 # The C for AIX Compiler uses -M and outputs the dependencies
Chris@82 298 # in a .u file. In older versions, this file always lives in the
Chris@82 299 # current directory. Also, the AIX compiler puts '$object:' at the
Chris@82 300 # start of each line; $object doesn't have directory information.
Chris@82 301 # Version 6 uses the directory in both cases.
Chris@82 302 set_dir_from "$object"
Chris@82 303 set_base_from "$object"
Chris@82 304 if test "$libtool" = yes; then
Chris@82 305 tmpdepfile1=$dir$base.u
Chris@82 306 tmpdepfile2=$base.u
Chris@82 307 tmpdepfile3=$dir.libs/$base.u
Chris@82 308 "$@" -Wc,-M
Chris@82 309 else
Chris@82 310 tmpdepfile1=$dir$base.u
Chris@82 311 tmpdepfile2=$dir$base.u
Chris@82 312 tmpdepfile3=$dir$base.u
Chris@82 313 "$@" -M
Chris@82 314 fi
Chris@82 315 stat=$?
Chris@82 316 if test $stat -ne 0; then
Chris@82 317 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
Chris@82 318 exit $stat
Chris@82 319 fi
Chris@82 320
Chris@82 321 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
Chris@82 322 do
Chris@82 323 test -f "$tmpdepfile" && break
Chris@82 324 done
Chris@82 325 aix_post_process_depfile
Chris@82 326 ;;
Chris@82 327
Chris@82 328 tcc)
Chris@82 329 # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
Chris@82 330 # FIXME: That version still under development at the moment of writing.
Chris@82 331 # Make that this statement remains true also for stable, released
Chris@82 332 # versions.
Chris@82 333 # It will wrap lines (doesn't matter whether long or short) with a
Chris@82 334 # trailing '\', as in:
Chris@82 335 #
Chris@82 336 # foo.o : \
Chris@82 337 # foo.c \
Chris@82 338 # foo.h \
Chris@82 339 #
Chris@82 340 # It will put a trailing '\' even on the last line, and will use leading
Chris@82 341 # spaces rather than leading tabs (at least since its commit 0394caf7
Chris@82 342 # "Emit spaces for -MD").
Chris@82 343 "$@" -MD -MF "$tmpdepfile"
Chris@82 344 stat=$?
Chris@82 345 if test $stat -ne 0; then
Chris@82 346 rm -f "$tmpdepfile"
Chris@82 347 exit $stat
Chris@82 348 fi
Chris@82 349 rm -f "$depfile"
Chris@82 350 # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
Chris@82 351 # We have to change lines of the first kind to '$object: \'.
Chris@82 352 sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
Chris@82 353 # And for each line of the second kind, we have to emit a 'dep.h:'
Chris@82 354 # dummy dependency, to avoid the deleted-header problem.
Chris@82 355 sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
Chris@82 356 rm -f "$tmpdepfile"
Chris@82 357 ;;
Chris@82 358
Chris@82 359 ## The order of this option in the case statement is important, since the
Chris@82 360 ## shell code in configure will try each of these formats in the order
Chris@82 361 ## listed in this file. A plain '-MD' option would be understood by many
Chris@82 362 ## compilers, so we must ensure this comes after the gcc and icc options.
Chris@82 363 pgcc)
Chris@82 364 # Portland's C compiler understands '-MD'.
Chris@82 365 # Will always output deps to 'file.d' where file is the root name of the
Chris@82 366 # source file under compilation, even if file resides in a subdirectory.
Chris@82 367 # The object file name does not affect the name of the '.d' file.
Chris@82 368 # pgcc 10.2 will output
Chris@82 369 # foo.o: sub/foo.c sub/foo.h
Chris@82 370 # and will wrap long lines using '\' :
Chris@82 371 # foo.o: sub/foo.c ... \
Chris@82 372 # sub/foo.h ... \
Chris@82 373 # ...
Chris@82 374 set_dir_from "$object"
Chris@82 375 # Use the source, not the object, to determine the base name, since
Chris@82 376 # that's sadly what pgcc will do too.
Chris@82 377 set_base_from "$source"
Chris@82 378 tmpdepfile=$base.d
Chris@82 379
Chris@82 380 # For projects that build the same source file twice into different object
Chris@82 381 # files, the pgcc approach of using the *source* file root name can cause
Chris@82 382 # problems in parallel builds. Use a locking strategy to avoid stomping on
Chris@82 383 # the same $tmpdepfile.
Chris@82 384 lockdir=$base.d-lock
Chris@82 385 trap "
Chris@82 386 echo '$0: caught signal, cleaning up...' >&2
Chris@82 387 rmdir '$lockdir'
Chris@82 388 exit 1
Chris@82 389 " 1 2 13 15
Chris@82 390 numtries=100
Chris@82 391 i=$numtries
Chris@82 392 while test $i -gt 0; do
Chris@82 393 # mkdir is a portable test-and-set.
Chris@82 394 if mkdir "$lockdir" 2>/dev/null; then
Chris@82 395 # This process acquired the lock.
Chris@82 396 "$@" -MD
Chris@82 397 stat=$?
Chris@82 398 # Release the lock.
Chris@82 399 rmdir "$lockdir"
Chris@82 400 break
Chris@82 401 else
Chris@82 402 # If the lock is being held by a different process, wait
Chris@82 403 # until the winning process is done or we timeout.
Chris@82 404 while test -d "$lockdir" && test $i -gt 0; do
Chris@82 405 sleep 1
Chris@82 406 i=`expr $i - 1`
Chris@82 407 done
Chris@82 408 fi
Chris@82 409 i=`expr $i - 1`
Chris@82 410 done
Chris@82 411 trap - 1 2 13 15
Chris@82 412 if test $i -le 0; then
Chris@82 413 echo "$0: failed to acquire lock after $numtries attempts" >&2
Chris@82 414 echo "$0: check lockdir '$lockdir'" >&2
Chris@82 415 exit 1
Chris@82 416 fi
Chris@82 417
Chris@82 418 if test $stat -ne 0; then
Chris@82 419 rm -f "$tmpdepfile"
Chris@82 420 exit $stat
Chris@82 421 fi
Chris@82 422 rm -f "$depfile"
Chris@82 423 # Each line is of the form `foo.o: dependent.h',
Chris@82 424 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
Chris@82 425 # Do two passes, one to just change these to
Chris@82 426 # `$object: dependent.h' and one to simply `dependent.h:'.
Chris@82 427 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
Chris@82 428 # Some versions of the HPUX 10.20 sed can't process this invocation
Chris@82 429 # correctly. Breaking it into two sed invocations is a workaround.
Chris@82 430 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
Chris@82 431 | sed -e 's/$/ :/' >> "$depfile"
Chris@82 432 rm -f "$tmpdepfile"
Chris@82 433 ;;
Chris@82 434
Chris@82 435 hp2)
Chris@82 436 # The "hp" stanza above does not work with aCC (C++) and HP's ia64
Chris@82 437 # compilers, which have integrated preprocessors. The correct option
Chris@82 438 # to use with these is +Maked; it writes dependencies to a file named
Chris@82 439 # 'foo.d', which lands next to the object file, wherever that
Chris@82 440 # happens to be.
Chris@82 441 # Much of this is similar to the tru64 case; see comments there.
Chris@82 442 set_dir_from "$object"
Chris@82 443 set_base_from "$object"
Chris@82 444 if test "$libtool" = yes; then
Chris@82 445 tmpdepfile1=$dir$base.d
Chris@82 446 tmpdepfile2=$dir.libs/$base.d
Chris@82 447 "$@" -Wc,+Maked
Chris@82 448 else
Chris@82 449 tmpdepfile1=$dir$base.d
Chris@82 450 tmpdepfile2=$dir$base.d
Chris@82 451 "$@" +Maked
Chris@82 452 fi
Chris@82 453 stat=$?
Chris@82 454 if test $stat -ne 0; then
Chris@82 455 rm -f "$tmpdepfile1" "$tmpdepfile2"
Chris@82 456 exit $stat
Chris@82 457 fi
Chris@82 458
Chris@82 459 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
Chris@82 460 do
Chris@82 461 test -f "$tmpdepfile" && break
Chris@82 462 done
Chris@82 463 if test -f "$tmpdepfile"; then
Chris@82 464 sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
Chris@82 465 # Add 'dependent.h:' lines.
Chris@82 466 sed -ne '2,${
Chris@82 467 s/^ *//
Chris@82 468 s/ \\*$//
Chris@82 469 s/$/:/
Chris@82 470 p
Chris@82 471 }' "$tmpdepfile" >> "$depfile"
Chris@82 472 else
Chris@82 473 make_dummy_depfile
Chris@82 474 fi
Chris@82 475 rm -f "$tmpdepfile" "$tmpdepfile2"
Chris@82 476 ;;
Chris@82 477
Chris@82 478 tru64)
Chris@82 479 # The Tru64 compiler uses -MD to generate dependencies as a side
Chris@82 480 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
Chris@82 481 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
Chris@82 482 # dependencies in 'foo.d' instead, so we check for that too.
Chris@82 483 # Subdirectories are respected.
Chris@82 484 set_dir_from "$object"
Chris@82 485 set_base_from "$object"
Chris@82 486
Chris@82 487 if test "$libtool" = yes; then
Chris@82 488 # Libtool generates 2 separate objects for the 2 libraries. These
Chris@82 489 # two compilations output dependencies in $dir.libs/$base.o.d and
Chris@82 490 # in $dir$base.o.d. We have to check for both files, because
Chris@82 491 # one of the two compilations can be disabled. We should prefer
Chris@82 492 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
Chris@82 493 # automatically cleaned when .libs/ is deleted, while ignoring
Chris@82 494 # the former would cause a distcleancheck panic.
Chris@82 495 tmpdepfile1=$dir$base.o.d # libtool 1.5
Chris@82 496 tmpdepfile2=$dir.libs/$base.o.d # Likewise.
Chris@82 497 tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
Chris@82 498 "$@" -Wc,-MD
Chris@82 499 else
Chris@82 500 tmpdepfile1=$dir$base.d
Chris@82 501 tmpdepfile2=$dir$base.d
Chris@82 502 tmpdepfile3=$dir$base.d
Chris@82 503 "$@" -MD
Chris@82 504 fi
Chris@82 505
Chris@82 506 stat=$?
Chris@82 507 if test $stat -ne 0; then
Chris@82 508 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
Chris@82 509 exit $stat
Chris@82 510 fi
Chris@82 511
Chris@82 512 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
Chris@82 513 do
Chris@82 514 test -f "$tmpdepfile" && break
Chris@82 515 done
Chris@82 516 # Same post-processing that is required for AIX mode.
Chris@82 517 aix_post_process_depfile
Chris@82 518 ;;
Chris@82 519
Chris@82 520 msvc7)
Chris@82 521 if test "$libtool" = yes; then
Chris@82 522 showIncludes=-Wc,-showIncludes
Chris@82 523 else
Chris@82 524 showIncludes=-showIncludes
Chris@82 525 fi
Chris@82 526 "$@" $showIncludes > "$tmpdepfile"
Chris@82 527 stat=$?
Chris@82 528 grep -v '^Note: including file: ' "$tmpdepfile"
Chris@82 529 if test $stat -ne 0; then
Chris@82 530 rm -f "$tmpdepfile"
Chris@82 531 exit $stat
Chris@82 532 fi
Chris@82 533 rm -f "$depfile"
Chris@82 534 echo "$object : \\" > "$depfile"
Chris@82 535 # The first sed program below extracts the file names and escapes
Chris@82 536 # backslashes for cygpath. The second sed program outputs the file
Chris@82 537 # name when reading, but also accumulates all include files in the
Chris@82 538 # hold buffer in order to output them again at the end. This only
Chris@82 539 # works with sed implementations that can handle large buffers.
Chris@82 540 sed < "$tmpdepfile" -n '
Chris@82 541 /^Note: including file: *\(.*\)/ {
Chris@82 542 s//\1/
Chris@82 543 s/\\/\\\\/g
Chris@82 544 p
Chris@82 545 }' | $cygpath_u | sort -u | sed -n '
Chris@82 546 s/ /\\ /g
Chris@82 547 s/\(.*\)/'"$tab"'\1 \\/p
Chris@82 548 s/.\(.*\) \\/\1:/
Chris@82 549 H
Chris@82 550 $ {
Chris@82 551 s/.*/'"$tab"'/
Chris@82 552 G
Chris@82 553 p
Chris@82 554 }' >> "$depfile"
Chris@82 555 echo >> "$depfile" # make sure the fragment doesn't end with a backslash
Chris@82 556 rm -f "$tmpdepfile"
Chris@82 557 ;;
Chris@82 558
Chris@82 559 msvc7msys)
Chris@82 560 # This case exists only to let depend.m4 do its work. It works by
Chris@82 561 # looking at the text of this script. This case will never be run,
Chris@82 562 # since it is checked for above.
Chris@82 563 exit 1
Chris@82 564 ;;
Chris@82 565
Chris@82 566 #nosideeffect)
Chris@82 567 # This comment above is used by automake to tell side-effect
Chris@82 568 # dependency tracking mechanisms from slower ones.
Chris@82 569
Chris@82 570 dashmstdout)
Chris@82 571 # Important note: in order to support this mode, a compiler *must*
Chris@82 572 # always write the preprocessed file to stdout, regardless of -o.
Chris@82 573 "$@" || exit $?
Chris@82 574
Chris@82 575 # Remove the call to Libtool.
Chris@82 576 if test "$libtool" = yes; then
Chris@82 577 while test "X$1" != 'X--mode=compile'; do
Chris@82 578 shift
Chris@82 579 done
Chris@82 580 shift
Chris@82 581 fi
Chris@82 582
Chris@82 583 # Remove '-o $object'.
Chris@82 584 IFS=" "
Chris@82 585 for arg
Chris@82 586 do
Chris@82 587 case $arg in
Chris@82 588 -o)
Chris@82 589 shift
Chris@82 590 ;;
Chris@82 591 $object)
Chris@82 592 shift
Chris@82 593 ;;
Chris@82 594 *)
Chris@82 595 set fnord "$@" "$arg"
Chris@82 596 shift # fnord
Chris@82 597 shift # $arg
Chris@82 598 ;;
Chris@82 599 esac
Chris@82 600 done
Chris@82 601
Chris@82 602 test -z "$dashmflag" && dashmflag=-M
Chris@82 603 # Require at least two characters before searching for ':'
Chris@82 604 # in the target name. This is to cope with DOS-style filenames:
Chris@82 605 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
Chris@82 606 "$@" $dashmflag |
Chris@82 607 sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
Chris@82 608 rm -f "$depfile"
Chris@82 609 cat < "$tmpdepfile" > "$depfile"
Chris@82 610 # Some versions of the HPUX 10.20 sed can't process this sed invocation
Chris@82 611 # correctly. Breaking it into two sed invocations is a workaround.
Chris@82 612 tr ' ' "$nl" < "$tmpdepfile" \
Chris@82 613 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
Chris@82 614 | sed -e 's/$/ :/' >> "$depfile"
Chris@82 615 rm -f "$tmpdepfile"
Chris@82 616 ;;
Chris@82 617
Chris@82 618 dashXmstdout)
Chris@82 619 # This case only exists to satisfy depend.m4. It is never actually
Chris@82 620 # run, as this mode is specially recognized in the preamble.
Chris@82 621 exit 1
Chris@82 622 ;;
Chris@82 623
Chris@82 624 makedepend)
Chris@82 625 "$@" || exit $?
Chris@82 626 # Remove any Libtool call
Chris@82 627 if test "$libtool" = yes; then
Chris@82 628 while test "X$1" != 'X--mode=compile'; do
Chris@82 629 shift
Chris@82 630 done
Chris@82 631 shift
Chris@82 632 fi
Chris@82 633 # X makedepend
Chris@82 634 shift
Chris@82 635 cleared=no eat=no
Chris@82 636 for arg
Chris@82 637 do
Chris@82 638 case $cleared in
Chris@82 639 no)
Chris@82 640 set ""; shift
Chris@82 641 cleared=yes ;;
Chris@82 642 esac
Chris@82 643 if test $eat = yes; then
Chris@82 644 eat=no
Chris@82 645 continue
Chris@82 646 fi
Chris@82 647 case "$arg" in
Chris@82 648 -D*|-I*)
Chris@82 649 set fnord "$@" "$arg"; shift ;;
Chris@82 650 # Strip any option that makedepend may not understand. Remove
Chris@82 651 # the object too, otherwise makedepend will parse it as a source file.
Chris@82 652 -arch)
Chris@82 653 eat=yes ;;
Chris@82 654 -*|$object)
Chris@82 655 ;;
Chris@82 656 *)
Chris@82 657 set fnord "$@" "$arg"; shift ;;
Chris@82 658 esac
Chris@82 659 done
Chris@82 660 obj_suffix=`echo "$object" | sed 's/^.*\././'`
Chris@82 661 touch "$tmpdepfile"
Chris@82 662 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
Chris@82 663 rm -f "$depfile"
Chris@82 664 # makedepend may prepend the VPATH from the source file name to the object.
Chris@82 665 # No need to regex-escape $object, excess matching of '.' is harmless.
Chris@82 666 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
Chris@82 667 # Some versions of the HPUX 10.20 sed can't process the last invocation
Chris@82 668 # correctly. Breaking it into two sed invocations is a workaround.
Chris@82 669 sed '1,2d' "$tmpdepfile" \
Chris@82 670 | tr ' ' "$nl" \
Chris@82 671 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
Chris@82 672 | sed -e 's/$/ :/' >> "$depfile"
Chris@82 673 rm -f "$tmpdepfile" "$tmpdepfile".bak
Chris@82 674 ;;
Chris@82 675
Chris@82 676 cpp)
Chris@82 677 # Important note: in order to support this mode, a compiler *must*
Chris@82 678 # always write the preprocessed file to stdout.
Chris@82 679 "$@" || exit $?
Chris@82 680
Chris@82 681 # Remove the call to Libtool.
Chris@82 682 if test "$libtool" = yes; then
Chris@82 683 while test "X$1" != 'X--mode=compile'; do
Chris@82 684 shift
Chris@82 685 done
Chris@82 686 shift
Chris@82 687 fi
Chris@82 688
Chris@82 689 # Remove '-o $object'.
Chris@82 690 IFS=" "
Chris@82 691 for arg
Chris@82 692 do
Chris@82 693 case $arg in
Chris@82 694 -o)
Chris@82 695 shift
Chris@82 696 ;;
Chris@82 697 $object)
Chris@82 698 shift
Chris@82 699 ;;
Chris@82 700 *)
Chris@82 701 set fnord "$@" "$arg"
Chris@82 702 shift # fnord
Chris@82 703 shift # $arg
Chris@82 704 ;;
Chris@82 705 esac
Chris@82 706 done
Chris@82 707
Chris@82 708 "$@" -E \
Chris@82 709 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
Chris@82 710 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
Chris@82 711 | sed '$ s: \\$::' > "$tmpdepfile"
Chris@82 712 rm -f "$depfile"
Chris@82 713 echo "$object : \\" > "$depfile"
Chris@82 714 cat < "$tmpdepfile" >> "$depfile"
Chris@82 715 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
Chris@82 716 rm -f "$tmpdepfile"
Chris@82 717 ;;
Chris@82 718
Chris@82 719 msvisualcpp)
Chris@82 720 # Important note: in order to support this mode, a compiler *must*
Chris@82 721 # always write the preprocessed file to stdout.
Chris@82 722 "$@" || exit $?
Chris@82 723
Chris@82 724 # Remove the call to Libtool.
Chris@82 725 if test "$libtool" = yes; then
Chris@82 726 while test "X$1" != 'X--mode=compile'; do
Chris@82 727 shift
Chris@82 728 done
Chris@82 729 shift
Chris@82 730 fi
Chris@82 731
Chris@82 732 IFS=" "
Chris@82 733 for arg
Chris@82 734 do
Chris@82 735 case "$arg" in
Chris@82 736 -o)
Chris@82 737 shift
Chris@82 738 ;;
Chris@82 739 $object)
Chris@82 740 shift
Chris@82 741 ;;
Chris@82 742 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
Chris@82 743 set fnord "$@"
Chris@82 744 shift
Chris@82 745 shift
Chris@82 746 ;;
Chris@82 747 *)
Chris@82 748 set fnord "$@" "$arg"
Chris@82 749 shift
Chris@82 750 shift
Chris@82 751 ;;
Chris@82 752 esac
Chris@82 753 done
Chris@82 754 "$@" -E 2>/dev/null |
Chris@82 755 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
Chris@82 756 rm -f "$depfile"
Chris@82 757 echo "$object : \\" > "$depfile"
Chris@82 758 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
Chris@82 759 echo "$tab" >> "$depfile"
Chris@82 760 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
Chris@82 761 rm -f "$tmpdepfile"
Chris@82 762 ;;
Chris@82 763
Chris@82 764 msvcmsys)
Chris@82 765 # This case exists only to let depend.m4 do its work. It works by
Chris@82 766 # looking at the text of this script. This case will never be run,
Chris@82 767 # since it is checked for above.
Chris@82 768 exit 1
Chris@82 769 ;;
Chris@82 770
Chris@82 771 none)
Chris@82 772 exec "$@"
Chris@82 773 ;;
Chris@82 774
Chris@82 775 *)
Chris@82 776 echo "Unknown depmode $depmode" 1>&2
Chris@82 777 exit 1
Chris@82 778 ;;
Chris@82 779 esac
Chris@82 780
Chris@82 781 exit 0
Chris@82 782
Chris@82 783 # Local Variables:
Chris@82 784 # mode: shell-script
Chris@82 785 # sh-indentation: 2
Chris@82 786 # eval: (add-hook 'write-file-hooks 'time-stamp)
Chris@82 787 # time-stamp-start: "scriptversion="
Chris@82 788 # time-stamp-format: "%:y-%02m-%02d.%02H"
Chris@82 789 # time-stamp-time-zone: "UTC"
Chris@82 790 # time-stamp-end: "; # UTC"
Chris@82 791 # End: