annotate depcomp @ 288:843b1cfb7b5c 2.0

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