depcomp revision 95b296d0
195b296d0Smrg#! /bin/sh 295b296d0Smrg# depcomp - compile a program generating dependencies as side-effects 395b296d0Smrg 495b296d0Smrgscriptversion=2005-07-09.11 595b296d0Smrg 695b296d0Smrg# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 795b296d0Smrg 895b296d0Smrg# This program is free software; you can redistribute it and/or modify 995b296d0Smrg# it under the terms of the GNU General Public License as published by 1095b296d0Smrg# the Free Software Foundation; either version 2, or (at your option) 1195b296d0Smrg# any later version. 1295b296d0Smrg 1395b296d0Smrg# This program is distributed in the hope that it will be useful, 1495b296d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1595b296d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1695b296d0Smrg# GNU General Public License for more details. 1795b296d0Smrg 1895b296d0Smrg# You should have received a copy of the GNU General Public License 1995b296d0Smrg# along with this program; if not, write to the Free Software 2095b296d0Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2195b296d0Smrg# 02110-1301, USA. 2295b296d0Smrg 2395b296d0Smrg# As a special exception to the GNU General Public License, if you 2495b296d0Smrg# distribute this file as part of a program that contains a 2595b296d0Smrg# configuration script generated by Autoconf, you may include it under 2695b296d0Smrg# the same distribution terms that you use for the rest of that program. 2795b296d0Smrg 2895b296d0Smrg# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 2995b296d0Smrg 3095b296d0Smrgcase $1 in 3195b296d0Smrg '') 3295b296d0Smrg echo "$0: No command. Try \`$0 --help' for more information." 1>&2 3395b296d0Smrg exit 1; 3495b296d0Smrg ;; 3595b296d0Smrg -h | --h*) 3695b296d0Smrg cat <<\EOF 3795b296d0SmrgUsage: depcomp [--help] [--version] PROGRAM [ARGS] 3895b296d0Smrg 3995b296d0SmrgRun PROGRAMS ARGS to compile a file, generating dependencies 4095b296d0Smrgas side-effects. 4195b296d0Smrg 4295b296d0SmrgEnvironment variables: 4395b296d0Smrg depmode Dependency tracking mode. 4495b296d0Smrg source Source file read by `PROGRAMS ARGS'. 4595b296d0Smrg object Object file output by `PROGRAMS ARGS'. 4695b296d0Smrg DEPDIR directory where to store dependencies. 4795b296d0Smrg depfile Dependency file to output. 4895b296d0Smrg tmpdepfile Temporary file to use when outputing dependencies. 4995b296d0Smrg libtool Whether libtool is used (yes/no). 5095b296d0Smrg 5195b296d0SmrgReport bugs to <bug-automake@gnu.org>. 5295b296d0SmrgEOF 5395b296d0Smrg exit $? 5495b296d0Smrg ;; 5595b296d0Smrg -v | --v*) 5695b296d0Smrg echo "depcomp $scriptversion" 5795b296d0Smrg exit $? 5895b296d0Smrg ;; 5995b296d0Smrgesac 6095b296d0Smrg 6195b296d0Smrgif test -z "$depmode" || test -z "$source" || test -z "$object"; then 6295b296d0Smrg echo "depcomp: Variables source, object and depmode must be set" 1>&2 6395b296d0Smrg exit 1 6495b296d0Smrgfi 6595b296d0Smrg 6695b296d0Smrg# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 6795b296d0Smrgdepfile=${depfile-`echo "$object" | 6895b296d0Smrg sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 6995b296d0Smrgtmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 7095b296d0Smrg 7195b296d0Smrgrm -f "$tmpdepfile" 7295b296d0Smrg 7395b296d0Smrg# Some modes work just like other modes, but use different flags. We 7495b296d0Smrg# parameterize here, but still list the modes in the big case below, 7595b296d0Smrg# to make depend.m4 easier to write. Note that we *cannot* use a case 7695b296d0Smrg# here, because this file can only contain one case statement. 7795b296d0Smrgif test "$depmode" = hp; then 7895b296d0Smrg # HP compiler uses -M and no extra arg. 7995b296d0Smrg gccflag=-M 8095b296d0Smrg depmode=gcc 8195b296d0Smrgfi 8295b296d0Smrg 8395b296d0Smrgif test "$depmode" = dashXmstdout; then 8495b296d0Smrg # This is just like dashmstdout with a different argument. 8595b296d0Smrg dashmflag=-xM 8695b296d0Smrg depmode=dashmstdout 8795b296d0Smrgfi 8895b296d0Smrg 8995b296d0Smrgcase "$depmode" in 9095b296d0Smrggcc3) 9195b296d0Smrg## gcc 3 implements dependency tracking that does exactly what 9295b296d0Smrg## we want. Yay! Note: for some reason libtool 1.4 doesn't like 9395b296d0Smrg## it if -MD -MP comes after the -MF stuff. Hmm. 9495b296d0Smrg "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 9595b296d0Smrg stat=$? 9695b296d0Smrg if test $stat -eq 0; then : 9795b296d0Smrg else 9895b296d0Smrg rm -f "$tmpdepfile" 9995b296d0Smrg exit $stat 10095b296d0Smrg fi 10195b296d0Smrg mv "$tmpdepfile" "$depfile" 10295b296d0Smrg ;; 10395b296d0Smrg 10495b296d0Smrggcc) 10595b296d0Smrg## There are various ways to get dependency output from gcc. Here's 10695b296d0Smrg## why we pick this rather obscure method: 10795b296d0Smrg## - Don't want to use -MD because we'd like the dependencies to end 10895b296d0Smrg## up in a subdir. Having to rename by hand is ugly. 10995b296d0Smrg## (We might end up doing this anyway to support other compilers.) 11095b296d0Smrg## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 11195b296d0Smrg## -MM, not -M (despite what the docs say). 11295b296d0Smrg## - Using -M directly means running the compiler twice (even worse 11395b296d0Smrg## than renaming). 11495b296d0Smrg if test -z "$gccflag"; then 11595b296d0Smrg gccflag=-MD, 11695b296d0Smrg fi 11795b296d0Smrg "$@" -Wp,"$gccflag$tmpdepfile" 11895b296d0Smrg stat=$? 11995b296d0Smrg if test $stat -eq 0; then : 12095b296d0Smrg else 12195b296d0Smrg rm -f "$tmpdepfile" 12295b296d0Smrg exit $stat 12395b296d0Smrg fi 12495b296d0Smrg rm -f "$depfile" 12595b296d0Smrg echo "$object : \\" > "$depfile" 12695b296d0Smrg alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 12795b296d0Smrg## The second -e expression handles DOS-style file names with drive letters. 12895b296d0Smrg sed -e 's/^[^:]*: / /' \ 12995b296d0Smrg -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 13095b296d0Smrg## This next piece of magic avoids the `deleted header file' problem. 13195b296d0Smrg## The problem is that when a header file which appears in a .P file 13295b296d0Smrg## is deleted, the dependency causes make to die (because there is 13395b296d0Smrg## typically no way to rebuild the header). We avoid this by adding 13495b296d0Smrg## dummy dependencies for each header file. Too bad gcc doesn't do 13595b296d0Smrg## this for us directly. 13695b296d0Smrg tr ' ' ' 13795b296d0Smrg' < "$tmpdepfile" | 13895b296d0Smrg## Some versions of gcc put a space before the `:'. On the theory 13995b296d0Smrg## that the space means something, we add a space to the output as 14095b296d0Smrg## well. 14195b296d0Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 14295b296d0Smrg## correctly. Breaking it into two sed invocations is a workaround. 14395b296d0Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 14495b296d0Smrg rm -f "$tmpdepfile" 14595b296d0Smrg ;; 14695b296d0Smrg 14795b296d0Smrghp) 14895b296d0Smrg # This case exists only to let depend.m4 do its work. It works by 14995b296d0Smrg # looking at the text of this script. This case will never be run, 15095b296d0Smrg # since it is checked for above. 15195b296d0Smrg exit 1 15295b296d0Smrg ;; 15395b296d0Smrg 15495b296d0Smrgsgi) 15595b296d0Smrg if test "$libtool" = yes; then 15695b296d0Smrg "$@" "-Wp,-MDupdate,$tmpdepfile" 15795b296d0Smrg else 15895b296d0Smrg "$@" -MDupdate "$tmpdepfile" 15995b296d0Smrg fi 16095b296d0Smrg stat=$? 16195b296d0Smrg if test $stat -eq 0; then : 16295b296d0Smrg else 16395b296d0Smrg rm -f "$tmpdepfile" 16495b296d0Smrg exit $stat 16595b296d0Smrg fi 16695b296d0Smrg rm -f "$depfile" 16795b296d0Smrg 16895b296d0Smrg if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 16995b296d0Smrg echo "$object : \\" > "$depfile" 17095b296d0Smrg 17195b296d0Smrg # Clip off the initial element (the dependent). Don't try to be 17295b296d0Smrg # clever and replace this with sed code, as IRIX sed won't handle 17395b296d0Smrg # lines with more than a fixed number of characters (4096 in 17495b296d0Smrg # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 17595b296d0Smrg # the IRIX cc adds comments like `#:fec' to the end of the 17695b296d0Smrg # dependency line. 17795b296d0Smrg tr ' ' ' 17895b296d0Smrg' < "$tmpdepfile" \ 17995b296d0Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 18095b296d0Smrg tr ' 18195b296d0Smrg' ' ' >> $depfile 18295b296d0Smrg echo >> $depfile 18395b296d0Smrg 18495b296d0Smrg # The second pass generates a dummy entry for each header file. 18595b296d0Smrg tr ' ' ' 18695b296d0Smrg' < "$tmpdepfile" \ 18795b296d0Smrg | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 18895b296d0Smrg >> $depfile 18995b296d0Smrg else 19095b296d0Smrg # The sourcefile does not contain any dependencies, so just 19195b296d0Smrg # store a dummy comment line, to avoid errors with the Makefile 19295b296d0Smrg # "include basename.Plo" scheme. 19395b296d0Smrg echo "#dummy" > "$depfile" 19495b296d0Smrg fi 19595b296d0Smrg rm -f "$tmpdepfile" 19695b296d0Smrg ;; 19795b296d0Smrg 19895b296d0Smrgaix) 19995b296d0Smrg # The C for AIX Compiler uses -M and outputs the dependencies 20095b296d0Smrg # in a .u file. In older versions, this file always lives in the 20195b296d0Smrg # current directory. Also, the AIX compiler puts `$object:' at the 20295b296d0Smrg # start of each line; $object doesn't have directory information. 20395b296d0Smrg # Version 6 uses the directory in both cases. 20495b296d0Smrg stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 20595b296d0Smrg tmpdepfile="$stripped.u" 20695b296d0Smrg if test "$libtool" = yes; then 20795b296d0Smrg "$@" -Wc,-M 20895b296d0Smrg else 20995b296d0Smrg "$@" -M 21095b296d0Smrg fi 21195b296d0Smrg stat=$? 21295b296d0Smrg 21395b296d0Smrg if test -f "$tmpdepfile"; then : 21495b296d0Smrg else 21595b296d0Smrg stripped=`echo "$stripped" | sed 's,^.*/,,'` 21695b296d0Smrg tmpdepfile="$stripped.u" 21795b296d0Smrg fi 21895b296d0Smrg 21995b296d0Smrg if test $stat -eq 0; then : 22095b296d0Smrg else 22195b296d0Smrg rm -f "$tmpdepfile" 22295b296d0Smrg exit $stat 22395b296d0Smrg fi 22495b296d0Smrg 22595b296d0Smrg if test -f "$tmpdepfile"; then 22695b296d0Smrg outname="$stripped.o" 22795b296d0Smrg # Each line is of the form `foo.o: dependent.h'. 22895b296d0Smrg # Do two passes, one to just change these to 22995b296d0Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 23095b296d0Smrg sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 23195b296d0Smrg sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 23295b296d0Smrg else 23395b296d0Smrg # The sourcefile does not contain any dependencies, so just 23495b296d0Smrg # store a dummy comment line, to avoid errors with the Makefile 23595b296d0Smrg # "include basename.Plo" scheme. 23695b296d0Smrg echo "#dummy" > "$depfile" 23795b296d0Smrg fi 23895b296d0Smrg rm -f "$tmpdepfile" 23995b296d0Smrg ;; 24095b296d0Smrg 24195b296d0Smrgicc) 24295b296d0Smrg # Intel's C compiler understands `-MD -MF file'. However on 24395b296d0Smrg # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 24495b296d0Smrg # ICC 7.0 will fill foo.d with something like 24595b296d0Smrg # foo.o: sub/foo.c 24695b296d0Smrg # foo.o: sub/foo.h 24795b296d0Smrg # which is wrong. We want: 24895b296d0Smrg # sub/foo.o: sub/foo.c 24995b296d0Smrg # sub/foo.o: sub/foo.h 25095b296d0Smrg # sub/foo.c: 25195b296d0Smrg # sub/foo.h: 25295b296d0Smrg # ICC 7.1 will output 25395b296d0Smrg # foo.o: sub/foo.c sub/foo.h 25495b296d0Smrg # and will wrap long lines using \ : 25595b296d0Smrg # foo.o: sub/foo.c ... \ 25695b296d0Smrg # sub/foo.h ... \ 25795b296d0Smrg # ... 25895b296d0Smrg 25995b296d0Smrg "$@" -MD -MF "$tmpdepfile" 26095b296d0Smrg stat=$? 26195b296d0Smrg if test $stat -eq 0; then : 26295b296d0Smrg else 26395b296d0Smrg rm -f "$tmpdepfile" 26495b296d0Smrg exit $stat 26595b296d0Smrg fi 26695b296d0Smrg rm -f "$depfile" 26795b296d0Smrg # Each line is of the form `foo.o: dependent.h', 26895b296d0Smrg # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 26995b296d0Smrg # Do two passes, one to just change these to 27095b296d0Smrg # `$object: dependent.h' and one to simply `dependent.h:'. 27195b296d0Smrg sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 27295b296d0Smrg # Some versions of the HPUX 10.20 sed can't process this invocation 27395b296d0Smrg # correctly. Breaking it into two sed invocations is a workaround. 27495b296d0Smrg sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 27595b296d0Smrg sed -e 's/$/ :/' >> "$depfile" 27695b296d0Smrg rm -f "$tmpdepfile" 27795b296d0Smrg ;; 27895b296d0Smrg 27995b296d0Smrgtru64) 28095b296d0Smrg # The Tru64 compiler uses -MD to generate dependencies as a side 28195b296d0Smrg # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 28295b296d0Smrg # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 28395b296d0Smrg # dependencies in `foo.d' instead, so we check for that too. 28495b296d0Smrg # Subdirectories are respected. 28595b296d0Smrg dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 28695b296d0Smrg test "x$dir" = "x$object" && dir= 28795b296d0Smrg base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 28895b296d0Smrg 28995b296d0Smrg if test "$libtool" = yes; then 29095b296d0Smrg # With Tru64 cc, shared objects can also be used to make a 29195b296d0Smrg # static library. This mecanism is used in libtool 1.4 series to 29295b296d0Smrg # handle both shared and static libraries in a single compilation. 29395b296d0Smrg # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 29495b296d0Smrg # 29595b296d0Smrg # With libtool 1.5 this exception was removed, and libtool now 29695b296d0Smrg # generates 2 separate objects for the 2 libraries. These two 29795b296d0Smrg # compilations output dependencies in in $dir.libs/$base.o.d and 29895b296d0Smrg # in $dir$base.o.d. We have to check for both files, because 29995b296d0Smrg # one of the two compilations can be disabled. We should prefer 30095b296d0Smrg # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 30195b296d0Smrg # automatically cleaned when .libs/ is deleted, while ignoring 30295b296d0Smrg # the former would cause a distcleancheck panic. 30395b296d0Smrg tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 30495b296d0Smrg tmpdepfile2=$dir$base.o.d # libtool 1.5 30595b296d0Smrg tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 30695b296d0Smrg tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 30795b296d0Smrg "$@" -Wc,-MD 30895b296d0Smrg else 30995b296d0Smrg tmpdepfile1=$dir$base.o.d 31095b296d0Smrg tmpdepfile2=$dir$base.d 31195b296d0Smrg tmpdepfile3=$dir$base.d 31295b296d0Smrg tmpdepfile4=$dir$base.d 31395b296d0Smrg "$@" -MD 31495b296d0Smrg fi 31595b296d0Smrg 31695b296d0Smrg stat=$? 31795b296d0Smrg if test $stat -eq 0; then : 31895b296d0Smrg else 31995b296d0Smrg rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 32095b296d0Smrg exit $stat 32195b296d0Smrg fi 32295b296d0Smrg 32395b296d0Smrg for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 32495b296d0Smrg do 32595b296d0Smrg test -f "$tmpdepfile" && break 32695b296d0Smrg done 32795b296d0Smrg if test -f "$tmpdepfile"; then 32895b296d0Smrg sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 32995b296d0Smrg # That's a tab and a space in the []. 33095b296d0Smrg sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 33195b296d0Smrg else 33295b296d0Smrg echo "#dummy" > "$depfile" 33395b296d0Smrg fi 33495b296d0Smrg rm -f "$tmpdepfile" 33595b296d0Smrg ;; 33695b296d0Smrg 33795b296d0Smrg#nosideeffect) 33895b296d0Smrg # This comment above is used by automake to tell side-effect 33995b296d0Smrg # dependency tracking mechanisms from slower ones. 34095b296d0Smrg 34195b296d0Smrgdashmstdout) 34295b296d0Smrg # Important note: in order to support this mode, a compiler *must* 34395b296d0Smrg # always write the preprocessed file to stdout, regardless of -o. 34495b296d0Smrg "$@" || exit $? 34595b296d0Smrg 34695b296d0Smrg # Remove the call to Libtool. 34795b296d0Smrg if test "$libtool" = yes; then 34895b296d0Smrg while test $1 != '--mode=compile'; do 34995b296d0Smrg shift 35095b296d0Smrg done 35195b296d0Smrg shift 35295b296d0Smrg fi 35395b296d0Smrg 35495b296d0Smrg # Remove `-o $object'. 35595b296d0Smrg IFS=" " 35695b296d0Smrg for arg 35795b296d0Smrg do 35895b296d0Smrg case $arg in 35995b296d0Smrg -o) 36095b296d0Smrg shift 36195b296d0Smrg ;; 36295b296d0Smrg $object) 36395b296d0Smrg shift 36495b296d0Smrg ;; 36595b296d0Smrg *) 36695b296d0Smrg set fnord "$@" "$arg" 36795b296d0Smrg shift # fnord 36895b296d0Smrg shift # $arg 36995b296d0Smrg ;; 37095b296d0Smrg esac 37195b296d0Smrg done 37295b296d0Smrg 37395b296d0Smrg test -z "$dashmflag" && dashmflag=-M 37495b296d0Smrg # Require at least two characters before searching for `:' 37595b296d0Smrg # in the target name. This is to cope with DOS-style filenames: 37695b296d0Smrg # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 37795b296d0Smrg "$@" $dashmflag | 37895b296d0Smrg sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 37995b296d0Smrg rm -f "$depfile" 38095b296d0Smrg cat < "$tmpdepfile" > "$depfile" 38195b296d0Smrg tr ' ' ' 38295b296d0Smrg' < "$tmpdepfile" | \ 38395b296d0Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 38495b296d0Smrg## correctly. Breaking it into two sed invocations is a workaround. 38595b296d0Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 38695b296d0Smrg rm -f "$tmpdepfile" 38795b296d0Smrg ;; 38895b296d0Smrg 38995b296d0SmrgdashXmstdout) 39095b296d0Smrg # This case only exists to satisfy depend.m4. It is never actually 39195b296d0Smrg # run, as this mode is specially recognized in the preamble. 39295b296d0Smrg exit 1 39395b296d0Smrg ;; 39495b296d0Smrg 39595b296d0Smrgmakedepend) 39695b296d0Smrg "$@" || exit $? 39795b296d0Smrg # Remove any Libtool call 39895b296d0Smrg if test "$libtool" = yes; then 39995b296d0Smrg while test $1 != '--mode=compile'; do 40095b296d0Smrg shift 40195b296d0Smrg done 40295b296d0Smrg shift 40395b296d0Smrg fi 40495b296d0Smrg # X makedepend 40595b296d0Smrg shift 40695b296d0Smrg cleared=no 40795b296d0Smrg for arg in "$@"; do 40895b296d0Smrg case $cleared in 40995b296d0Smrg no) 41095b296d0Smrg set ""; shift 41195b296d0Smrg cleared=yes ;; 41295b296d0Smrg esac 41395b296d0Smrg case "$arg" in 41495b296d0Smrg -D*|-I*) 41595b296d0Smrg set fnord "$@" "$arg"; shift ;; 41695b296d0Smrg # Strip any option that makedepend may not understand. Remove 41795b296d0Smrg # the object too, otherwise makedepend will parse it as a source file. 41895b296d0Smrg -*|$object) 41995b296d0Smrg ;; 42095b296d0Smrg *) 42195b296d0Smrg set fnord "$@" "$arg"; shift ;; 42295b296d0Smrg esac 42395b296d0Smrg done 42495b296d0Smrg obj_suffix="`echo $object | sed 's/^.*\././'`" 42595b296d0Smrg touch "$tmpdepfile" 42695b296d0Smrg ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 42795b296d0Smrg rm -f "$depfile" 42895b296d0Smrg cat < "$tmpdepfile" > "$depfile" 42995b296d0Smrg sed '1,2d' "$tmpdepfile" | tr ' ' ' 43095b296d0Smrg' | \ 43195b296d0Smrg## Some versions of the HPUX 10.20 sed can't process this invocation 43295b296d0Smrg## correctly. Breaking it into two sed invocations is a workaround. 43395b296d0Smrg sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 43495b296d0Smrg rm -f "$tmpdepfile" "$tmpdepfile".bak 43595b296d0Smrg ;; 43695b296d0Smrg 43795b296d0Smrgcpp) 43895b296d0Smrg # Important note: in order to support this mode, a compiler *must* 43995b296d0Smrg # always write the preprocessed file to stdout. 44095b296d0Smrg "$@" || exit $? 44195b296d0Smrg 44295b296d0Smrg # Remove the call to Libtool. 44395b296d0Smrg if test "$libtool" = yes; then 44495b296d0Smrg while test $1 != '--mode=compile'; do 44595b296d0Smrg shift 44695b296d0Smrg done 44795b296d0Smrg shift 44895b296d0Smrg fi 44995b296d0Smrg 45095b296d0Smrg # Remove `-o $object'. 45195b296d0Smrg IFS=" " 45295b296d0Smrg for arg 45395b296d0Smrg do 45495b296d0Smrg case $arg in 45595b296d0Smrg -o) 45695b296d0Smrg shift 45795b296d0Smrg ;; 45895b296d0Smrg $object) 45995b296d0Smrg shift 46095b296d0Smrg ;; 46195b296d0Smrg *) 46295b296d0Smrg set fnord "$@" "$arg" 46395b296d0Smrg shift # fnord 46495b296d0Smrg shift # $arg 46595b296d0Smrg ;; 46695b296d0Smrg esac 46795b296d0Smrg done 46895b296d0Smrg 46995b296d0Smrg "$@" -E | 47095b296d0Smrg sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 47195b296d0Smrg -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 47295b296d0Smrg sed '$ s: \\$::' > "$tmpdepfile" 47395b296d0Smrg rm -f "$depfile" 47495b296d0Smrg echo "$object : \\" > "$depfile" 47595b296d0Smrg cat < "$tmpdepfile" >> "$depfile" 47695b296d0Smrg sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 47795b296d0Smrg rm -f "$tmpdepfile" 47895b296d0Smrg ;; 47995b296d0Smrg 48095b296d0Smrgmsvisualcpp) 48195b296d0Smrg # Important note: in order to support this mode, a compiler *must* 48295b296d0Smrg # always write the preprocessed file to stdout, regardless of -o, 48395b296d0Smrg # because we must use -o when running libtool. 48495b296d0Smrg "$@" || exit $? 48595b296d0Smrg IFS=" " 48695b296d0Smrg for arg 48795b296d0Smrg do 48895b296d0Smrg case "$arg" in 48995b296d0Smrg "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 49095b296d0Smrg set fnord "$@" 49195b296d0Smrg shift 49295b296d0Smrg shift 49395b296d0Smrg ;; 49495b296d0Smrg *) 49595b296d0Smrg set fnord "$@" "$arg" 49695b296d0Smrg shift 49795b296d0Smrg shift 49895b296d0Smrg ;; 49995b296d0Smrg esac 50095b296d0Smrg done 50195b296d0Smrg "$@" -E | 50295b296d0Smrg sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 50395b296d0Smrg rm -f "$depfile" 50495b296d0Smrg echo "$object : \\" > "$depfile" 50595b296d0Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 50695b296d0Smrg echo " " >> "$depfile" 50795b296d0Smrg . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 50895b296d0Smrg rm -f "$tmpdepfile" 50995b296d0Smrg ;; 51095b296d0Smrg 51195b296d0Smrgnone) 51295b296d0Smrg exec "$@" 51395b296d0Smrg ;; 51495b296d0Smrg 51595b296d0Smrg*) 51695b296d0Smrg echo "Unknown depmode $depmode" 1>&2 51795b296d0Smrg exit 1 51895b296d0Smrg ;; 51995b296d0Smrgesac 52095b296d0Smrg 52195b296d0Smrgexit 0 52295b296d0Smrg 52395b296d0Smrg# Local Variables: 52495b296d0Smrg# mode: shell-script 52595b296d0Smrg# sh-indentation: 2 52695b296d0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 52795b296d0Smrg# time-stamp-start: "scriptversion=" 52895b296d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 52995b296d0Smrg# time-stamp-end: "$" 53095b296d0Smrg# End: 531