depcomp revision 4456fccd
14456fccdSmrg#! /bin/sh 24456fccdSmrg# depcomp - compile a program generating dependencies as side-effects 34456fccdSmrg 44456fccdSmrgscriptversion=2005-07-09.11 54456fccdSmrg 64456fccdSmrg# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 74456fccdSmrg 84456fccdSmrg# This program is free software; you can redistribute it and/or modify 94456fccdSmrg# it under the terms of the GNU General Public License as published by 104456fccdSmrg# the Free Software Foundation; either version 2, or (at your option) 114456fccdSmrg# any later version. 124456fccdSmrg 134456fccdSmrg# This program is distributed in the hope that it will be useful, 144456fccdSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 154456fccdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 164456fccdSmrg# GNU General Public License for more details. 174456fccdSmrg 184456fccdSmrg# You should have received a copy of the GNU General Public License 194456fccdSmrg# along with this program; if not, write to the Free Software 204456fccdSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 214456fccdSmrg# 02110-1301, USA. 224456fccdSmrg 234456fccdSmrg# As a special exception to the GNU General Public License, if you 244456fccdSmrg# distribute this file as part of a program that contains a 254456fccdSmrg# configuration script generated by Autoconf, you may include it under 264456fccdSmrg# the same distribution terms that you use for the rest of that program. 274456fccdSmrg 284456fccdSmrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 294456fccdSmrg 304456fccdSmrgcase $1 in 314456fccdSmrg '') 324456fccdSmrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 334456fccdSmrg exit 1; 344456fccdSmrg ;; 354456fccdSmrg -h | --h*) 364456fccdSmrg cat <<\EOF 374456fccdSmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 384456fccdSmrg 394456fccdSmrgRun PROGRAMS ARGS to compile a file, generating dependencies 404456fccdSmrgas side-effects. 414456fccdSmrg 424456fccdSmrgEnvironment variables: 434456fccdSmrg depmode Dependency tracking mode. 444456fccdSmrg source Source file read by `PROGRAMS ARGS'. 454456fccdSmrg object Object file output by `PROGRAMS ARGS'. 464456fccdSmrg DEPDIR directory where to store dependencies. 474456fccdSmrg depfile Dependency file to output. 484456fccdSmrg tmpdepfile Temporary file to use when outputing dependencies. 494456fccdSmrg libtool Whether libtool is used (yes/no). 504456fccdSmrg 514456fccdSmrgReport bugs to <bug-automake@gnu.org>. 524456fccdSmrgEOF 534456fccdSmrg exit $? 544456fccdSmrg ;; 554456fccdSmrg -v | --v*) 564456fccdSmrg echo "depcomp $scriptversion" 574456fccdSmrg exit $? 584456fccdSmrg ;; 594456fccdSmrgesac 604456fccdSmrg 614456fccdSmrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 624456fccdSmrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 634456fccdSmrg exit 1 644456fccdSmrgfi 654456fccdSmrg 664456fccdSmrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 674456fccdSmrgdepfile=${depfile-`echo "$object" | 684456fccdSmrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 694456fccdSmrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 704456fccdSmrg 714456fccdSmrgrm -f "$tmpdepfile" 724456fccdSmrg 734456fccdSmrg# Some modes work just like other modes, but use different flags. We 744456fccdSmrg# parameterize here, but still list the modes in the big case below, 754456fccdSmrg# to make depend.m4 easier to write. Note that we *cannot* use a case 764456fccdSmrg# here, because this file can only contain one case statement. 774456fccdSmrgif test "$depmode" = hp; then 784456fccdSmrg # HP compiler uses -M and no extra arg. 794456fccdSmrg gccflag=-M 804456fccdSmrg depmode=gcc 814456fccdSmrgfi 824456fccdSmrg 834456fccdSmrgif test "$depmode" = dashXmstdout; then 844456fccdSmrg # This is just like dashmstdout with a different argument. 854456fccdSmrg dashmflag=-xM 864456fccdSmrg depmode=dashmstdout 874456fccdSmrgfi 884456fccdSmrg 894456fccdSmrgcase "$depmode" in 904456fccdSmrggcc3) 914456fccdSmrg## gcc 3 implements dependency tracking that does exactly what 924456fccdSmrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 934456fccdSmrg## it if -MD -MP comes after the -MF stuff. Hmm. 944456fccdSmrg "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 954456fccdSmrg stat=$? 964456fccdSmrg if test $stat -eq 0; then : 974456fccdSmrg else 984456fccdSmrg rm -f "$tmpdepfile" 994456fccdSmrg exit $stat 1004456fccdSmrg fi 1014456fccdSmrg mv "$tmpdepfile" "$depfile" 1024456fccdSmrg ;; 1034456fccdSmrg 1044456fccdSmrggcc) 1054456fccdSmrg## There are various ways to get dependency output from gcc. Here's 1064456fccdSmrg## why we pick this rather obscure method: 1074456fccdSmrg## - Don't want to use -MD because we'd like the dependencies to end 1084456fccdSmrg## up in a subdir. Having to rename by hand is ugly. 1094456fccdSmrg## (We might end up doing this anyway to support other compilers.) 1104456fccdSmrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 1114456fccdSmrg## -MM, not -M (despite what the docs say). 1124456fccdSmrg## - Using -M directly means running the compiler twice (even worse 1134456fccdSmrg## than renaming). 1144456fccdSmrg if test -z "$gccflag"; then 1154456fccdSmrg gccflag=-MD, 1164456fccdSmrg fi 1174456fccdSmrg "$@" -Wp,"$gccflag$tmpdepfile" 1184456fccdSmrg stat=$? 1194456fccdSmrg if test $stat -eq 0; then : 1204456fccdSmrg else 1214456fccdSmrg rm -f "$tmpdepfile" 1224456fccdSmrg exit $stat 1234456fccdSmrg fi 1244456fccdSmrg rm -f "$depfile" 1254456fccdSmrg echo "$object : \\" > "$depfile" 1264456fccdSmrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1274456fccdSmrg## The second -e expression handles DOS-style file names with drive letters. 1284456fccdSmrg sed -e 's/^[^:]*: / /' \ 1294456fccdSmrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 1304456fccdSmrg## This next piece of magic avoids the `deleted header file' problem. 1314456fccdSmrg## The problem is that when a header file which appears in a .P file 1324456fccdSmrg## is deleted, the dependency causes make to die (because there is 1334456fccdSmrg## typically no way to rebuild the header). We avoid this by adding 1344456fccdSmrg## dummy dependencies for each header file. Too bad gcc doesn't do 1354456fccdSmrg## this for us directly. 1364456fccdSmrg tr ' ' ' 1374456fccdSmrg' < "$tmpdepfile" | 1384456fccdSmrg## Some versions of gcc put a space before the `:'. On the theory 1394456fccdSmrg## that the space means something, we add a space to the output as 1404456fccdSmrg## well. 1414456fccdSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 1424456fccdSmrg## correctly. Breaking it into two sed invocations is a workaround. 1434456fccdSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 1444456fccdSmrg rm -f "$tmpdepfile" 1454456fccdSmrg ;; 1464456fccdSmrg 1474456fccdSmrghp) 1484456fccdSmrg # This case exists only to let depend.m4 do its work. It works by 1494456fccdSmrg # looking at the text of this script. This case will never be run, 1504456fccdSmrg # since it is checked for above. 1514456fccdSmrg exit 1 1524456fccdSmrg ;; 1534456fccdSmrg 1544456fccdSmrgsgi) 1554456fccdSmrg if test "$libtool" = yes; then 1564456fccdSmrg "$@" "-Wp,-MDupdate,$tmpdepfile" 1574456fccdSmrg else 1584456fccdSmrg "$@" -MDupdate "$tmpdepfile" 1594456fccdSmrg fi 1604456fccdSmrg stat=$? 1614456fccdSmrg if test $stat -eq 0; then : 1624456fccdSmrg else 1634456fccdSmrg rm -f "$tmpdepfile" 1644456fccdSmrg exit $stat 1654456fccdSmrg fi 1664456fccdSmrg rm -f "$depfile" 1674456fccdSmrg 1684456fccdSmrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 1694456fccdSmrg echo "$object : \\" > "$depfile" 1704456fccdSmrg 1714456fccdSmrg # Clip off the initial element (the dependent). Don't try to be 1724456fccdSmrg # clever and replace this with sed code, as IRIX sed won't handle 1734456fccdSmrg # lines with more than a fixed number of characters (4096 in 1744456fccdSmrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 1754456fccdSmrg # the IRIX cc adds comments like `#:fec' to the end of the 1764456fccdSmrg # dependency line. 1774456fccdSmrg tr ' ' ' 1784456fccdSmrg' < "$tmpdepfile" \ 1794456fccdSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 1804456fccdSmrg tr ' 1814456fccdSmrg' ' ' >> $depfile 1824456fccdSmrg echo >> $depfile 1834456fccdSmrg 1844456fccdSmrg # The second pass generates a dummy entry for each header file. 1854456fccdSmrg tr ' ' ' 1864456fccdSmrg' < "$tmpdepfile" \ 1874456fccdSmrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 1884456fccdSmrg >> $depfile 1894456fccdSmrg else 1904456fccdSmrg # The sourcefile does not contain any dependencies, so just 1914456fccdSmrg # store a dummy comment line, to avoid errors with the Makefile 1924456fccdSmrg # "include basename.Plo" scheme. 1934456fccdSmrg echo "#dummy" > "$depfile" 1944456fccdSmrg fi 1954456fccdSmrg rm -f "$tmpdepfile" 1964456fccdSmrg ;; 1974456fccdSmrg 1984456fccdSmrgaix) 1994456fccdSmrg # The C for AIX Compiler uses -M and outputs the dependencies 2004456fccdSmrg # in a .u file. In older versions, this file always lives in the 2014456fccdSmrg # current directory. Also, the AIX compiler puts `$object:' at the 2024456fccdSmrg # start of each line; $object doesn't have directory information. 2034456fccdSmrg # Version 6 uses the directory in both cases. 2044456fccdSmrg stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 2054456fccdSmrg tmpdepfile="$stripped.u" 2064456fccdSmrg if test "$libtool" = yes; then 2074456fccdSmrg "$@" -Wc,-M 2084456fccdSmrg else 2094456fccdSmrg "$@" -M 2104456fccdSmrg fi 2114456fccdSmrg stat=$? 2124456fccdSmrg 2134456fccdSmrg if test -f "$tmpdepfile"; then : 2144456fccdSmrg else 2154456fccdSmrg stripped=`echo "$stripped" | sed 's,^.*/,,'` 2164456fccdSmrg tmpdepfile="$stripped.u" 2174456fccdSmrg fi 2184456fccdSmrg 2194456fccdSmrg if test $stat -eq 0; then : 2204456fccdSmrg else 2214456fccdSmrg rm -f "$tmpdepfile" 2224456fccdSmrg exit $stat 2234456fccdSmrg fi 2244456fccdSmrg 2254456fccdSmrg if test -f "$tmpdepfile"; then 2264456fccdSmrg outname="$stripped.o" 2274456fccdSmrg # Each line is of the form `foo.o: dependent.h'. 2284456fccdSmrg # Do two passes, one to just change these to 2294456fccdSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2304456fccdSmrg sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 2314456fccdSmrg sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 2324456fccdSmrg else 2334456fccdSmrg # The sourcefile does not contain any dependencies, so just 2344456fccdSmrg # store a dummy comment line, to avoid errors with the Makefile 2354456fccdSmrg # "include basename.Plo" scheme. 2364456fccdSmrg echo "#dummy" > "$depfile" 2374456fccdSmrg fi 2384456fccdSmrg rm -f "$tmpdepfile" 2394456fccdSmrg ;; 2404456fccdSmrg 2414456fccdSmrgicc) 2424456fccdSmrg # Intel's C compiler understands `-MD -MF file'. However on 2434456fccdSmrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 2444456fccdSmrg # ICC 7.0 will fill foo.d with something like 2454456fccdSmrg # foo.o: sub/foo.c 2464456fccdSmrg # foo.o: sub/foo.h 2474456fccdSmrg # which is wrong. We want: 2484456fccdSmrg # sub/foo.o: sub/foo.c 2494456fccdSmrg # sub/foo.o: sub/foo.h 2504456fccdSmrg # sub/foo.c: 2514456fccdSmrg # sub/foo.h: 2524456fccdSmrg # ICC 7.1 will output 2534456fccdSmrg # foo.o: sub/foo.c sub/foo.h 2544456fccdSmrg # and will wrap long lines using \ : 2554456fccdSmrg # foo.o: sub/foo.c ... \ 2564456fccdSmrg # sub/foo.h ... \ 2574456fccdSmrg # ... 2584456fccdSmrg 2594456fccdSmrg "$@" -MD -MF "$tmpdepfile" 2604456fccdSmrg stat=$? 2614456fccdSmrg if test $stat -eq 0; then : 2624456fccdSmrg else 2634456fccdSmrg rm -f "$tmpdepfile" 2644456fccdSmrg exit $stat 2654456fccdSmrg fi 2664456fccdSmrg rm -f "$depfile" 2674456fccdSmrg # Each line is of the form `foo.o: dependent.h', 2684456fccdSmrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 2694456fccdSmrg # Do two passes, one to just change these to 2704456fccdSmrg # `$object: dependent.h' and one to simply `dependent.h:'. 2714456fccdSmrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 2724456fccdSmrg # Some versions of the HPUX 10.20 sed can't process this invocation 2734456fccdSmrg # correctly. Breaking it into two sed invocations is a workaround. 2744456fccdSmrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 2754456fccdSmrg sed -e 's/$/ :/' >> "$depfile" 2764456fccdSmrg rm -f "$tmpdepfile" 2774456fccdSmrg ;; 2784456fccdSmrg 2794456fccdSmrgtru64) 2804456fccdSmrg # The Tru64 compiler uses -MD to generate dependencies as a side 2814456fccdSmrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 2824456fccdSmrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 2834456fccdSmrg # dependencies in `foo.d' instead, so we check for that too. 2844456fccdSmrg # Subdirectories are respected. 2854456fccdSmrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 2864456fccdSmrg test "x$dir" = "x$object" && dir= 2874456fccdSmrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 2884456fccdSmrg 2894456fccdSmrg if test "$libtool" = yes; then 2904456fccdSmrg # With Tru64 cc, shared objects can also be used to make a 2914456fccdSmrg # static library. This mecanism is used in libtool 1.4 series to 2924456fccdSmrg # handle both shared and static libraries in a single compilation. 2934456fccdSmrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 2944456fccdSmrg # 2954456fccdSmrg # With libtool 1.5 this exception was removed, and libtool now 2964456fccdSmrg # generates 2 separate objects for the 2 libraries. These two 2974456fccdSmrg # compilations output dependencies in in $dir.libs/$base.o.d and 2984456fccdSmrg # in $dir$base.o.d. We have to check for both files, because 2994456fccdSmrg # one of the two compilations can be disabled. We should prefer 3004456fccdSmrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 3014456fccdSmrg # automatically cleaned when .libs/ is deleted, while ignoring 3024456fccdSmrg # the former would cause a distcleancheck panic. 3034456fccdSmrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 3044456fccdSmrg tmpdepfile2=$dir$base.o.d # libtool 1.5 3054456fccdSmrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 3064456fccdSmrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 3074456fccdSmrg "$@" -Wc,-MD 3084456fccdSmrg else 3094456fccdSmrg tmpdepfile1=$dir$base.o.d 3104456fccdSmrg tmpdepfile2=$dir$base.d 3114456fccdSmrg tmpdepfile3=$dir$base.d 3124456fccdSmrg tmpdepfile4=$dir$base.d 3134456fccdSmrg "$@" -MD 3144456fccdSmrg fi 3154456fccdSmrg 3164456fccdSmrg stat=$? 3174456fccdSmrg if test $stat -eq 0; then : 3184456fccdSmrg else 3194456fccdSmrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3204456fccdSmrg exit $stat 3214456fccdSmrg fi 3224456fccdSmrg 3234456fccdSmrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 3244456fccdSmrg do 3254456fccdSmrg test -f "$tmpdepfile" && break 3264456fccdSmrg done 3274456fccdSmrg if test -f "$tmpdepfile"; then 3284456fccdSmrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 3294456fccdSmrg # That's a tab and a space in the []. 3304456fccdSmrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 3314456fccdSmrg else 3324456fccdSmrg echo "#dummy" > "$depfile" 3334456fccdSmrg fi 3344456fccdSmrg rm -f "$tmpdepfile" 3354456fccdSmrg ;; 3364456fccdSmrg 3374456fccdSmrg#nosideeffect) 3384456fccdSmrg # This comment above is used by automake to tell side-effect 3394456fccdSmrg # dependency tracking mechanisms from slower ones. 3404456fccdSmrg 3414456fccdSmrgdashmstdout) 3424456fccdSmrg # Important note: in order to support this mode, a compiler *must* 3434456fccdSmrg # always write the preprocessed file to stdout, regardless of -o. 3444456fccdSmrg "$@" || exit $? 3454456fccdSmrg 3464456fccdSmrg # Remove the call to Libtool. 3474456fccdSmrg if test "$libtool" = yes; then 3484456fccdSmrg while test $1 != '--mode=compile'; do 3494456fccdSmrg shift 3504456fccdSmrg done 3514456fccdSmrg shift 3524456fccdSmrg fi 3534456fccdSmrg 3544456fccdSmrg # Remove `-o $object'. 3554456fccdSmrg IFS=" " 3564456fccdSmrg for arg 3574456fccdSmrg do 3584456fccdSmrg case $arg in 3594456fccdSmrg -o) 3604456fccdSmrg shift 3614456fccdSmrg ;; 3624456fccdSmrg $object) 3634456fccdSmrg shift 3644456fccdSmrg ;; 3654456fccdSmrg *) 3664456fccdSmrg set fnord "$@" "$arg" 3674456fccdSmrg shift # fnord 3684456fccdSmrg shift # $arg 3694456fccdSmrg ;; 3704456fccdSmrg esac 3714456fccdSmrg done 3724456fccdSmrg 3734456fccdSmrg test -z "$dashmflag" && dashmflag=-M 3744456fccdSmrg # Require at least two characters before searching for `:' 3754456fccdSmrg # in the target name. This is to cope with DOS-style filenames: 3764456fccdSmrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 3774456fccdSmrg "$@" $dashmflag | 3784456fccdSmrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 3794456fccdSmrg rm -f "$depfile" 3804456fccdSmrg cat < "$tmpdepfile" > "$depfile" 3814456fccdSmrg tr ' ' ' 3824456fccdSmrg' < "$tmpdepfile" | \ 3834456fccdSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 3844456fccdSmrg## correctly. Breaking it into two sed invocations is a workaround. 3854456fccdSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 3864456fccdSmrg rm -f "$tmpdepfile" 3874456fccdSmrg ;; 3884456fccdSmrg 3894456fccdSmrgdashXmstdout) 3904456fccdSmrg # This case only exists to satisfy depend.m4. It is never actually 3914456fccdSmrg # run, as this mode is specially recognized in the preamble. 3924456fccdSmrg exit 1 3934456fccdSmrg ;; 3944456fccdSmrg 3954456fccdSmrgmakedepend) 3964456fccdSmrg "$@" || exit $? 3974456fccdSmrg # Remove any Libtool call 3984456fccdSmrg if test "$libtool" = yes; then 3994456fccdSmrg while test $1 != '--mode=compile'; do 4004456fccdSmrg shift 4014456fccdSmrg done 4024456fccdSmrg shift 4034456fccdSmrg fi 4044456fccdSmrg # X makedepend 4054456fccdSmrg shift 4064456fccdSmrg cleared=no 4074456fccdSmrg for arg in "$@"; do 4084456fccdSmrg case $cleared in 4094456fccdSmrg no) 4104456fccdSmrg set ""; shift 4114456fccdSmrg cleared=yes ;; 4124456fccdSmrg esac 4134456fccdSmrg case "$arg" in 4144456fccdSmrg -D*|-I*) 4154456fccdSmrg set fnord "$@" "$arg"; shift ;; 4164456fccdSmrg # Strip any option that makedepend may not understand. Remove 4174456fccdSmrg # the object too, otherwise makedepend will parse it as a source file. 4184456fccdSmrg -*|$object) 4194456fccdSmrg ;; 4204456fccdSmrg *) 4214456fccdSmrg set fnord "$@" "$arg"; shift ;; 4224456fccdSmrg esac 4234456fccdSmrg done 4244456fccdSmrg obj_suffix="`echo $object | sed 's/^.*\././'`" 4254456fccdSmrg touch "$tmpdepfile" 4264456fccdSmrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 4274456fccdSmrg rm -f "$depfile" 4284456fccdSmrg cat < "$tmpdepfile" > "$depfile" 4294456fccdSmrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 4304456fccdSmrg' | \ 4314456fccdSmrg## Some versions of the HPUX 10.20 sed can't process this invocation 4324456fccdSmrg## correctly. Breaking it into two sed invocations is a workaround. 4334456fccdSmrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 4344456fccdSmrg rm -f "$tmpdepfile" "$tmpdepfile".bak 4354456fccdSmrg ;; 4364456fccdSmrg 4374456fccdSmrgcpp) 4384456fccdSmrg # Important note: in order to support this mode, a compiler *must* 4394456fccdSmrg # always write the preprocessed file to stdout. 4404456fccdSmrg "$@" || exit $? 4414456fccdSmrg 4424456fccdSmrg # Remove the call to Libtool. 4434456fccdSmrg if test "$libtool" = yes; then 4444456fccdSmrg while test $1 != '--mode=compile'; do 4454456fccdSmrg shift 4464456fccdSmrg done 4474456fccdSmrg shift 4484456fccdSmrg fi 4494456fccdSmrg 4504456fccdSmrg # Remove `-o $object'. 4514456fccdSmrg IFS=" " 4524456fccdSmrg for arg 4534456fccdSmrg do 4544456fccdSmrg case $arg in 4554456fccdSmrg -o) 4564456fccdSmrg shift 4574456fccdSmrg ;; 4584456fccdSmrg $object) 4594456fccdSmrg shift 4604456fccdSmrg ;; 4614456fccdSmrg *) 4624456fccdSmrg set fnord "$@" "$arg" 4634456fccdSmrg shift # fnord 4644456fccdSmrg shift # $arg 4654456fccdSmrg ;; 4664456fccdSmrg esac 4674456fccdSmrg done 4684456fccdSmrg 4694456fccdSmrg "$@" -E | 4704456fccdSmrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 4714456fccdSmrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 4724456fccdSmrg sed '$ s: \\$::' > "$tmpdepfile" 4734456fccdSmrg rm -f "$depfile" 4744456fccdSmrg echo "$object : \\" > "$depfile" 4754456fccdSmrg cat < "$tmpdepfile" >> "$depfile" 4764456fccdSmrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 4774456fccdSmrg rm -f "$tmpdepfile" 4784456fccdSmrg ;; 4794456fccdSmrg 4804456fccdSmrgmsvisualcpp) 4814456fccdSmrg # Important note: in order to support this mode, a compiler *must* 4824456fccdSmrg # always write the preprocessed file to stdout, regardless of -o, 4834456fccdSmrg # because we must use -o when running libtool. 4844456fccdSmrg "$@" || exit $? 4854456fccdSmrg IFS=" " 4864456fccdSmrg for arg 4874456fccdSmrg do 4884456fccdSmrg case "$arg" in 4894456fccdSmrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 4904456fccdSmrg set fnord "$@" 4914456fccdSmrg shift 4924456fccdSmrg shift 4934456fccdSmrg ;; 4944456fccdSmrg *) 4954456fccdSmrg set fnord "$@" "$arg" 4964456fccdSmrg shift 4974456fccdSmrg shift 4984456fccdSmrg ;; 4994456fccdSmrg esac 5004456fccdSmrg done 5014456fccdSmrg "$@" -E | 5024456fccdSmrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 5034456fccdSmrg rm -f "$depfile" 5044456fccdSmrg echo "$object : \\" > "$depfile" 5054456fccdSmrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 5064456fccdSmrg echo " " >> "$depfile" 5074456fccdSmrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 5084456fccdSmrg rm -f "$tmpdepfile" 5094456fccdSmrg ;; 5104456fccdSmrg 5114456fccdSmrgnone) 5124456fccdSmrg exec "$@" 5134456fccdSmrg ;; 5144456fccdSmrg 5154456fccdSmrg*) 5164456fccdSmrg echo "Unknown depmode $depmode" 1>&2 5174456fccdSmrg exit 1 5184456fccdSmrg ;; 5194456fccdSmrgesac 5204456fccdSmrg 5214456fccdSmrgexit 0 5224456fccdSmrg 5234456fccdSmrg# Local Variables: 5244456fccdSmrg# mode: shell-script 5254456fccdSmrg# sh-indentation: 2 5264456fccdSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 5274456fccdSmrg# time-stamp-start: "scriptversion=" 5284456fccdSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 5294456fccdSmrg# time-stamp-end: "$" 5304456fccdSmrg# End: 531