annotate fft/fftw/fftw-3.3.4/depcomp @ 40:223f770b5341 kissfft-double tip

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