depcomp revision 7366012a
17a0395d0Smrg#! /bin/sh 27a0395d0Smrg# depcomp - compile a program generating dependencies as side-effects 37a0395d0Smrg 47366012aSmrgscriptversion=2009-04-28.21; # UTC 57a0395d0Smrg 67366012aSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 77366012aSmrg# Software Foundation, Inc. 87a0395d0Smrg 97a0395d0Smrg# This program is free software; you can redistribute it and/or modify 107a0395d0Smrg# it under the terms of the GNU General Public License as published by 117a0395d0Smrg# the Free Software Foundation; either version 2, or (at your option) 127a0395d0Smrg# any later version. 137a0395d0Smrg 147a0395d0Smrg# This program is distributed in the hope that it will be useful, 157a0395d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 167a0395d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 177a0395d0Smrg# GNU General Public License for more details. 187a0395d0Smrg 197a0395d0Smrg# You should have received a copy of the GNU General Public License 207366012aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 217a0395d0Smrg 227a0395d0Smrg# As a special exception to the GNU General Public License, if you 237a0395d0Smrg# distribute this file as part of a program that contains a 247a0395d0Smrg# configuration script generated by Autoconf, you may include it under 257a0395d0Smrg# the same distribution terms that you use for the rest of that program. 267a0395d0Smrg 277a0395d0Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 287a0395d0Smrg 297a0395d0Smrgcase $1 in 307a0395d0Smrg '') 317a0395d0Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 327a0395d0Smrg exit 1; 337a0395d0Smrg ;; 347a0395d0Smrg -h | --h*) 357a0395d0Smrg cat <<\EOF 367a0395d0SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 377a0395d0Smrg 387a0395d0SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 397a0395d0Smrgas side-effects. 407a0395d0Smrg 417a0395d0SmrgEnvironment variables: 427a0395d0Smrg depmode Dependency tracking mode. 437a0395d0Smrg source Source file read by `PROGRAMS ARGS'. 447a0395d0Smrg object Object file output by `PROGRAMS ARGS'. 457a0395d0Smrg DEPDIR directory where to store dependencies. 467a0395d0Smrg depfile Dependency file to output. 477a0395d0Smrg tmpdepfile Temporary file to use when outputing dependencies. 487a0395d0Smrg libtool Whether libtool is used (yes/no). 497a0395d0Smrg 507a0395d0SmrgReport bugs to <bug-automake@gnu.org>. 517a0395d0SmrgEOF 527a0395d0Smrg exit $? 537a0395d0Smrg ;; 547a0395d0Smrg -v | --v*) 557a0395d0Smrg echo "depcomp $scriptversion" 567a0395d0Smrg exit $? 577a0395d0Smrg ;; 587a0395d0Smrgesac 597a0395d0Smrg 607a0395d0Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 617a0395d0Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 627a0395d0Smrg exit 1 637a0395d0Smrgfi 647a0395d0Smrg 657a0395d0Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 667a0395d0Smrgdepfile=${depfile-`echo "$object" | 677a0395d0Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 687a0395d0Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 697a0395d0Smrg 707a0395d0Smrgrm -f "$tmpdepfile" 717a0395d0Smrg 727a0395d0Smrg# Some modes work just like other modes, but use different flags. We 737a0395d0Smrg# parameterize here, but still list the modes in the big case below, 747a0395d0Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 757a0395d0Smrg# here, because this file can only contain one case statement. 767a0395d0Smrgif test "$depmode" = hp; then 777a0395d0Smrg # HP compiler uses -M and no extra arg. 787a0395d0Smrg gccflag=-M 797a0395d0Smrg depmode=gcc 807a0395d0Smrgfi 817a0395d0Smrg 827a0395d0Smrgif test "$depmode" = dashXmstdout; then 837a0395d0Smrg # This is just like dashmstdout with a different argument. 847a0395d0Smrg dashmflag=-xM 857a0395d0Smrg depmode=dashmstdout 867a0395d0Smrgfi 877a0395d0Smrg 887366012aSmrgcygpath_u="cygpath -u -f -" 897366012aSmrgif test "$depmode" = msvcmsys; then 907366012aSmrg # This is just like msvisualcpp but w/o cygpath translation. 917366012aSmrg # Just convert the backslash-escaped backslashes to single forward 927366012aSmrg # slashes to satisfy depend.m4 937366012aSmrg cygpath_u="sed s,\\\\\\\\,/,g" 947366012aSmrg depmode=msvisualcpp 957366012aSmrgfi 967366012aSmrg 977a0395d0Smrgcase "$depmode" in 987a0395d0Smrggcc3) 997a0395d0Smrg## gcc 3 implements dependency tracking that does exactly what 1007a0395d0Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 1017a0395d0Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 1027a0395d0Smrg## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1037a0395d0Smrg## the command line argument order; so add the flags where they 1047a0395d0Smrg## appear in depend2.am. Note that the slowdown incurred here 1057a0395d0Smrg## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1067a0395d0Smrg for arg 1077a0395d0Smrg do 1087a0395d0Smrg case $arg in 1097a0395d0Smrg -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1107a0395d0Smrg *) set fnord "$@" "$arg" ;; 1117a0395d0Smrg esac 1127a0395d0Smrg shift # fnord 1137a0395d0Smrg shift # $arg 1147a0395d0Smrg done 1157a0395d0Smrg "$@" 1167a0395d0Smrg stat=$? 1177a0395d0Smrg if test $stat -eq 0; then : 1187a0395d0Smrg else 1197a0395d0Smrg rm -f "$tmpdepfile" 1207a0395d0Smrg exit $stat 1217a0395d0Smrg fi 1227a0395d0Smrg mv "$tmpdepfile" "$depfile" 1237a0395d0Smrg ;; 1247a0395d0Smrg 1257a0395d0Smrggcc) 1267a0395d0Smrg## There are various ways to get dependency output from gcc. Here's 1277a0395d0Smrg## why we pick this rather obscure method: 1287a0395d0Smrg## - Don't want to use -MD because we'd like the dependencies to end 1297a0395d0Smrg## up in a subdir. Having to rename by hand is ugly. 1307a0395d0Smrg## (We might end up doing this anyway to support other compilers.) 1317a0395d0Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 1327a0395d0Smrg## -MM, not -M (despite what the docs say). 1337a0395d0Smrg## - Using -M directly means running the compiler twice (even worse 1347a0395d0Smrg## than renaming). 1357a0395d0Smrg if test -z "$gccflag"; then 1367a0395d0Smrg gccflag=-MD, 1377a0395d0Smrg fi 1387a0395d0Smrg "$@" -Wp,"$gccflag$tmpdepfile" 1397a0395d0Smrg stat=$? 1407a0395d0Smrg if test $stat -eq 0; then : 1417a0395d0Smrg else 1427a0395d0Smrg rm -f "$tmpdepfile" 1437a0395d0Smrg exit $stat 1447a0395d0Smrg fi 1457a0395d0Smrg rm -f "$depfile" 1467a0395d0Smrg echo "$object : \\" > "$depfile" 1477a0395d0Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1487a0395d0Smrg## The second -e expression handles DOS-style file names with drive letters. 1497a0395d0Smrg sed -e 's/^[^:]*: / /' \ 1507a0395d0Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1517a0395d0Smrg## This next piece of magic avoids the `deleted header file' problem. 1527a0395d0Smrg## The problem is that when a header file which appears in a .P file 1537a0395d0Smrg## is deleted, the dependency causes make to die (because there is 1547a0395d0Smrg## typically no way to rebuild the header). We avoid this by adding 1557a0395d0Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 1567a0395d0Smrg## this for us directly. 1577a0395d0Smrg tr ' ' ' 1587a0395d0Smrg' < "$tmpdepfile" | 1597a0395d0Smrg## Some versions of gcc put a space before the `:'. On the theory 1607a0395d0Smrg## that the space means something, we add a space to the output as 1617a0395d0Smrg## well. 1627a0395d0Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 1637a0395d0Smrg## correctly. Breaking it into two sed invocations is a workaround. 1647a0395d0Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 1657a0395d0Smrg rm -f "$tmpdepfile" 1667a0395d0Smrg ;; 1677a0395d0Smrg 1687a0395d0Smrghp) 1697a0395d0Smrg # This case exists only to let depend.m4 do its work. It works by 1707a0395d0Smrg # looking at the text of this script. This case will never be run, 1717a0395d0Smrg # since it is checked for above. 1727a0395d0Smrg exit 1 1737a0395d0Smrg ;; 1747a0395d0Smrg 1757a0395d0Smrgsgi) 1767a0395d0Smrg if test "$libtool" = yes; then 1777a0395d0Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 1787a0395d0Smrg else 1797a0395d0Smrg "$@" -MDupdate "$tmpdepfile" 1807a0395d0Smrg fi 1817a0395d0Smrg stat=$? 1827a0395d0Smrg if test $stat -eq 0; then : 1837a0395d0Smrg else 1847a0395d0Smrg rm -f "$tmpdepfile" 1857a0395d0Smrg exit $stat 1867a0395d0Smrg fi 1877a0395d0Smrg rm -f "$depfile" 1887a0395d0Smrg 1897a0395d0Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1907a0395d0Smrg echo "$object : \\" > "$depfile" 1917a0395d0Smrg 1927a0395d0Smrg # Clip off the initial element (the dependent). Don't try to be 1937a0395d0Smrg # clever and replace this with sed code, as IRIX sed won't handle 1947a0395d0Smrg # lines with more than a fixed number of characters (4096 in 1957a0395d0Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1967a0395d0Smrg # the IRIX cc adds comments like `#:fec' to the end of the 1977a0395d0Smrg # dependency line. 1987a0395d0Smrg tr ' ' ' 1997a0395d0Smrg' < "$tmpdepfile" \ 2007a0395d0Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 2017a0395d0Smrg tr ' 2027366012aSmrg' ' ' >> "$depfile" 2037366012aSmrg echo >> "$depfile" 2047a0395d0Smrg 2057a0395d0Smrg # The second pass generates a dummy entry for each header file. 2067a0395d0Smrg tr ' ' ' 2077a0395d0Smrg' < "$tmpdepfile" \ 2087a0395d0Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2097366012aSmrg >> "$depfile" 2107a0395d0Smrg else 2117a0395d0Smrg # The sourcefile does not contain any dependencies, so just 2127a0395d0Smrg # store a dummy comment line, to avoid errors with the Makefile 2137a0395d0Smrg # "include basename.Plo" scheme. 2147a0395d0Smrg echo "#dummy" > "$depfile" 2157a0395d0Smrg fi 2167a0395d0Smrg rm -f "$tmpdepfile" 2177a0395d0Smrg ;; 2187a0395d0Smrg 2197a0395d0Smrgaix) 2207a0395d0Smrg # The C for AIX Compiler uses -M and outputs the dependencies 2217a0395d0Smrg # in a .u file. In older versions, this file always lives in the 2227a0395d0Smrg # current directory. Also, the AIX compiler puts `$object:' at the 2237a0395d0Smrg # start of each line; $object doesn't have directory information. 2247a0395d0Smrg # Version 6 uses the directory in both cases. 2257a0395d0Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2267a0395d0Smrg test "x$dir" = "x$object" && dir= 2277a0395d0Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 2287a0395d0Smrg if test "$libtool" = yes; then 2297a0395d0Smrg tmpdepfile1=$dir$base.u 2307a0395d0Smrg tmpdepfile2=$base.u 2317a0395d0Smrg tmpdepfile3=$dir.libs/$base.u 2327a0395d0Smrg "$@" -Wc,-M 2337a0395d0Smrg else 2347a0395d0Smrg tmpdepfile1=$dir$base.u 2357a0395d0Smrg tmpdepfile2=$dir$base.u 2367a0395d0Smrg tmpdepfile3=$dir$base.u 2377a0395d0Smrg "$@" -M 2387a0395d0Smrg fi 2397a0395d0Smrg stat=$? 2407a0395d0Smrg 2417a0395d0Smrg if test $stat -eq 0; then : 2427a0395d0Smrg else 2437a0395d0Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2447a0395d0Smrg exit $stat 2457a0395d0Smrg fi 2467a0395d0Smrg 2477a0395d0Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 2487a0395d0Smrg do 2497a0395d0Smrg test -f "$tmpdepfile" && break 2507a0395d0Smrg done 2517a0395d0Smrg if test -f "$tmpdepfile"; then 2527a0395d0Smrg # Each line is of the form `foo.o: dependent.h'. 2537a0395d0Smrg # Do two passes, one to just change these to 2547a0395d0Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 2557a0395d0Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 2567a0395d0Smrg # That's a tab and a space in the []. 2577a0395d0Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 2587a0395d0Smrg else 2597a0395d0Smrg # The sourcefile does not contain any dependencies, so just 2607a0395d0Smrg # store a dummy comment line, to avoid errors with the Makefile 2617a0395d0Smrg # "include basename.Plo" scheme. 2627a0395d0Smrg echo "#dummy" > "$depfile" 2637a0395d0Smrg fi 2647a0395d0Smrg rm -f "$tmpdepfile" 2657a0395d0Smrg ;; 2667a0395d0Smrg 2677a0395d0Smrgicc) 2687a0395d0Smrg # Intel's C compiler understands `-MD -MF file'. However on 2697a0395d0Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 2707a0395d0Smrg # ICC 7.0 will fill foo.d with something like 2717a0395d0Smrg # foo.o: sub/foo.c 2727a0395d0Smrg # foo.o: sub/foo.h 2737a0395d0Smrg # which is wrong. We want: 2747a0395d0Smrg # sub/foo.o: sub/foo.c 2757a0395d0Smrg # sub/foo.o: sub/foo.h 2767a0395d0Smrg # sub/foo.c: 2777a0395d0Smrg # sub/foo.h: 2787a0395d0Smrg # ICC 7.1 will output 2797a0395d0Smrg # foo.o: sub/foo.c sub/foo.h 2807a0395d0Smrg # and will wrap long lines using \ : 2817a0395d0Smrg # foo.o: sub/foo.c ... \ 2827a0395d0Smrg # sub/foo.h ... \ 2837a0395d0Smrg # ... 2847a0395d0Smrg 2857a0395d0Smrg "$@" -MD -MF "$tmpdepfile" 2867a0395d0Smrg stat=$? 2877a0395d0Smrg if test $stat -eq 0; then : 2887a0395d0Smrg else 2897a0395d0Smrg rm -f "$tmpdepfile" 2907a0395d0Smrg exit $stat 2917a0395d0Smrg fi 2927a0395d0Smrg rm -f "$depfile" 2937a0395d0Smrg # Each line is of the form `foo.o: dependent.h', 2947a0395d0Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 2957a0395d0Smrg # Do two passes, one to just change these to 2967a0395d0Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 2977a0395d0Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 2987a0395d0Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 2997a0395d0Smrg # correctly. Breaking it into two sed invocations is a workaround. 3007a0395d0Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 3017a0395d0Smrg sed -e 's/$/ :/' >> "$depfile" 3027a0395d0Smrg rm -f "$tmpdepfile" 3037a0395d0Smrg ;; 3047a0395d0Smrg 3057a0395d0Smrghp2) 3067a0395d0Smrg # The "hp" stanza above does not work with aCC (C++) and HP's ia64 3077a0395d0Smrg # compilers, which have integrated preprocessors. The correct option 3087a0395d0Smrg # to use with these is +Maked; it writes dependencies to a file named 3097a0395d0Smrg # 'foo.d', which lands next to the object file, wherever that 3107a0395d0Smrg # happens to be. 3117a0395d0Smrg # Much of this is similar to the tru64 case; see comments there. 3127a0395d0Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3137a0395d0Smrg test "x$dir" = "x$object" && dir= 3147a0395d0Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3157a0395d0Smrg if test "$libtool" = yes; then 3167a0395d0Smrg tmpdepfile1=$dir$base.d 3177a0395d0Smrg tmpdepfile2=$dir.libs/$base.d 3187a0395d0Smrg "$@" -Wc,+Maked 3197a0395d0Smrg else 3207a0395d0Smrg tmpdepfile1=$dir$base.d 3217a0395d0Smrg tmpdepfile2=$dir$base.d 3227a0395d0Smrg "$@" +Maked 3237a0395d0Smrg fi 3247a0395d0Smrg stat=$? 3257a0395d0Smrg if test $stat -eq 0; then : 3267a0395d0Smrg else 3277a0395d0Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" 3287a0395d0Smrg exit $stat 3297a0395d0Smrg fi 3307a0395d0Smrg 3317a0395d0Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 3327a0395d0Smrg do 3337a0395d0Smrg test -f "$tmpdepfile" && break 3347a0395d0Smrg done 3357a0395d0Smrg if test -f "$tmpdepfile"; then 3367a0395d0Smrg sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 3377a0395d0Smrg # Add `dependent.h:' lines. 3387366012aSmrg sed -ne '2,${ 3397366012aSmrg s/^ *// 3407366012aSmrg s/ \\*$// 3417366012aSmrg s/$/:/ 3427366012aSmrg p 3437366012aSmrg }' "$tmpdepfile" >> "$depfile" 3447a0395d0Smrg else 3457a0395d0Smrg echo "#dummy" > "$depfile" 3467a0395d0Smrg fi 3477a0395d0Smrg rm -f "$tmpdepfile" "$tmpdepfile2" 3487a0395d0Smrg ;; 3497a0395d0Smrg 3507a0395d0Smrgtru64) 3517a0395d0Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 3527a0395d0Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 3537a0395d0Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 3547a0395d0Smrg # dependencies in `foo.d' instead, so we check for that too. 3557a0395d0Smrg # Subdirectories are respected. 3567a0395d0Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 3577a0395d0Smrg test "x$dir" = "x$object" && dir= 3587a0395d0Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 3597a0395d0Smrg 3607a0395d0Smrg if test "$libtool" = yes; then 3617a0395d0Smrg # With Tru64 cc, shared objects can also be used to make a 3627a0395d0Smrg # static library. This mechanism is used in libtool 1.4 series to 3637a0395d0Smrg # handle both shared and static libraries in a single compilation. 3647a0395d0Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 3657a0395d0Smrg # 3667a0395d0Smrg # With libtool 1.5 this exception was removed, and libtool now 3677a0395d0Smrg # generates 2 separate objects for the 2 libraries. These two 3687a0395d0Smrg # compilations output dependencies in $dir.libs/$base.o.d and 3697a0395d0Smrg # in $dir$base.o.d. We have to check for both files, because 3707a0395d0Smrg # one of the two compilations can be disabled. We should prefer 3717a0395d0Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 3727a0395d0Smrg # automatically cleaned when .libs/ is deleted, while ignoring 3737a0395d0Smrg # the former would cause a distcleancheck panic. 3747a0395d0Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 3757a0395d0Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 3767a0395d0Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 3777a0395d0Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 3787a0395d0Smrg "$@" -Wc,-MD 3797a0395d0Smrg else 3807a0395d0Smrg tmpdepfile1=$dir$base.o.d 3817a0395d0Smrg tmpdepfile2=$dir$base.d 3827a0395d0Smrg tmpdepfile3=$dir$base.d 3837a0395d0Smrg tmpdepfile4=$dir$base.d 3847a0395d0Smrg "$@" -MD 3857a0395d0Smrg fi 3867a0395d0Smrg 3877a0395d0Smrg stat=$? 3887a0395d0Smrg if test $stat -eq 0; then : 3897a0395d0Smrg else 3907a0395d0Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3917a0395d0Smrg exit $stat 3927a0395d0Smrg fi 3937a0395d0Smrg 3947a0395d0Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3957a0395d0Smrg do 3967a0395d0Smrg test -f "$tmpdepfile" && break 3977a0395d0Smrg done 3987a0395d0Smrg if test -f "$tmpdepfile"; then 3997a0395d0Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 4007a0395d0Smrg # That's a tab and a space in the []. 4017a0395d0Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 4027a0395d0Smrg else 4037a0395d0Smrg echo "#dummy" > "$depfile" 4047a0395d0Smrg fi 4057a0395d0Smrg rm -f "$tmpdepfile" 4067a0395d0Smrg ;; 4077a0395d0Smrg 4087a0395d0Smrg#nosideeffect) 4097a0395d0Smrg # This comment above is used by automake to tell side-effect 4107a0395d0Smrg # dependency tracking mechanisms from slower ones. 4117a0395d0Smrg 4127a0395d0Smrgdashmstdout) 4137a0395d0Smrg # Important note: in order to support this mode, a compiler *must* 4147a0395d0Smrg # always write the preprocessed file to stdout, regardless of -o. 4157a0395d0Smrg "$@" || exit $? 4167a0395d0Smrg 4177a0395d0Smrg # Remove the call to Libtool. 4187a0395d0Smrg if test "$libtool" = yes; then 4197366012aSmrg while test "X$1" != 'X--mode=compile'; do 4207a0395d0Smrg shift 4217a0395d0Smrg done 4227a0395d0Smrg shift 4237a0395d0Smrg fi 4247a0395d0Smrg 4257a0395d0Smrg # Remove `-o $object'. 4267a0395d0Smrg IFS=" " 4277a0395d0Smrg for arg 4287a0395d0Smrg do 4297a0395d0Smrg case $arg in 4307a0395d0Smrg -o) 4317a0395d0Smrg shift 4327a0395d0Smrg ;; 4337a0395d0Smrg $object) 4347a0395d0Smrg shift 4357a0395d0Smrg ;; 4367a0395d0Smrg *) 4377a0395d0Smrg set fnord "$@" "$arg" 4387a0395d0Smrg shift # fnord 4397a0395d0Smrg shift # $arg 4407a0395d0Smrg ;; 4417a0395d0Smrg esac 4427a0395d0Smrg done 4437a0395d0Smrg 4447a0395d0Smrg test -z "$dashmflag" && dashmflag=-M 4457a0395d0Smrg # Require at least two characters before searching for `:' 4467a0395d0Smrg # in the target name. This is to cope with DOS-style filenames: 4477a0395d0Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 4487a0395d0Smrg "$@" $dashmflag | 4497a0395d0Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 4507a0395d0Smrg rm -f "$depfile" 4517a0395d0Smrg cat < "$tmpdepfile" > "$depfile" 4527a0395d0Smrg tr ' ' ' 4537a0395d0Smrg' < "$tmpdepfile" | \ 4547a0395d0Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 4557a0395d0Smrg## correctly. Breaking it into two sed invocations is a workaround. 4567a0395d0Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 4577a0395d0Smrg rm -f "$tmpdepfile" 4587a0395d0Smrg ;; 4597a0395d0Smrg 4607a0395d0SmrgdashXmstdout) 4617a0395d0Smrg # This case only exists to satisfy depend.m4. It is never actually 4627a0395d0Smrg # run, as this mode is specially recognized in the preamble. 4637a0395d0Smrg exit 1 4647a0395d0Smrg ;; 4657a0395d0Smrg 4667a0395d0Smrgmakedepend) 4677a0395d0Smrg "$@" || exit $? 4687a0395d0Smrg # Remove any Libtool call 4697a0395d0Smrg if test "$libtool" = yes; then 4707366012aSmrg while test "X$1" != 'X--mode=compile'; do 4717a0395d0Smrg shift 4727a0395d0Smrg done 4737a0395d0Smrg shift 4747a0395d0Smrg fi 4757a0395d0Smrg # X makedepend 4767a0395d0Smrg shift 4777366012aSmrg cleared=no eat=no 4787366012aSmrg for arg 4797366012aSmrg do 4807a0395d0Smrg case $cleared in 4817a0395d0Smrg no) 4827a0395d0Smrg set ""; shift 4837a0395d0Smrg cleared=yes ;; 4847a0395d0Smrg esac 4857366012aSmrg if test $eat = yes; then 4867366012aSmrg eat=no 4877366012aSmrg continue 4887366012aSmrg fi 4897a0395d0Smrg case "$arg" in 4907a0395d0Smrg -D*|-I*) 4917a0395d0Smrg set fnord "$@" "$arg"; shift ;; 4927a0395d0Smrg # Strip any option that makedepend may not understand. Remove 4937a0395d0Smrg # the object too, otherwise makedepend will parse it as a source file. 4947366012aSmrg -arch) 4957366012aSmrg eat=yes ;; 4967a0395d0Smrg -*|$object) 4977a0395d0Smrg ;; 4987a0395d0Smrg *) 4997a0395d0Smrg set fnord "$@" "$arg"; shift ;; 5007a0395d0Smrg esac 5017a0395d0Smrg done 5027366012aSmrg obj_suffix=`echo "$object" | sed 's/^.*\././'` 5037a0395d0Smrg touch "$tmpdepfile" 5047a0395d0Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 5057a0395d0Smrg rm -f "$depfile" 5067a0395d0Smrg cat < "$tmpdepfile" > "$depfile" 5077a0395d0Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 5087a0395d0Smrg' | \ 5097a0395d0Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 5107a0395d0Smrg## correctly. Breaking it into two sed invocations is a workaround. 5117a0395d0Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 5127a0395d0Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 5137a0395d0Smrg ;; 5147a0395d0Smrg 5157a0395d0Smrgcpp) 5167a0395d0Smrg # Important note: in order to support this mode, a compiler *must* 5177a0395d0Smrg # always write the preprocessed file to stdout. 5187a0395d0Smrg "$@" || exit $? 5197a0395d0Smrg 5207a0395d0Smrg # Remove the call to Libtool. 5217a0395d0Smrg if test "$libtool" = yes; then 5227366012aSmrg while test "X$1" != 'X--mode=compile'; do 5237a0395d0Smrg shift 5247a0395d0Smrg done 5257a0395d0Smrg shift 5267a0395d0Smrg fi 5277a0395d0Smrg 5287a0395d0Smrg # Remove `-o $object'. 5297a0395d0Smrg IFS=" " 5307a0395d0Smrg for arg 5317a0395d0Smrg do 5327a0395d0Smrg case $arg in 5337a0395d0Smrg -o) 5347a0395d0Smrg shift 5357a0395d0Smrg ;; 5367a0395d0Smrg $object) 5377a0395d0Smrg shift 5387a0395d0Smrg ;; 5397a0395d0Smrg *) 5407a0395d0Smrg set fnord "$@" "$arg" 5417a0395d0Smrg shift # fnord 5427a0395d0Smrg shift # $arg 5437a0395d0Smrg ;; 5447a0395d0Smrg esac 5457a0395d0Smrg done 5467a0395d0Smrg 5477a0395d0Smrg "$@" -E | 5487a0395d0Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 5497a0395d0Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 5507a0395d0Smrg sed '$ s: \\$::' > "$tmpdepfile" 5517a0395d0Smrg rm -f "$depfile" 5527a0395d0Smrg echo "$object : \\" > "$depfile" 5537a0395d0Smrg cat < "$tmpdepfile" >> "$depfile" 5547a0395d0Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 5557a0395d0Smrg rm -f "$tmpdepfile" 5567a0395d0Smrg ;; 5577a0395d0Smrg 5587a0395d0Smrgmsvisualcpp) 5597a0395d0Smrg # Important note: in order to support this mode, a compiler *must* 5607366012aSmrg # always write the preprocessed file to stdout. 5617a0395d0Smrg "$@" || exit $? 5627366012aSmrg 5637366012aSmrg # Remove the call to Libtool. 5647366012aSmrg if test "$libtool" = yes; then 5657366012aSmrg while test "X$1" != 'X--mode=compile'; do 5667366012aSmrg shift 5677366012aSmrg done 5687366012aSmrg shift 5697366012aSmrg fi 5707366012aSmrg 5717a0395d0Smrg IFS=" " 5727a0395d0Smrg for arg 5737a0395d0Smrg do 5747a0395d0Smrg case "$arg" in 5757366012aSmrg -o) 5767366012aSmrg shift 5777366012aSmrg ;; 5787366012aSmrg $object) 5797366012aSmrg shift 5807366012aSmrg ;; 5817a0395d0Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 5827a0395d0Smrg set fnord "$@" 5837a0395d0Smrg shift 5847a0395d0Smrg shift 5857a0395d0Smrg ;; 5867a0395d0Smrg *) 5877a0395d0Smrg set fnord "$@" "$arg" 5887a0395d0Smrg shift 5897a0395d0Smrg shift 5907a0395d0Smrg ;; 5917a0395d0Smrg esac 5927a0395d0Smrg done 5937366012aSmrg "$@" -E 2>/dev/null | 5947366012aSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 5957a0395d0Smrg rm -f "$depfile" 5967a0395d0Smrg echo "$object : \\" > "$depfile" 5977366012aSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 5987a0395d0Smrg echo " " >> "$depfile" 5997366012aSmrg sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 6007a0395d0Smrg rm -f "$tmpdepfile" 6017a0395d0Smrg ;; 6027a0395d0Smrg 6037366012aSmrgmsvcmsys) 6047366012aSmrg # This case exists only to let depend.m4 do its work. It works by 6057366012aSmrg # looking at the text of this script. This case will never be run, 6067366012aSmrg # since it is checked for above. 6077366012aSmrg exit 1 6087366012aSmrg ;; 6097366012aSmrg 6107a0395d0Smrgnone) 6117a0395d0Smrg exec "$@" 6127a0395d0Smrg ;; 6137a0395d0Smrg 6147a0395d0Smrg*) 6157a0395d0Smrg echo "Unknown depmode $depmode" 1>&2 6167a0395d0Smrg exit 1 6177a0395d0Smrg ;; 6187a0395d0Smrgesac 6197a0395d0Smrg 6207a0395d0Smrgexit 0 6217a0395d0Smrg 6227a0395d0Smrg# Local Variables: 6237a0395d0Smrg# mode: shell-script 6247a0395d0Smrg# sh-indentation: 2 6257a0395d0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 6267a0395d0Smrg# time-stamp-start: "scriptversion=" 6277a0395d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 6287366012aSmrg# time-stamp-time-zone: "UTC" 6297366012aSmrg# time-stamp-end: "; # UTC" 6307a0395d0Smrg# End: 631