rev |
line source |
meillo@0
|
1 #! /bin/sh
|
meillo@0
|
2
|
meillo@0
|
3 # depcomp - compile a program generating dependencies as side-effects
|
meillo@0
|
4 # Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
|
meillo@0
|
5
|
meillo@0
|
6 # This program is free software; you can redistribute it and/or modify
|
meillo@0
|
7 # it under the terms of the GNU General Public License as published by
|
meillo@0
|
8 # the Free Software Foundation; either version 2, or (at your option)
|
meillo@0
|
9 # any later version.
|
meillo@0
|
10
|
meillo@0
|
11 # This program is distributed in the hope that it will be useful,
|
meillo@0
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
meillo@0
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
meillo@0
|
14 # GNU General Public License for more details.
|
meillo@0
|
15
|
meillo@0
|
16 # You should have received a copy of the GNU General Public License
|
meillo@0
|
17 # along with this program; if not, write to the Free Software
|
meillo@0
|
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
meillo@0
|
19 # 02111-1307, USA.
|
meillo@0
|
20
|
meillo@0
|
21 # As a special exception to the GNU General Public License, if you
|
meillo@0
|
22 # distribute this file as part of a program that contains a
|
meillo@0
|
23 # configuration script generated by Autoconf, you may include it under
|
meillo@0
|
24 # the same distribution terms that you use for the rest of that program.
|
meillo@0
|
25
|
meillo@0
|
26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
meillo@0
|
27
|
meillo@0
|
28 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
meillo@0
|
29 echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
meillo@0
|
30 exit 1
|
meillo@0
|
31 fi
|
meillo@0
|
32 # `libtool' can also be set to `yes' or `no'.
|
meillo@0
|
33
|
meillo@0
|
34 if test -z "$depfile"; then
|
meillo@0
|
35 base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
meillo@0
|
36 dir=`echo "$object" | sed 's,/.*$,/,'`
|
meillo@0
|
37 if test "$dir" = "$object"; then
|
meillo@0
|
38 dir=
|
meillo@0
|
39 fi
|
meillo@0
|
40 # FIXME: should be _deps on DOS.
|
meillo@0
|
41 depfile="$dir.deps/$base"
|
meillo@0
|
42 fi
|
meillo@0
|
43
|
meillo@0
|
44 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
meillo@0
|
45
|
meillo@0
|
46 rm -f "$tmpdepfile"
|
meillo@0
|
47
|
meillo@0
|
48 # Some modes work just like other modes, but use different flags. We
|
meillo@0
|
49 # parameterize here, but still list the modes in the big case below,
|
meillo@0
|
50 # to make depend.m4 easier to write. Note that we *cannot* use a case
|
meillo@0
|
51 # here, because this file can only contain one case statement.
|
meillo@0
|
52 if test "$depmode" = hp; then
|
meillo@0
|
53 # HP compiler uses -M and no extra arg.
|
meillo@0
|
54 gccflag=-M
|
meillo@0
|
55 depmode=gcc
|
meillo@0
|
56 fi
|
meillo@0
|
57
|
meillo@0
|
58 if test "$depmode" = dashXmstdout; then
|
meillo@0
|
59 # This is just like dashmstdout with a different argument.
|
meillo@0
|
60 dashmflag=-xM
|
meillo@0
|
61 depmode=dashmstdout
|
meillo@0
|
62 fi
|
meillo@0
|
63
|
meillo@0
|
64 case "$depmode" in
|
meillo@0
|
65 gcc3)
|
meillo@0
|
66 ## gcc 3 implements dependency tracking that does exactly what
|
meillo@0
|
67 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
meillo@0
|
68 ## it if -MD -MP comes after the -MF stuff. Hmm.
|
meillo@0
|
69 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
meillo@0
|
70 stat=$?
|
meillo@0
|
71 if test $stat -eq 0; then :
|
meillo@0
|
72 else
|
meillo@0
|
73 rm -f "$tmpdepfile"
|
meillo@0
|
74 exit $stat
|
meillo@0
|
75 fi
|
meillo@0
|
76 mv "$tmpdepfile" "$depfile"
|
meillo@0
|
77 ;;
|
meillo@0
|
78
|
meillo@0
|
79 gcc)
|
meillo@0
|
80 ## There are various ways to get dependency output from gcc. Here's
|
meillo@0
|
81 ## why we pick this rather obscure method:
|
meillo@0
|
82 ## - Don't want to use -MD because we'd like the dependencies to end
|
meillo@0
|
83 ## up in a subdir. Having to rename by hand is ugly.
|
meillo@0
|
84 ## (We might end up doing this anyway to support other compilers.)
|
meillo@0
|
85 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
meillo@0
|
86 ## -MM, not -M (despite what the docs say).
|
meillo@0
|
87 ## - Using -M directly means running the compiler twice (even worse
|
meillo@0
|
88 ## than renaming).
|
meillo@0
|
89 if test -z "$gccflag"; then
|
meillo@0
|
90 gccflag=-MD,
|
meillo@0
|
91 fi
|
meillo@0
|
92 "$@" -Wp,"$gccflag$tmpdepfile"
|
meillo@0
|
93 stat=$?
|
meillo@0
|
94 if test $stat -eq 0; then :
|
meillo@0
|
95 else
|
meillo@0
|
96 rm -f "$tmpdepfile"
|
meillo@0
|
97 exit $stat
|
meillo@0
|
98 fi
|
meillo@0
|
99 rm -f "$depfile"
|
meillo@0
|
100 echo "$object : \\" > "$depfile"
|
meillo@0
|
101 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
meillo@0
|
102 ## The second -e expression handles DOS-style file names with drive letters.
|
meillo@0
|
103 sed -e 's/^[^:]*: / /' \
|
meillo@0
|
104 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
meillo@0
|
105 ## This next piece of magic avoids the `deleted header file' problem.
|
meillo@0
|
106 ## The problem is that when a header file which appears in a .P file
|
meillo@0
|
107 ## is deleted, the dependency causes make to die (because there is
|
meillo@0
|
108 ## typically no way to rebuild the header). We avoid this by adding
|
meillo@0
|
109 ## dummy dependencies for each header file. Too bad gcc doesn't do
|
meillo@0
|
110 ## this for us directly.
|
meillo@0
|
111 tr ' ' '
|
meillo@0
|
112 ' < "$tmpdepfile" |
|
meillo@0
|
113 ## Some versions of gcc put a space before the `:'. On the theory
|
meillo@0
|
114 ## that the space means something, we add a space to the output as
|
meillo@0
|
115 ## well.
|
meillo@0
|
116 ## Some versions of the HPUX 10.20 sed can't process this invocation
|
meillo@0
|
117 ## correctly. Breaking it into two sed invocations is a workaround.
|
meillo@0
|
118 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
meillo@0
|
119 rm -f "$tmpdepfile"
|
meillo@0
|
120 ;;
|
meillo@0
|
121
|
meillo@0
|
122 hp)
|
meillo@0
|
123 # This case exists only to let depend.m4 do its work. It works by
|
meillo@0
|
124 # looking at the text of this script. This case will never be run,
|
meillo@0
|
125 # since it is checked for above.
|
meillo@0
|
126 exit 1
|
meillo@0
|
127 ;;
|
meillo@0
|
128
|
meillo@0
|
129 sgi)
|
meillo@0
|
130 if test "$libtool" = yes; then
|
meillo@0
|
131 "$@" "-Wp,-MDupdate,$tmpdepfile"
|
meillo@0
|
132 else
|
meillo@0
|
133 "$@" -MDupdate "$tmpdepfile"
|
meillo@0
|
134 fi
|
meillo@0
|
135 stat=$?
|
meillo@0
|
136 if test $stat -eq 0; then :
|
meillo@0
|
137 else
|
meillo@0
|
138 rm -f "$tmpdepfile"
|
meillo@0
|
139 exit $stat
|
meillo@0
|
140 fi
|
meillo@0
|
141 rm -f "$depfile"
|
meillo@0
|
142
|
meillo@0
|
143 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
meillo@0
|
144 echo "$object : \\" > "$depfile"
|
meillo@0
|
145
|
meillo@0
|
146 # Clip off the initial element (the dependent). Don't try to be
|
meillo@0
|
147 # clever and replace this with sed code, as IRIX sed won't handle
|
meillo@0
|
148 # lines with more than a fixed number of characters (4096 in
|
meillo@0
|
149 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
meillo@0
|
150 # the IRIX cc adds comments like `#:fec' to the end of the
|
meillo@0
|
151 # dependency line.
|
meillo@0
|
152 tr ' ' '
|
meillo@0
|
153 ' < "$tmpdepfile" \
|
meillo@0
|
154 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
meillo@0
|
155 tr '
|
meillo@0
|
156 ' ' ' >> $depfile
|
meillo@0
|
157 echo >> $depfile
|
meillo@0
|
158
|
meillo@0
|
159 # The second pass generates a dummy entry for each header file.
|
meillo@0
|
160 tr ' ' '
|
meillo@0
|
161 ' < "$tmpdepfile" \
|
meillo@0
|
162 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
meillo@0
|
163 >> $depfile
|
meillo@0
|
164 else
|
meillo@0
|
165 # The sourcefile does not contain any dependencies, so just
|
meillo@0
|
166 # store a dummy comment line, to avoid errors with the Makefile
|
meillo@0
|
167 # "include basename.Plo" scheme.
|
meillo@0
|
168 echo "#dummy" > "$depfile"
|
meillo@0
|
169 fi
|
meillo@0
|
170 rm -f "$tmpdepfile"
|
meillo@0
|
171 ;;
|
meillo@0
|
172
|
meillo@0
|
173 aix)
|
meillo@0
|
174 # The C for AIX Compiler uses -M and outputs the dependencies
|
meillo@0
|
175 # in a .u file. In older versions, this file always lives in the
|
meillo@0
|
176 # current directory. Also, the AIX compiler puts `$object:' at the
|
meillo@0
|
177 # start of each line; $object doesn't have directory information.
|
meillo@0
|
178 # Version 6 uses the directory in both cases.
|
meillo@0
|
179 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
meillo@0
|
180 tmpdepfile="$stripped.u"
|
meillo@0
|
181 if test "$libtool" = yes; then
|
meillo@0
|
182 "$@" -Wc,-M
|
meillo@0
|
183 else
|
meillo@0
|
184 "$@" -M
|
meillo@0
|
185 fi
|
meillo@0
|
186 stat=$?
|
meillo@0
|
187
|
meillo@0
|
188 if test -f "$tmpdepfile"; then :
|
meillo@0
|
189 else
|
meillo@0
|
190 stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
meillo@0
|
191 tmpdepfile="$stripped.u"
|
meillo@0
|
192 fi
|
meillo@0
|
193
|
meillo@0
|
194 if test $stat -eq 0; then :
|
meillo@0
|
195 else
|
meillo@0
|
196 rm -f "$tmpdepfile"
|
meillo@0
|
197 exit $stat
|
meillo@0
|
198 fi
|
meillo@0
|
199
|
meillo@0
|
200 if test -f "$tmpdepfile"; then
|
meillo@0
|
201 outname="$stripped.o"
|
meillo@0
|
202 # Each line is of the form `foo.o: dependent.h'.
|
meillo@0
|
203 # Do two passes, one to just change these to
|
meillo@0
|
204 # `$object: dependent.h' and one to simply `dependent.h:'.
|
meillo@0
|
205 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
meillo@0
|
206 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
meillo@0
|
207 else
|
meillo@0
|
208 # The sourcefile does not contain any dependencies, so just
|
meillo@0
|
209 # store a dummy comment line, to avoid errors with the Makefile
|
meillo@0
|
210 # "include basename.Plo" scheme.
|
meillo@0
|
211 echo "#dummy" > "$depfile"
|
meillo@0
|
212 fi
|
meillo@0
|
213 rm -f "$tmpdepfile"
|
meillo@0
|
214 ;;
|
meillo@0
|
215
|
meillo@0
|
216 icc)
|
meillo@0
|
217 # Intel's C compiler understands `-MD -MF file'. However on
|
meillo@0
|
218 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
meillo@0
|
219 # ICC 7.0 will fill foo.d with something like
|
meillo@0
|
220 # foo.o: sub/foo.c
|
meillo@0
|
221 # foo.o: sub/foo.h
|
meillo@0
|
222 # which is wrong. We want:
|
meillo@0
|
223 # sub/foo.o: sub/foo.c
|
meillo@0
|
224 # sub/foo.o: sub/foo.h
|
meillo@0
|
225 # sub/foo.c:
|
meillo@0
|
226 # sub/foo.h:
|
meillo@0
|
227 # ICC 7.1 will output
|
meillo@0
|
228 # foo.o: sub/foo.c sub/foo.h
|
meillo@0
|
229 # and will wrap long lines using \ :
|
meillo@0
|
230 # foo.o: sub/foo.c ... \
|
meillo@0
|
231 # sub/foo.h ... \
|
meillo@0
|
232 # ...
|
meillo@0
|
233
|
meillo@0
|
234 "$@" -MD -MF "$tmpdepfile"
|
meillo@0
|
235 stat=$?
|
meillo@0
|
236 if test $stat -eq 0; then :
|
meillo@0
|
237 else
|
meillo@0
|
238 rm -f "$tmpdepfile"
|
meillo@0
|
239 exit $stat
|
meillo@0
|
240 fi
|
meillo@0
|
241 rm -f "$depfile"
|
meillo@0
|
242 # Each line is of the form `foo.o: dependent.h',
|
meillo@0
|
243 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
meillo@0
|
244 # Do two passes, one to just change these to
|
meillo@0
|
245 # `$object: dependent.h' and one to simply `dependent.h:'.
|
meillo@0
|
246 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
meillo@0
|
247 # Some versions of the HPUX 10.20 sed can't process this invocation
|
meillo@0
|
248 # correctly. Breaking it into two sed invocations is a workaround.
|
meillo@0
|
249 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
meillo@0
|
250 sed -e 's/$/ :/' >> "$depfile"
|
meillo@0
|
251 rm -f "$tmpdepfile"
|
meillo@0
|
252 ;;
|
meillo@0
|
253
|
meillo@0
|
254 tru64)
|
meillo@0
|
255 # The Tru64 compiler uses -MD to generate dependencies as a side
|
meillo@0
|
256 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
meillo@0
|
257 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
meillo@0
|
258 # dependencies in `foo.d' instead, so we check for that too.
|
meillo@0
|
259 # Subdirectories are respected.
|
meillo@0
|
260 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
meillo@0
|
261 test "x$dir" = "x$object" && dir=
|
meillo@0
|
262 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
meillo@0
|
263
|
meillo@0
|
264 if test "$libtool" = yes; then
|
meillo@0
|
265 tmpdepfile1="$dir.libs/$base.lo.d"
|
meillo@0
|
266 tmpdepfile2="$dir.libs/$base.d"
|
meillo@0
|
267 "$@" -Wc,-MD
|
meillo@0
|
268 else
|
meillo@0
|
269 tmpdepfile1="$dir$base.o.d"
|
meillo@0
|
270 tmpdepfile2="$dir$base.d"
|
meillo@0
|
271 "$@" -MD
|
meillo@0
|
272 fi
|
meillo@0
|
273
|
meillo@0
|
274 stat=$?
|
meillo@0
|
275 if test $stat -eq 0; then :
|
meillo@0
|
276 else
|
meillo@0
|
277 rm -f "$tmpdepfile1" "$tmpdepfile2"
|
meillo@0
|
278 exit $stat
|
meillo@0
|
279 fi
|
meillo@0
|
280
|
meillo@0
|
281 if test -f "$tmpdepfile1"; then
|
meillo@0
|
282 tmpdepfile="$tmpdepfile1"
|
meillo@0
|
283 else
|
meillo@0
|
284 tmpdepfile="$tmpdepfile2"
|
meillo@0
|
285 fi
|
meillo@0
|
286 if test -f "$tmpdepfile"; then
|
meillo@0
|
287 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
meillo@0
|
288 # That's a tab and a space in the [].
|
meillo@0
|
289 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
meillo@0
|
290 else
|
meillo@0
|
291 echo "#dummy" > "$depfile"
|
meillo@0
|
292 fi
|
meillo@0
|
293 rm -f "$tmpdepfile"
|
meillo@0
|
294 ;;
|
meillo@0
|
295
|
meillo@0
|
296 #nosideeffect)
|
meillo@0
|
297 # This comment above is used by automake to tell side-effect
|
meillo@0
|
298 # dependency tracking mechanisms from slower ones.
|
meillo@0
|
299
|
meillo@0
|
300 dashmstdout)
|
meillo@0
|
301 # Important note: in order to support this mode, a compiler *must*
|
meillo@0
|
302 # always write the preprocessed file to stdout, regardless of -o.
|
meillo@0
|
303 "$@" || exit $?
|
meillo@0
|
304
|
meillo@0
|
305 # Remove the call to Libtool.
|
meillo@0
|
306 if test "$libtool" = yes; then
|
meillo@0
|
307 while test $1 != '--mode=compile'; do
|
meillo@0
|
308 shift
|
meillo@0
|
309 done
|
meillo@0
|
310 shift
|
meillo@0
|
311 fi
|
meillo@0
|
312
|
meillo@0
|
313 # Remove `-o $object'.
|
meillo@0
|
314 IFS=" "
|
meillo@0
|
315 for arg
|
meillo@0
|
316 do
|
meillo@0
|
317 case $arg in
|
meillo@0
|
318 -o)
|
meillo@0
|
319 shift
|
meillo@0
|
320 ;;
|
meillo@0
|
321 $object)
|
meillo@0
|
322 shift
|
meillo@0
|
323 ;;
|
meillo@0
|
324 *)
|
meillo@0
|
325 set fnord "$@" "$arg"
|
meillo@0
|
326 shift # fnord
|
meillo@0
|
327 shift # $arg
|
meillo@0
|
328 ;;
|
meillo@0
|
329 esac
|
meillo@0
|
330 done
|
meillo@0
|
331
|
meillo@0
|
332 test -z "$dashmflag" && dashmflag=-M
|
meillo@0
|
333 # Require at least two characters before searching for `:'
|
meillo@0
|
334 # in the target name. This is to cope with DOS-style filenames:
|
meillo@0
|
335 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
meillo@0
|
336 "$@" $dashmflag |
|
meillo@0
|
337 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
meillo@0
|
338 rm -f "$depfile"
|
meillo@0
|
339 cat < "$tmpdepfile" > "$depfile"
|
meillo@0
|
340 tr ' ' '
|
meillo@0
|
341 ' < "$tmpdepfile" | \
|
meillo@0
|
342 ## Some versions of the HPUX 10.20 sed can't process this invocation
|
meillo@0
|
343 ## correctly. Breaking it into two sed invocations is a workaround.
|
meillo@0
|
344 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
meillo@0
|
345 rm -f "$tmpdepfile"
|
meillo@0
|
346 ;;
|
meillo@0
|
347
|
meillo@0
|
348 dashXmstdout)
|
meillo@0
|
349 # This case only exists to satisfy depend.m4. It is never actually
|
meillo@0
|
350 # run, as this mode is specially recognized in the preamble.
|
meillo@0
|
351 exit 1
|
meillo@0
|
352 ;;
|
meillo@0
|
353
|
meillo@0
|
354 makedepend)
|
meillo@0
|
355 "$@" || exit $?
|
meillo@0
|
356 # Remove any Libtool call
|
meillo@0
|
357 if test "$libtool" = yes; then
|
meillo@0
|
358 while test $1 != '--mode=compile'; do
|
meillo@0
|
359 shift
|
meillo@0
|
360 done
|
meillo@0
|
361 shift
|
meillo@0
|
362 fi
|
meillo@0
|
363 # X makedepend
|
meillo@0
|
364 shift
|
meillo@0
|
365 cleared=no
|
meillo@0
|
366 for arg in "$@"; do
|
meillo@0
|
367 case $cleared in
|
meillo@0
|
368 no)
|
meillo@0
|
369 set ""; shift
|
meillo@0
|
370 cleared=yes ;;
|
meillo@0
|
371 esac
|
meillo@0
|
372 case "$arg" in
|
meillo@0
|
373 -D*|-I*)
|
meillo@0
|
374 set fnord "$@" "$arg"; shift ;;
|
meillo@0
|
375 # Strip any option that makedepend may not understand. Remove
|
meillo@0
|
376 # the object too, otherwise makedepend will parse it as a source file.
|
meillo@0
|
377 -*|$object)
|
meillo@0
|
378 ;;
|
meillo@0
|
379 *)
|
meillo@0
|
380 set fnord "$@" "$arg"; shift ;;
|
meillo@0
|
381 esac
|
meillo@0
|
382 done
|
meillo@0
|
383 obj_suffix="`echo $object | sed 's/^.*\././'`"
|
meillo@0
|
384 touch "$tmpdepfile"
|
meillo@0
|
385 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
meillo@0
|
386 rm -f "$depfile"
|
meillo@0
|
387 cat < "$tmpdepfile" > "$depfile"
|
meillo@0
|
388 sed '1,2d' "$tmpdepfile" | tr ' ' '
|
meillo@0
|
389 ' | \
|
meillo@0
|
390 ## Some versions of the HPUX 10.20 sed can't process this invocation
|
meillo@0
|
391 ## correctly. Breaking it into two sed invocations is a workaround.
|
meillo@0
|
392 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
meillo@0
|
393 rm -f "$tmpdepfile" "$tmpdepfile".bak
|
meillo@0
|
394 ;;
|
meillo@0
|
395
|
meillo@0
|
396 cpp)
|
meillo@0
|
397 # Important note: in order to support this mode, a compiler *must*
|
meillo@0
|
398 # always write the preprocessed file to stdout.
|
meillo@0
|
399 "$@" || exit $?
|
meillo@0
|
400
|
meillo@0
|
401 # Remove the call to Libtool.
|
meillo@0
|
402 if test "$libtool" = yes; then
|
meillo@0
|
403 while test $1 != '--mode=compile'; do
|
meillo@0
|
404 shift
|
meillo@0
|
405 done
|
meillo@0
|
406 shift
|
meillo@0
|
407 fi
|
meillo@0
|
408
|
meillo@0
|
409 # Remove `-o $object'.
|
meillo@0
|
410 IFS=" "
|
meillo@0
|
411 for arg
|
meillo@0
|
412 do
|
meillo@0
|
413 case $arg in
|
meillo@0
|
414 -o)
|
meillo@0
|
415 shift
|
meillo@0
|
416 ;;
|
meillo@0
|
417 $object)
|
meillo@0
|
418 shift
|
meillo@0
|
419 ;;
|
meillo@0
|
420 *)
|
meillo@0
|
421 set fnord "$@" "$arg"
|
meillo@0
|
422 shift # fnord
|
meillo@0
|
423 shift # $arg
|
meillo@0
|
424 ;;
|
meillo@0
|
425 esac
|
meillo@0
|
426 done
|
meillo@0
|
427
|
meillo@0
|
428 "$@" -E |
|
meillo@0
|
429 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
meillo@0
|
430 sed '$ s: \\$::' > "$tmpdepfile"
|
meillo@0
|
431 rm -f "$depfile"
|
meillo@0
|
432 echo "$object : \\" > "$depfile"
|
meillo@0
|
433 cat < "$tmpdepfile" >> "$depfile"
|
meillo@0
|
434 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
meillo@0
|
435 rm -f "$tmpdepfile"
|
meillo@0
|
436 ;;
|
meillo@0
|
437
|
meillo@0
|
438 msvisualcpp)
|
meillo@0
|
439 # Important note: in order to support this mode, a compiler *must*
|
meillo@0
|
440 # always write the preprocessed file to stdout, regardless of -o,
|
meillo@0
|
441 # because we must use -o when running libtool.
|
meillo@0
|
442 "$@" || exit $?
|
meillo@0
|
443 IFS=" "
|
meillo@0
|
444 for arg
|
meillo@0
|
445 do
|
meillo@0
|
446 case "$arg" in
|
meillo@0
|
447 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
meillo@0
|
448 set fnord "$@"
|
meillo@0
|
449 shift
|
meillo@0
|
450 shift
|
meillo@0
|
451 ;;
|
meillo@0
|
452 *)
|
meillo@0
|
453 set fnord "$@" "$arg"
|
meillo@0
|
454 shift
|
meillo@0
|
455 shift
|
meillo@0
|
456 ;;
|
meillo@0
|
457 esac
|
meillo@0
|
458 done
|
meillo@0
|
459 "$@" -E |
|
meillo@0
|
460 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
meillo@0
|
461 rm -f "$depfile"
|
meillo@0
|
462 echo "$object : \\" > "$depfile"
|
meillo@0
|
463 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
meillo@0
|
464 echo " " >> "$depfile"
|
meillo@0
|
465 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
meillo@0
|
466 rm -f "$tmpdepfile"
|
meillo@0
|
467 ;;
|
meillo@0
|
468
|
meillo@0
|
469 none)
|
meillo@0
|
470 exec "$@"
|
meillo@0
|
471 ;;
|
meillo@0
|
472
|
meillo@0
|
473 *)
|
meillo@0
|
474 echo "Unknown depmode $depmode" 1>&2
|
meillo@0
|
475 exit 1
|
meillo@0
|
476 ;;
|
meillo@0
|
477 esac
|
meillo@0
|
478
|
meillo@0
|
479 exit 0
|