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