1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/depcomp Wed May 31 12:20:04 2017 +0200 1.3 @@ -0,0 +1,791 @@ 1.4 +#! /bin/sh 1.5 +# depcomp - compile a program generating dependencies as side-effects 1.6 + 1.7 +scriptversion=2013-05-30.07; # UTC 1.8 + 1.9 +# Copyright (C) 1999-2013 Free Software Foundation, Inc. 1.10 + 1.11 +# This program is free software; you can redistribute it and/or modify 1.12 +# it under the terms of the GNU General Public License as published by 1.13 +# the Free Software Foundation; either version 2, or (at your option) 1.14 +# any later version. 1.15 + 1.16 +# This program is distributed in the hope that it will be useful, 1.17 +# but WITHOUT ANY WARRANTY; without even the implied warranty of 1.18 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.19 +# GNU General Public License for more details. 1.20 + 1.21 +# You should have received a copy of the GNU General Public License 1.22 +# along with this program. If not, see <http://www.gnu.org/licenses/>. 1.23 + 1.24 +# As a special exception to the GNU General Public License, if you 1.25 +# distribute this file as part of a program that contains a 1.26 +# configuration script generated by Autoconf, you may include it under 1.27 +# the same distribution terms that you use for the rest of that program. 1.28 + 1.29 +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 1.30 + 1.31 +case $1 in 1.32 + '') 1.33 + echo "$0: No command. Try '$0 --help' for more information." 1>&2 1.34 + exit 1; 1.35 + ;; 1.36 + -h | --h*) 1.37 + cat <<\EOF 1.38 +Usage: depcomp [--help] [--version] PROGRAM [ARGS] 1.39 + 1.40 +Run PROGRAMS ARGS to compile a file, generating dependencies 1.41 +as side-effects. 1.42 + 1.43 +Environment variables: 1.44 + depmode Dependency tracking mode. 1.45 + source Source file read by 'PROGRAMS ARGS'. 1.46 + object Object file output by 'PROGRAMS ARGS'. 1.47 + DEPDIR directory where to store dependencies. 1.48 + depfile Dependency file to output. 1.49 + tmpdepfile Temporary file to use when outputting dependencies. 1.50 + libtool Whether libtool is used (yes/no). 1.51 + 1.52 +Report bugs to <bug-automake@gnu.org>. 1.53 +EOF 1.54 + exit $? 1.55 + ;; 1.56 + -v | --v*) 1.57 + echo "depcomp $scriptversion" 1.58 + exit $? 1.59 + ;; 1.60 +esac 1.61 + 1.62 +# Get the directory component of the given path, and save it in the 1.63 +# global variables '$dir'. Note that this directory component will 1.64 +# be either empty or ending with a '/' character. This is deliberate. 1.65 +set_dir_from () 1.66 +{ 1.67 + case $1 in 1.68 + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; 1.69 + *) dir=;; 1.70 + esac 1.71 +} 1.72 + 1.73 +# Get the suffix-stripped basename of the given path, and save it the 1.74 +# global variable '$base'. 1.75 +set_base_from () 1.76 +{ 1.77 + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` 1.78 +} 1.79 + 1.80 +# If no dependency file was actually created by the compiler invocation, 1.81 +# we still have to create a dummy depfile, to avoid errors with the 1.82 +# Makefile "include basename.Plo" scheme. 1.83 +make_dummy_depfile () 1.84 +{ 1.85 + echo "#dummy" > "$depfile" 1.86 +} 1.87 + 1.88 +# Factor out some common post-processing of the generated depfile. 1.89 +# Requires the auxiliary global variable '$tmpdepfile' to be set. 1.90 +aix_post_process_depfile () 1.91 +{ 1.92 + # If the compiler actually managed to produce a dependency file, 1.93 + # post-process it. 1.94 + if test -f "$tmpdepfile"; then 1.95 + # Each line is of the form 'foo.o: dependency.h'. 1.96 + # Do two passes, one to just change these to 1.97 + # $object: dependency.h 1.98 + # and one to simply output 1.99 + # dependency.h: 1.100 + # which is needed to avoid the deleted-header problem. 1.101 + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" 1.102 + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" 1.103 + } > "$depfile" 1.104 + rm -f "$tmpdepfile" 1.105 + else 1.106 + make_dummy_depfile 1.107 + fi 1.108 +} 1.109 + 1.110 +# A tabulation character. 1.111 +tab=' ' 1.112 +# A newline character. 1.113 +nl=' 1.114 +' 1.115 +# Character ranges might be problematic outside the C locale. 1.116 +# These definitions help. 1.117 +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ 1.118 +lower=abcdefghijklmnopqrstuvwxyz 1.119 +digits=0123456789 1.120 +alpha=${upper}${lower} 1.121 + 1.122 +if test -z "$depmode" || test -z "$source" || test -z "$object"; then 1.123 + echo "depcomp: Variables source, object and depmode must be set" 1>&2 1.124 + exit 1 1.125 +fi 1.126 + 1.127 +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 1.128 +depfile=${depfile-`echo "$object" | 1.129 + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 1.130 +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 1.131 + 1.132 +rm -f "$tmpdepfile" 1.133 + 1.134 +# Avoid interferences from the environment. 1.135 +gccflag= dashmflag= 1.136 + 1.137 +# Some modes work just like other modes, but use different flags. We 1.138 +# parameterize here, but still list the modes in the big case below, 1.139 +# to make depend.m4 easier to write. Note that we *cannot* use a case 1.140 +# here, because this file can only contain one case statement. 1.141 +if test "$depmode" = hp; then 1.142 + # HP compiler uses -M and no extra arg. 1.143 + gccflag=-M 1.144 + depmode=gcc 1.145 +fi 1.146 + 1.147 +if test "$depmode" = dashXmstdout; then 1.148 + # This is just like dashmstdout with a different argument. 1.149 + dashmflag=-xM 1.150 + depmode=dashmstdout 1.151 +fi 1.152 + 1.153 +cygpath_u="cygpath -u -f -" 1.154 +if test "$depmode" = msvcmsys; then 1.155 + # This is just like msvisualcpp but w/o cygpath translation. 1.156 + # Just convert the backslash-escaped backslashes to single forward 1.157 + # slashes to satisfy depend.m4 1.158 + cygpath_u='sed s,\\\\,/,g' 1.159 + depmode=msvisualcpp 1.160 +fi 1.161 + 1.162 +if test "$depmode" = msvc7msys; then 1.163 + # This is just like msvc7 but w/o cygpath translation. 1.164 + # Just convert the backslash-escaped backslashes to single forward 1.165 + # slashes to satisfy depend.m4 1.166 + cygpath_u='sed s,\\\\,/,g' 1.167 + depmode=msvc7 1.168 +fi 1.169 + 1.170 +if test "$depmode" = xlc; then 1.171 + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. 1.172 + gccflag=-qmakedep=gcc,-MF 1.173 + depmode=gcc 1.174 +fi 1.175 + 1.176 +case "$depmode" in 1.177 +gcc3) 1.178 +## gcc 3 implements dependency tracking that does exactly what 1.179 +## we want. Yay! Note: for some reason libtool 1.4 doesn't like 1.180 +## it if -MD -MP comes after the -MF stuff. Hmm. 1.181 +## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1.182 +## the command line argument order; so add the flags where they 1.183 +## appear in depend2.am. Note that the slowdown incurred here 1.184 +## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1.185 + for arg 1.186 + do 1.187 + case $arg in 1.188 + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1.189 + *) set fnord "$@" "$arg" ;; 1.190 + esac 1.191 + shift # fnord 1.192 + shift # $arg 1.193 + done 1.194 + "$@" 1.195 + stat=$? 1.196 + if test $stat -ne 0; then 1.197 + rm -f "$tmpdepfile" 1.198 + exit $stat 1.199 + fi 1.200 + mv "$tmpdepfile" "$depfile" 1.201 + ;; 1.202 + 1.203 +gcc) 1.204 +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. 1.205 +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. 1.206 +## (see the conditional assignment to $gccflag above). 1.207 +## There are various ways to get dependency output from gcc. Here's 1.208 +## why we pick this rather obscure method: 1.209 +## - Don't want to use -MD because we'd like the dependencies to end 1.210 +## up in a subdir. Having to rename by hand is ugly. 1.211 +## (We might end up doing this anyway to support other compilers.) 1.212 +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 1.213 +## -MM, not -M (despite what the docs say). Also, it might not be 1.214 +## supported by the other compilers which use the 'gcc' depmode. 1.215 +## - Using -M directly means running the compiler twice (even worse 1.216 +## than renaming). 1.217 + if test -z "$gccflag"; then 1.218 + gccflag=-MD, 1.219 + fi 1.220 + "$@" -Wp,"$gccflag$tmpdepfile" 1.221 + stat=$? 1.222 + if test $stat -ne 0; then 1.223 + rm -f "$tmpdepfile" 1.224 + exit $stat 1.225 + fi 1.226 + rm -f "$depfile" 1.227 + echo "$object : \\" > "$depfile" 1.228 + # The second -e expression handles DOS-style file names with drive 1.229 + # letters. 1.230 + sed -e 's/^[^:]*: / /' \ 1.231 + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1.232 +## This next piece of magic avoids the "deleted header file" problem. 1.233 +## The problem is that when a header file which appears in a .P file 1.234 +## is deleted, the dependency causes make to die (because there is 1.235 +## typically no way to rebuild the header). We avoid this by adding 1.236 +## dummy dependencies for each header file. Too bad gcc doesn't do 1.237 +## this for us directly. 1.238 +## Some versions of gcc put a space before the ':'. On the theory 1.239 +## that the space means something, we add a space to the output as 1.240 +## well. hp depmode also adds that space, but also prefixes the VPATH 1.241 +## to the object. Take care to not repeat it in the output. 1.242 +## Some versions of the HPUX 10.20 sed can't process this invocation 1.243 +## correctly. Breaking it into two sed invocations is a workaround. 1.244 + tr ' ' "$nl" < "$tmpdepfile" \ 1.245 + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ 1.246 + | sed -e 's/$/ :/' >> "$depfile" 1.247 + rm -f "$tmpdepfile" 1.248 + ;; 1.249 + 1.250 +hp) 1.251 + # This case exists only to let depend.m4 do its work. It works by 1.252 + # looking at the text of this script. This case will never be run, 1.253 + # since it is checked for above. 1.254 + exit 1 1.255 + ;; 1.256 + 1.257 +sgi) 1.258 + if test "$libtool" = yes; then 1.259 + "$@" "-Wp,-MDupdate,$tmpdepfile" 1.260 + else 1.261 + "$@" -MDupdate "$tmpdepfile" 1.262 + fi 1.263 + stat=$? 1.264 + if test $stat -ne 0; then 1.265 + rm -f "$tmpdepfile" 1.266 + exit $stat 1.267 + fi 1.268 + rm -f "$depfile" 1.269 + 1.270 + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1.271 + echo "$object : \\" > "$depfile" 1.272 + # Clip off the initial element (the dependent). Don't try to be 1.273 + # clever and replace this with sed code, as IRIX sed won't handle 1.274 + # lines with more than a fixed number of characters (4096 in 1.275 + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1.276 + # the IRIX cc adds comments like '#:fec' to the end of the 1.277 + # dependency line. 1.278 + tr ' ' "$nl" < "$tmpdepfile" \ 1.279 + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ 1.280 + | tr "$nl" ' ' >> "$depfile" 1.281 + echo >> "$depfile" 1.282 + # The second pass generates a dummy entry for each header file. 1.283 + tr ' ' "$nl" < "$tmpdepfile" \ 1.284 + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 1.285 + >> "$depfile" 1.286 + else 1.287 + make_dummy_depfile 1.288 + fi 1.289 + rm -f "$tmpdepfile" 1.290 + ;; 1.291 + 1.292 +xlc) 1.293 + # This case exists only to let depend.m4 do its work. It works by 1.294 + # looking at the text of this script. This case will never be run, 1.295 + # since it is checked for above. 1.296 + exit 1 1.297 + ;; 1.298 + 1.299 +aix) 1.300 + # The C for AIX Compiler uses -M and outputs the dependencies 1.301 + # in a .u file. In older versions, this file always lives in the 1.302 + # current directory. Also, the AIX compiler puts '$object:' at the 1.303 + # start of each line; $object doesn't have directory information. 1.304 + # Version 6 uses the directory in both cases. 1.305 + set_dir_from "$object" 1.306 + set_base_from "$object" 1.307 + if test "$libtool" = yes; then 1.308 + tmpdepfile1=$dir$base.u 1.309 + tmpdepfile2=$base.u 1.310 + tmpdepfile3=$dir.libs/$base.u 1.311 + "$@" -Wc,-M 1.312 + else 1.313 + tmpdepfile1=$dir$base.u 1.314 + tmpdepfile2=$dir$base.u 1.315 + tmpdepfile3=$dir$base.u 1.316 + "$@" -M 1.317 + fi 1.318 + stat=$? 1.319 + if test $stat -ne 0; then 1.320 + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 1.321 + exit $stat 1.322 + fi 1.323 + 1.324 + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 1.325 + do 1.326 + test -f "$tmpdepfile" && break 1.327 + done 1.328 + aix_post_process_depfile 1.329 + ;; 1.330 + 1.331 +tcc) 1.332 + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 1.333 + # FIXME: That version still under development at the moment of writing. 1.334 + # Make that this statement remains true also for stable, released 1.335 + # versions. 1.336 + # It will wrap lines (doesn't matter whether long or short) with a 1.337 + # trailing '\', as in: 1.338 + # 1.339 + # foo.o : \ 1.340 + # foo.c \ 1.341 + # foo.h \ 1.342 + # 1.343 + # It will put a trailing '\' even on the last line, and will use leading 1.344 + # spaces rather than leading tabs (at least since its commit 0394caf7 1.345 + # "Emit spaces for -MD"). 1.346 + "$@" -MD -MF "$tmpdepfile" 1.347 + stat=$? 1.348 + if test $stat -ne 0; then 1.349 + rm -f "$tmpdepfile" 1.350 + exit $stat 1.351 + fi 1.352 + rm -f "$depfile" 1.353 + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. 1.354 + # We have to change lines of the first kind to '$object: \'. 1.355 + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" 1.356 + # And for each line of the second kind, we have to emit a 'dep.h:' 1.357 + # dummy dependency, to avoid the deleted-header problem. 1.358 + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" 1.359 + rm -f "$tmpdepfile" 1.360 + ;; 1.361 + 1.362 +## The order of this option in the case statement is important, since the 1.363 +## shell code in configure will try each of these formats in the order 1.364 +## listed in this file. A plain '-MD' option would be understood by many 1.365 +## compilers, so we must ensure this comes after the gcc and icc options. 1.366 +pgcc) 1.367 + # Portland's C compiler understands '-MD'. 1.368 + # Will always output deps to 'file.d' where file is the root name of the 1.369 + # source file under compilation, even if file resides in a subdirectory. 1.370 + # The object file name does not affect the name of the '.d' file. 1.371 + # pgcc 10.2 will output 1.372 + # foo.o: sub/foo.c sub/foo.h 1.373 + # and will wrap long lines using '\' : 1.374 + # foo.o: sub/foo.c ... \ 1.375 + # sub/foo.h ... \ 1.376 + # ... 1.377 + set_dir_from "$object" 1.378 + # Use the source, not the object, to determine the base name, since 1.379 + # that's sadly what pgcc will do too. 1.380 + set_base_from "$source" 1.381 + tmpdepfile=$base.d 1.382 + 1.383 + # For projects that build the same source file twice into different object 1.384 + # files, the pgcc approach of using the *source* file root name can cause 1.385 + # problems in parallel builds. Use a locking strategy to avoid stomping on 1.386 + # the same $tmpdepfile. 1.387 + lockdir=$base.d-lock 1.388 + trap " 1.389 + echo '$0: caught signal, cleaning up...' >&2 1.390 + rmdir '$lockdir' 1.391 + exit 1 1.392 + " 1 2 13 15 1.393 + numtries=100 1.394 + i=$numtries 1.395 + while test $i -gt 0; do 1.396 + # mkdir is a portable test-and-set. 1.397 + if mkdir "$lockdir" 2>/dev/null; then 1.398 + # This process acquired the lock. 1.399 + "$@" -MD 1.400 + stat=$? 1.401 + # Release the lock. 1.402 + rmdir "$lockdir" 1.403 + break 1.404 + else 1.405 + # If the lock is being held by a different process, wait 1.406 + # until the winning process is done or we timeout. 1.407 + while test -d "$lockdir" && test $i -gt 0; do 1.408 + sleep 1 1.409 + i=`expr $i - 1` 1.410 + done 1.411 + fi 1.412 + i=`expr $i - 1` 1.413 + done 1.414 + trap - 1 2 13 15 1.415 + if test $i -le 0; then 1.416 + echo "$0: failed to acquire lock after $numtries attempts" >&2 1.417 + echo "$0: check lockdir '$lockdir'" >&2 1.418 + exit 1 1.419 + fi 1.420 + 1.421 + if test $stat -ne 0; then 1.422 + rm -f "$tmpdepfile" 1.423 + exit $stat 1.424 + fi 1.425 + rm -f "$depfile" 1.426 + # Each line is of the form `foo.o: dependent.h', 1.427 + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 1.428 + # Do two passes, one to just change these to 1.429 + # `$object: dependent.h' and one to simply `dependent.h:'. 1.430 + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 1.431 + # Some versions of the HPUX 10.20 sed can't process this invocation 1.432 + # correctly. Breaking it into two sed invocations is a workaround. 1.433 + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ 1.434 + | sed -e 's/$/ :/' >> "$depfile" 1.435 + rm -f "$tmpdepfile" 1.436 + ;; 1.437 + 1.438 +hp2) 1.439 + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 1.440 + # compilers, which have integrated preprocessors. The correct option 1.441 + # to use with these is +Maked; it writes dependencies to a file named 1.442 + # 'foo.d', which lands next to the object file, wherever that 1.443 + # happens to be. 1.444 + # Much of this is similar to the tru64 case; see comments there. 1.445 + set_dir_from "$object" 1.446 + set_base_from "$object" 1.447 + if test "$libtool" = yes; then 1.448 + tmpdepfile1=$dir$base.d 1.449 + tmpdepfile2=$dir.libs/$base.d 1.450 + "$@" -Wc,+Maked 1.451 + else 1.452 + tmpdepfile1=$dir$base.d 1.453 + tmpdepfile2=$dir$base.d 1.454 + "$@" +Maked 1.455 + fi 1.456 + stat=$? 1.457 + if test $stat -ne 0; then 1.458 + rm -f "$tmpdepfile1" "$tmpdepfile2" 1.459 + exit $stat 1.460 + fi 1.461 + 1.462 + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 1.463 + do 1.464 + test -f "$tmpdepfile" && break 1.465 + done 1.466 + if test -f "$tmpdepfile"; then 1.467 + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" 1.468 + # Add 'dependent.h:' lines. 1.469 + sed -ne '2,${ 1.470 + s/^ *// 1.471 + s/ \\*$// 1.472 + s/$/:/ 1.473 + p 1.474 + }' "$tmpdepfile" >> "$depfile" 1.475 + else 1.476 + make_dummy_depfile 1.477 + fi 1.478 + rm -f "$tmpdepfile" "$tmpdepfile2" 1.479 + ;; 1.480 + 1.481 +tru64) 1.482 + # The Tru64 compiler uses -MD to generate dependencies as a side 1.483 + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. 1.484 + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 1.485 + # dependencies in 'foo.d' instead, so we check for that too. 1.486 + # Subdirectories are respected. 1.487 + set_dir_from "$object" 1.488 + set_base_from "$object" 1.489 + 1.490 + if test "$libtool" = yes; then 1.491 + # Libtool generates 2 separate objects for the 2 libraries. These 1.492 + # two compilations output dependencies in $dir.libs/$base.o.d and 1.493 + # in $dir$base.o.d. We have to check for both files, because 1.494 + # one of the two compilations can be disabled. We should prefer 1.495 + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 1.496 + # automatically cleaned when .libs/ is deleted, while ignoring 1.497 + # the former would cause a distcleancheck panic. 1.498 + tmpdepfile1=$dir$base.o.d # libtool 1.5 1.499 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. 1.500 + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 1.501 + "$@" -Wc,-MD 1.502 + else 1.503 + tmpdepfile1=$dir$base.d 1.504 + tmpdepfile2=$dir$base.d 1.505 + tmpdepfile3=$dir$base.d 1.506 + "$@" -MD 1.507 + fi 1.508 + 1.509 + stat=$? 1.510 + if test $stat -ne 0; then 1.511 + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 1.512 + exit $stat 1.513 + fi 1.514 + 1.515 + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 1.516 + do 1.517 + test -f "$tmpdepfile" && break 1.518 + done 1.519 + # Same post-processing that is required for AIX mode. 1.520 + aix_post_process_depfile 1.521 + ;; 1.522 + 1.523 +msvc7) 1.524 + if test "$libtool" = yes; then 1.525 + showIncludes=-Wc,-showIncludes 1.526 + else 1.527 + showIncludes=-showIncludes 1.528 + fi 1.529 + "$@" $showIncludes > "$tmpdepfile" 1.530 + stat=$? 1.531 + grep -v '^Note: including file: ' "$tmpdepfile" 1.532 + if test $stat -ne 0; then 1.533 + rm -f "$tmpdepfile" 1.534 + exit $stat 1.535 + fi 1.536 + rm -f "$depfile" 1.537 + echo "$object : \\" > "$depfile" 1.538 + # The first sed program below extracts the file names and escapes 1.539 + # backslashes for cygpath. The second sed program outputs the file 1.540 + # name when reading, but also accumulates all include files in the 1.541 + # hold buffer in order to output them again at the end. This only 1.542 + # works with sed implementations that can handle large buffers. 1.543 + sed < "$tmpdepfile" -n ' 1.544 +/^Note: including file: *\(.*\)/ { 1.545 + s//\1/ 1.546 + s/\\/\\\\/g 1.547 + p 1.548 +}' | $cygpath_u | sort -u | sed -n ' 1.549 +s/ /\\ /g 1.550 +s/\(.*\)/'"$tab"'\1 \\/p 1.551 +s/.\(.*\) \\/\1:/ 1.552 +H 1.553 +$ { 1.554 + s/.*/'"$tab"'/ 1.555 + G 1.556 + p 1.557 +}' >> "$depfile" 1.558 + echo >> "$depfile" # make sure the fragment doesn't end with a backslash 1.559 + rm -f "$tmpdepfile" 1.560 + ;; 1.561 + 1.562 +msvc7msys) 1.563 + # This case exists only to let depend.m4 do its work. It works by 1.564 + # looking at the text of this script. This case will never be run, 1.565 + # since it is checked for above. 1.566 + exit 1 1.567 + ;; 1.568 + 1.569 +#nosideeffect) 1.570 + # This comment above is used by automake to tell side-effect 1.571 + # dependency tracking mechanisms from slower ones. 1.572 + 1.573 +dashmstdout) 1.574 + # Important note: in order to support this mode, a compiler *must* 1.575 + # always write the preprocessed file to stdout, regardless of -o. 1.576 + "$@" || exit $? 1.577 + 1.578 + # Remove the call to Libtool. 1.579 + if test "$libtool" = yes; then 1.580 + while test "X$1" != 'X--mode=compile'; do 1.581 + shift 1.582 + done 1.583 + shift 1.584 + fi 1.585 + 1.586 + # Remove '-o $object'. 1.587 + IFS=" " 1.588 + for arg 1.589 + do 1.590 + case $arg in 1.591 + -o) 1.592 + shift 1.593 + ;; 1.594 + $object) 1.595 + shift 1.596 + ;; 1.597 + *) 1.598 + set fnord "$@" "$arg" 1.599 + shift # fnord 1.600 + shift # $arg 1.601 + ;; 1.602 + esac 1.603 + done 1.604 + 1.605 + test -z "$dashmflag" && dashmflag=-M 1.606 + # Require at least two characters before searching for ':' 1.607 + # in the target name. This is to cope with DOS-style filenames: 1.608 + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. 1.609 + "$@" $dashmflag | 1.610 + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" 1.611 + rm -f "$depfile" 1.612 + cat < "$tmpdepfile" > "$depfile" 1.613 + # Some versions of the HPUX 10.20 sed can't process this sed invocation 1.614 + # correctly. Breaking it into two sed invocations is a workaround. 1.615 + tr ' ' "$nl" < "$tmpdepfile" \ 1.616 + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 1.617 + | sed -e 's/$/ :/' >> "$depfile" 1.618 + rm -f "$tmpdepfile" 1.619 + ;; 1.620 + 1.621 +dashXmstdout) 1.622 + # This case only exists to satisfy depend.m4. It is never actually 1.623 + # run, as this mode is specially recognized in the preamble. 1.624 + exit 1 1.625 + ;; 1.626 + 1.627 +makedepend) 1.628 + "$@" || exit $? 1.629 + # Remove any Libtool call 1.630 + if test "$libtool" = yes; then 1.631 + while test "X$1" != 'X--mode=compile'; do 1.632 + shift 1.633 + done 1.634 + shift 1.635 + fi 1.636 + # X makedepend 1.637 + shift 1.638 + cleared=no eat=no 1.639 + for arg 1.640 + do 1.641 + case $cleared in 1.642 + no) 1.643 + set ""; shift 1.644 + cleared=yes ;; 1.645 + esac 1.646 + if test $eat = yes; then 1.647 + eat=no 1.648 + continue 1.649 + fi 1.650 + case "$arg" in 1.651 + -D*|-I*) 1.652 + set fnord "$@" "$arg"; shift ;; 1.653 + # Strip any option that makedepend may not understand. Remove 1.654 + # the object too, otherwise makedepend will parse it as a source file. 1.655 + -arch) 1.656 + eat=yes ;; 1.657 + -*|$object) 1.658 + ;; 1.659 + *) 1.660 + set fnord "$@" "$arg"; shift ;; 1.661 + esac 1.662 + done 1.663 + obj_suffix=`echo "$object" | sed 's/^.*\././'` 1.664 + touch "$tmpdepfile" 1.665 + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 1.666 + rm -f "$depfile" 1.667 + # makedepend may prepend the VPATH from the source file name to the object. 1.668 + # No need to regex-escape $object, excess matching of '.' is harmless. 1.669 + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" 1.670 + # Some versions of the HPUX 10.20 sed can't process the last invocation 1.671 + # correctly. Breaking it into two sed invocations is a workaround. 1.672 + sed '1,2d' "$tmpdepfile" \ 1.673 + | tr ' ' "$nl" \ 1.674 + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 1.675 + | sed -e 's/$/ :/' >> "$depfile" 1.676 + rm -f "$tmpdepfile" "$tmpdepfile".bak 1.677 + ;; 1.678 + 1.679 +cpp) 1.680 + # Important note: in order to support this mode, a compiler *must* 1.681 + # always write the preprocessed file to stdout. 1.682 + "$@" || exit $? 1.683 + 1.684 + # Remove the call to Libtool. 1.685 + if test "$libtool" = yes; then 1.686 + while test "X$1" != 'X--mode=compile'; do 1.687 + shift 1.688 + done 1.689 + shift 1.690 + fi 1.691 + 1.692 + # Remove '-o $object'. 1.693 + IFS=" " 1.694 + for arg 1.695 + do 1.696 + case $arg in 1.697 + -o) 1.698 + shift 1.699 + ;; 1.700 + $object) 1.701 + shift 1.702 + ;; 1.703 + *) 1.704 + set fnord "$@" "$arg" 1.705 + shift # fnord 1.706 + shift # $arg 1.707 + ;; 1.708 + esac 1.709 + done 1.710 + 1.711 + "$@" -E \ 1.712 + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 1.713 + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 1.714 + | sed '$ s: \\$::' > "$tmpdepfile" 1.715 + rm -f "$depfile" 1.716 + echo "$object : \\" > "$depfile" 1.717 + cat < "$tmpdepfile" >> "$depfile" 1.718 + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 1.719 + rm -f "$tmpdepfile" 1.720 + ;; 1.721 + 1.722 +msvisualcpp) 1.723 + # Important note: in order to support this mode, a compiler *must* 1.724 + # always write the preprocessed file to stdout. 1.725 + "$@" || exit $? 1.726 + 1.727 + # Remove the call to Libtool. 1.728 + if test "$libtool" = yes; then 1.729 + while test "X$1" != 'X--mode=compile'; do 1.730 + shift 1.731 + done 1.732 + shift 1.733 + fi 1.734 + 1.735 + IFS=" " 1.736 + for arg 1.737 + do 1.738 + case "$arg" in 1.739 + -o) 1.740 + shift 1.741 + ;; 1.742 + $object) 1.743 + shift 1.744 + ;; 1.745 + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 1.746 + set fnord "$@" 1.747 + shift 1.748 + shift 1.749 + ;; 1.750 + *) 1.751 + set fnord "$@" "$arg" 1.752 + shift 1.753 + shift 1.754 + ;; 1.755 + esac 1.756 + done 1.757 + "$@" -E 2>/dev/null | 1.758 + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 1.759 + rm -f "$depfile" 1.760 + echo "$object : \\" > "$depfile" 1.761 + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" 1.762 + echo "$tab" >> "$depfile" 1.763 + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 1.764 + rm -f "$tmpdepfile" 1.765 + ;; 1.766 + 1.767 +msvcmsys) 1.768 + # This case exists only to let depend.m4 do its work. It works by 1.769 + # looking at the text of this script. This case will never be run, 1.770 + # since it is checked for above. 1.771 + exit 1 1.772 + ;; 1.773 + 1.774 +none) 1.775 + exec "$@" 1.776 + ;; 1.777 + 1.778 +*) 1.779 + echo "Unknown depmode $depmode" 1>&2 1.780 + exit 1 1.781 + ;; 1.782 +esac 1.783 + 1.784 +exit 0 1.785 + 1.786 +# Local Variables: 1.787 +# mode: shell-script 1.788 +# sh-indentation: 2 1.789 +# eval: (add-hook 'write-file-hooks 'time-stamp) 1.790 +# time-stamp-start: "scriptversion=" 1.791 +# time-stamp-format: "%:y-%02m-%02d.%02H" 1.792 +# time-stamp-time-zone: "UTC" 1.793 +# time-stamp-end: "; # UTC" 1.794 +# End: