annotate src/fftw-3.3.3/depcomp @ 10:37bf6b4a2645

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