32
32
# `libtool' can also be set to `yes' or `no'.
34
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
34
if test -z "$depfile"; then
35
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
36
dir=`echo "$object" | sed 's,/.*$,/,'`
37
if test "$dir" = "$object"; then
40
# FIXME: should be _deps on DOS.
41
depfile="$dir.deps/$base"
35
44
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
37
46
rm -f "$tmpdepfile"
197
206
rm -f "$tmpdepfile"
210
# Intel's C compiler understands `-MD -MF file'. However on
211
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
212
# ICC 7.0 will fill foo.d with something like
215
# which is wrong. We want:
216
# sub/foo.o: sub/foo.c
217
# sub/foo.o: sub/foo.h
220
# ICC 7.1 will output
221
# foo.o: sub/foo.c sub/foo.h
222
# and will wrap long lines using \ :
223
# foo.o: sub/foo.c ... \
227
"$@" -MD -MF "$tmpdepfile"
229
if test $stat -eq 0; then :
235
# Each line is of the form `foo.o: dependent.h',
236
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
237
# Do two passes, one to just change these to
238
# `$object: dependent.h' and one to simply `dependent.h:'.
239
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
240
# Some versions of the HPUX 10.20 sed can't process this invocation
241
# correctly. Breaking it into two sed invocations is a workaround.
242
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
243
sed -e 's/$/ :/' >> "$depfile"
201
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
248
# The Tru64 compiler uses -MD to generate dependencies as a side
202
249
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
203
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
250
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
204
251
# dependencies in `foo.d' instead, so we check for that too.
205
252
# Subdirectories are respected.
253
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
254
test "x$dir" = "x$object" && dir=
255
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
207
tmpdepfile1="$object.d"
208
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
209
257
if test "$libtool" = yes; then
258
tmpdepfile1="$dir.libs/$base.lo.d"
259
tmpdepfile2="$dir.libs/$base.d"
262
tmpdepfile1="$dir$base.o.d"
263
tmpdepfile2="$dir$base.d"
242
294
# Important note: in order to support this mode, a compiler *must*
243
# always write the proprocessed file to stdout, regardless of -o,
244
# because we must use -o when running libtool.
295
# always write the proprocessed file to stdout, regardless of -o.
298
# Remove the call to Libtool.
299
if test "$libtool" = yes; then
300
while test $1 != '--mode=compile'; do
306
# Remove `-o $object'.
318
set fnord "$@" "$arg"
245
325
test -z "$dashmflag" && dashmflag=-M
248
*" --mode=compile "*) # this is libtool, let us make it quiet
250
do # cycle over the arguments
253
# insert --quiet before "--mode=compile"
254
set fnord "$@" --quiet
258
set fnord "$@" "$arg"
264
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
270
if test "$stat" != 0; then exit $stat; fi
326
# Require at least two characters before searching for `:'
327
# in the target name. This is to cope with DOS-style filenames:
328
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
330
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
272
332
cat < "$tmpdepfile" > "$depfile"
349
# Remove any Libtool call
350
if test "$libtool" = yes; then
351
while test $1 != '--mode=compile'; do
299
set fnord "$@" "$arg"; shift;;
303
set fnord "$@" "$arg"; shift;;
306
obj_suffix="`echo $object | sed 's/^.*\././'`"
308
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
314
if test "$stat" != 0; then exit $stat; fi
367
set fnord "$@" "$arg"; shift ;;
368
# Strip any option that makedepend may not understand. Remove
369
# the object too, otherwise makedepend will parse it as a source file.
373
set fnord "$@" "$arg"; shift ;;
376
obj_suffix="`echo $object | sed 's/^.*\././'`"
378
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
316
380
cat < "$tmpdepfile" > "$depfile"
317
tail +3 "$tmpdepfile" | tr ' ' '
381
sed '1,2d' "$tmpdepfile" | tr ' ' '
319
383
## Some versions of the HPUX 10.20 sed can't process this invocation
320
384
## correctly. Breaking it into two sed invocations is a workaround.
326
390
# Important note: in order to support this mode, a compiler *must*
327
# always write the proprocessed file to stdout, regardless of -o,
328
# because we must use -o when running libtool.
331
*" --mode=compile "*)
333
do # cycle over the arguments
336
# insert --quiet before "--mode=compile"
337
set fnord "$@" --quiet
341
set fnord "$@" "$arg"
391
# always write the proprocessed file to stdout.
394
# Remove the call to Libtool.
395
if test "$libtool" = yes; then
396
while test $1 != '--mode=compile'; do
402
# Remove `-o $object'.
414
set fnord "$@" "$arg"
348
422
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
349
423
sed '$ s: \\$::' > "$tmpdepfile"
355
if test "$stat" != 0; then exit $stat; fi
357
425
echo "$object : \\" > "$depfile"
358
426
cat < "$tmpdepfile" >> "$depfile"
364
432
# Important note: in order to support this mode, a compiler *must*
365
433
# always write the proprocessed file to stdout, regardless of -o,
366
434
# because we must use -o when running libtool.
369
*" --mode=compile "*)
371
do # cycle over the arguments
374
# insert --quiet before "--mode=compile"
375
set fnord "$@" --quiet
440
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
379
446
set fnord "$@" "$arg"
386
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
392
if test "$stat" != 0; then exit $stat; fi
453
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
394
455
echo "$object : \\" > "$depfile"
395
456
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"