Mercurial > urweb
comparison depcomp @ 1826:6a621a625b04
New release
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 25 Sep 2012 08:16:58 -0400 |
parents | 40557fb08e98 |
children |
comparison
equal
deleted
inserted
replaced
1825:52c291b05738 | 1826:6a621a625b04 |
---|---|
1 #! /bin/sh | 1 #! /bin/sh |
2 # depcomp - compile a program generating dependencies as side-effects | 2 # depcomp - compile a program generating dependencies as side-effects |
3 | 3 |
4 scriptversion=2012-03-27.16; # UTC | 4 scriptversion=2009-04-28.21; # UTC |
5 | 5 |
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, | 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free |
7 # 2011, 2012 Free Software Foundation, Inc. | 7 # Software Foundation, Inc. |
8 | 8 |
9 # This program is free software; you can redistribute it and/or modify | 9 # This program is free software; you can redistribute it and/or modify |
10 # it under the terms of the GNU General Public License as published by | 10 # it under the terms of the GNU General Public License as published by |
11 # the Free Software Foundation; either version 2, or (at your option) | 11 # the Free Software Foundation; either version 2, or (at your option) |
12 # any later version. | 12 # any later version. |
26 | 26 |
27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. | 27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. |
28 | 28 |
29 case $1 in | 29 case $1 in |
30 '') | 30 '') |
31 echo "$0: No command. Try '$0 --help' for more information." 1>&2 | 31 echo "$0: No command. Try \`$0 --help' for more information." 1>&2 |
32 exit 1; | 32 exit 1; |
33 ;; | 33 ;; |
34 -h | --h*) | 34 -h | --h*) |
35 cat <<\EOF | 35 cat <<\EOF |
36 Usage: depcomp [--help] [--version] PROGRAM [ARGS] | 36 Usage: depcomp [--help] [--version] PROGRAM [ARGS] |
38 Run PROGRAMS ARGS to compile a file, generating dependencies | 38 Run PROGRAMS ARGS to compile a file, generating dependencies |
39 as side-effects. | 39 as side-effects. |
40 | 40 |
41 Environment variables: | 41 Environment variables: |
42 depmode Dependency tracking mode. | 42 depmode Dependency tracking mode. |
43 source Source file read by 'PROGRAMS ARGS'. | 43 source Source file read by `PROGRAMS ARGS'. |
44 object Object file output by 'PROGRAMS ARGS'. | 44 object Object file output by `PROGRAMS ARGS'. |
45 DEPDIR directory where to store dependencies. | 45 DEPDIR directory where to store dependencies. |
46 depfile Dependency file to output. | 46 depfile Dependency file to output. |
47 tmpdepfile Temporary file to use when outputting dependencies. | 47 tmpdepfile Temporary file to use when outputing dependencies. |
48 libtool Whether libtool is used (yes/no). | 48 libtool Whether libtool is used (yes/no). |
49 | 49 |
50 Report bugs to <bug-automake@gnu.org>. | 50 Report bugs to <bug-automake@gnu.org>. |
51 EOF | 51 EOF |
52 exit $? | 52 exit $? |
55 echo "depcomp $scriptversion" | 55 echo "depcomp $scriptversion" |
56 exit $? | 56 exit $? |
57 ;; | 57 ;; |
58 esac | 58 esac |
59 | 59 |
60 # A tabulation character. | |
61 tab=' ' | |
62 # A newline character. | |
63 nl=' | |
64 ' | |
65 | |
66 if test -z "$depmode" || test -z "$source" || test -z "$object"; then | 60 if test -z "$depmode" || test -z "$source" || test -z "$object"; then |
67 echo "depcomp: Variables source, object and depmode must be set" 1>&2 | 61 echo "depcomp: Variables source, object and depmode must be set" 1>&2 |
68 exit 1 | 62 exit 1 |
69 fi | 63 fi |
70 | 64 |
94 cygpath_u="cygpath -u -f -" | 88 cygpath_u="cygpath -u -f -" |
95 if test "$depmode" = msvcmsys; then | 89 if test "$depmode" = msvcmsys; then |
96 # This is just like msvisualcpp but w/o cygpath translation. | 90 # This is just like msvisualcpp but w/o cygpath translation. |
97 # Just convert the backslash-escaped backslashes to single forward | 91 # Just convert the backslash-escaped backslashes to single forward |
98 # slashes to satisfy depend.m4 | 92 # slashes to satisfy depend.m4 |
99 cygpath_u='sed s,\\\\,/,g' | 93 cygpath_u="sed s,\\\\\\\\,/,g" |
100 depmode=msvisualcpp | 94 depmode=msvisualcpp |
101 fi | |
102 | |
103 if test "$depmode" = msvc7msys; then | |
104 # This is just like msvc7 but w/o cygpath translation. | |
105 # Just convert the backslash-escaped backslashes to single forward | |
106 # slashes to satisfy depend.m4 | |
107 cygpath_u='sed s,\\\\,/,g' | |
108 depmode=msvc7 | |
109 fi | |
110 | |
111 if test "$depmode" = xlc; then | |
112 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. | |
113 gccflag=-qmakedep=gcc,-MF | |
114 depmode=gcc | |
115 fi | 95 fi |
116 | 96 |
117 case "$depmode" in | 97 case "$depmode" in |
118 gcc3) | 98 gcc3) |
119 ## gcc 3 implements dependency tracking that does exactly what | 99 ## gcc 3 implements dependency tracking that does exactly what |
166 echo "$object : \\" > "$depfile" | 146 echo "$object : \\" > "$depfile" |
167 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz | 147 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz |
168 ## The second -e expression handles DOS-style file names with drive letters. | 148 ## The second -e expression handles DOS-style file names with drive letters. |
169 sed -e 's/^[^:]*: / /' \ | 149 sed -e 's/^[^:]*: / /' \ |
170 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" | 150 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" |
171 ## This next piece of magic avoids the "deleted header file" problem. | 151 ## This next piece of magic avoids the `deleted header file' problem. |
172 ## The problem is that when a header file which appears in a .P file | 152 ## The problem is that when a header file which appears in a .P file |
173 ## is deleted, the dependency causes make to die (because there is | 153 ## is deleted, the dependency causes make to die (because there is |
174 ## typically no way to rebuild the header). We avoid this by adding | 154 ## typically no way to rebuild the header). We avoid this by adding |
175 ## dummy dependencies for each header file. Too bad gcc doesn't do | 155 ## dummy dependencies for each header file. Too bad gcc doesn't do |
176 ## this for us directly. | 156 ## this for us directly. |
177 tr ' ' "$nl" < "$tmpdepfile" | | 157 tr ' ' ' |
178 ## Some versions of gcc put a space before the ':'. On the theory | 158 ' < "$tmpdepfile" | |
159 ## Some versions of gcc put a space before the `:'. On the theory | |
179 ## that the space means something, we add a space to the output as | 160 ## that the space means something, we add a space to the output as |
180 ## well. hp depmode also adds that space, but also prefixes the VPATH | 161 ## well. |
181 ## to the object. Take care to not repeat it in the output. | |
182 ## Some versions of the HPUX 10.20 sed can't process this invocation | 162 ## Some versions of the HPUX 10.20 sed can't process this invocation |
183 ## correctly. Breaking it into two sed invocations is a workaround. | 163 ## correctly. Breaking it into two sed invocations is a workaround. |
184 sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | 164 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
185 | sed -e 's/$/ :/' >> "$depfile" | |
186 rm -f "$tmpdepfile" | 165 rm -f "$tmpdepfile" |
187 ;; | 166 ;; |
188 | 167 |
189 hp) | 168 hp) |
190 # This case exists only to let depend.m4 do its work. It works by | 169 # This case exists only to let depend.m4 do its work. It works by |
212 | 191 |
213 # Clip off the initial element (the dependent). Don't try to be | 192 # Clip off the initial element (the dependent). Don't try to be |
214 # clever and replace this with sed code, as IRIX sed won't handle | 193 # clever and replace this with sed code, as IRIX sed won't handle |
215 # lines with more than a fixed number of characters (4096 in | 194 # lines with more than a fixed number of characters (4096 in |
216 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; | 195 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; |
217 # the IRIX cc adds comments like '#:fec' to the end of the | 196 # the IRIX cc adds comments like `#:fec' to the end of the |
218 # dependency line. | 197 # dependency line. |
219 tr ' ' "$nl" < "$tmpdepfile" \ | 198 tr ' ' ' |
199 ' < "$tmpdepfile" \ | |
220 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ | 200 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ |
221 tr "$nl" ' ' >> "$depfile" | 201 tr ' |
202 ' ' ' >> "$depfile" | |
222 echo >> "$depfile" | 203 echo >> "$depfile" |
223 | 204 |
224 # The second pass generates a dummy entry for each header file. | 205 # The second pass generates a dummy entry for each header file. |
225 tr ' ' "$nl" < "$tmpdepfile" \ | 206 tr ' ' ' |
207 ' < "$tmpdepfile" \ | |
226 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ | 208 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ |
227 >> "$depfile" | 209 >> "$depfile" |
228 else | 210 else |
229 # The sourcefile does not contain any dependencies, so just | 211 # The sourcefile does not contain any dependencies, so just |
230 # store a dummy comment line, to avoid errors with the Makefile | 212 # store a dummy comment line, to avoid errors with the Makefile |
232 echo "#dummy" > "$depfile" | 214 echo "#dummy" > "$depfile" |
233 fi | 215 fi |
234 rm -f "$tmpdepfile" | 216 rm -f "$tmpdepfile" |
235 ;; | 217 ;; |
236 | 218 |
237 xlc) | |
238 # This case exists only to let depend.m4 do its work. It works by | |
239 # looking at the text of this script. This case will never be run, | |
240 # since it is checked for above. | |
241 exit 1 | |
242 ;; | |
243 | |
244 aix) | 219 aix) |
245 # The C for AIX Compiler uses -M and outputs the dependencies | 220 # The C for AIX Compiler uses -M and outputs the dependencies |
246 # in a .u file. In older versions, this file always lives in the | 221 # in a .u file. In older versions, this file always lives in the |
247 # current directory. Also, the AIX compiler puts '$object:' at the | 222 # current directory. Also, the AIX compiler puts `$object:' at the |
248 # start of each line; $object doesn't have directory information. | 223 # start of each line; $object doesn't have directory information. |
249 # Version 6 uses the directory in both cases. | 224 # Version 6 uses the directory in both cases. |
250 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 225 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
251 test "x$dir" = "x$object" && dir= | 226 test "x$dir" = "x$object" && dir= |
252 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | 227 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
272 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" | 247 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
273 do | 248 do |
274 test -f "$tmpdepfile" && break | 249 test -f "$tmpdepfile" && break |
275 done | 250 done |
276 if test -f "$tmpdepfile"; then | 251 if test -f "$tmpdepfile"; then |
277 # Each line is of the form 'foo.o: dependent.h'. | 252 # Each line is of the form `foo.o: dependent.h'. |
278 # Do two passes, one to just change these to | 253 # Do two passes, one to just change these to |
279 # '$object: dependent.h' and one to simply 'dependent.h:'. | 254 # `$object: dependent.h' and one to simply `dependent.h:'. |
280 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" | 255 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
281 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | 256 # That's a tab and a space in the []. |
257 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
282 else | 258 else |
283 # The sourcefile does not contain any dependencies, so just | 259 # The sourcefile does not contain any dependencies, so just |
284 # store a dummy comment line, to avoid errors with the Makefile | 260 # store a dummy comment line, to avoid errors with the Makefile |
285 # "include basename.Plo" scheme. | 261 # "include basename.Plo" scheme. |
286 echo "#dummy" > "$depfile" | 262 echo "#dummy" > "$depfile" |
287 fi | 263 fi |
288 rm -f "$tmpdepfile" | 264 rm -f "$tmpdepfile" |
289 ;; | 265 ;; |
290 | 266 |
291 icc) | 267 icc) |
292 # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. | 268 # Intel's C compiler understands `-MD -MF file'. However on |
293 # However on | 269 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c |
294 # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c | |
295 # ICC 7.0 will fill foo.d with something like | 270 # ICC 7.0 will fill foo.d with something like |
296 # foo.o: sub/foo.c | 271 # foo.o: sub/foo.c |
297 # foo.o: sub/foo.h | 272 # foo.o: sub/foo.h |
298 # which is wrong. We want | 273 # which is wrong. We want: |
299 # sub/foo.o: sub/foo.c | 274 # sub/foo.o: sub/foo.c |
300 # sub/foo.o: sub/foo.h | 275 # sub/foo.o: sub/foo.h |
301 # sub/foo.c: | 276 # sub/foo.c: |
302 # sub/foo.h: | 277 # sub/foo.h: |
303 # ICC 7.1 will output | 278 # ICC 7.1 will output |
304 # foo.o: sub/foo.c sub/foo.h | 279 # foo.o: sub/foo.c sub/foo.h |
305 # and will wrap long lines using '\': | 280 # and will wrap long lines using \ : |
306 # foo.o: sub/foo.c ... \ | 281 # foo.o: sub/foo.c ... \ |
307 # sub/foo.h ... \ | 282 # sub/foo.h ... \ |
308 # ... | 283 # ... |
309 # tcc 0.9.26 (FIXME still under development at the moment of writing) | 284 |
310 # will emit a similar output, but also prepend the continuation lines | |
311 # with horizontal tabulation characters. | |
312 "$@" -MD -MF "$tmpdepfile" | 285 "$@" -MD -MF "$tmpdepfile" |
313 stat=$? | 286 stat=$? |
314 if test $stat -eq 0; then : | 287 if test $stat -eq 0; then : |
315 else | 288 else |
316 rm -f "$tmpdepfile" | 289 rm -f "$tmpdepfile" |
317 exit $stat | 290 exit $stat |
318 fi | 291 fi |
319 rm -f "$depfile" | 292 rm -f "$depfile" |
320 # Each line is of the form 'foo.o: dependent.h', | 293 # Each line is of the form `foo.o: dependent.h', |
321 # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. | 294 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. |
322 # Do two passes, one to just change these to | 295 # Do two passes, one to just change these to |
323 # '$object: dependent.h' and one to simply 'dependent.h:'. | 296 # `$object: dependent.h' and one to simply `dependent.h:'. |
324 sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ | 297 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" |
325 < "$tmpdepfile" > "$depfile" | 298 # Some versions of the HPUX 10.20 sed can't process this invocation |
326 sed ' | 299 # correctly. Breaking it into two sed invocations is a workaround. |
327 s/[ '"$tab"'][ '"$tab"']*/ /g | 300 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | |
328 s/^ *// | 301 sed -e 's/$/ :/' >> "$depfile" |
329 s/ *\\*$// | |
330 s/^[^:]*: *// | |
331 /^$/d | |
332 /:$/d | |
333 s/$/ :/ | |
334 ' < "$tmpdepfile" >> "$depfile" | |
335 rm -f "$tmpdepfile" | 302 rm -f "$tmpdepfile" |
336 ;; | 303 ;; |
337 | 304 |
338 hp2) | 305 hp2) |
339 # The "hp" stanza above does not work with aCC (C++) and HP's ia64 | 306 # The "hp" stanza above does not work with aCC (C++) and HP's ia64 |
365 do | 332 do |
366 test -f "$tmpdepfile" && break | 333 test -f "$tmpdepfile" && break |
367 done | 334 done |
368 if test -f "$tmpdepfile"; then | 335 if test -f "$tmpdepfile"; then |
369 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" | 336 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" |
370 # Add 'dependent.h:' lines. | 337 # Add `dependent.h:' lines. |
371 sed -ne '2,${ | 338 sed -ne '2,${ |
372 s/^ *// | 339 s/^ *// |
373 s/ \\*$// | 340 s/ \\*$// |
374 s/$/:/ | 341 s/$/:/ |
375 p | 342 p |
380 rm -f "$tmpdepfile" "$tmpdepfile2" | 347 rm -f "$tmpdepfile" "$tmpdepfile2" |
381 ;; | 348 ;; |
382 | 349 |
383 tru64) | 350 tru64) |
384 # The Tru64 compiler uses -MD to generate dependencies as a side | 351 # The Tru64 compiler uses -MD to generate dependencies as a side |
385 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. | 352 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. |
386 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put | 353 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put |
387 # dependencies in 'foo.d' instead, so we check for that too. | 354 # dependencies in `foo.d' instead, so we check for that too. |
388 # Subdirectories are respected. | 355 # Subdirectories are respected. |
389 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 356 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
390 test "x$dir" = "x$object" && dir= | 357 test "x$dir" = "x$object" && dir= |
391 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | 358 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
392 | 359 |
428 do | 395 do |
429 test -f "$tmpdepfile" && break | 396 test -f "$tmpdepfile" && break |
430 done | 397 done |
431 if test -f "$tmpdepfile"; then | 398 if test -f "$tmpdepfile"; then |
432 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" | 399 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
433 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | 400 # That's a tab and a space in the []. |
401 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
434 else | 402 else |
435 echo "#dummy" > "$depfile" | 403 echo "#dummy" > "$depfile" |
436 fi | 404 fi |
437 rm -f "$tmpdepfile" | 405 rm -f "$tmpdepfile" |
438 ;; | 406 ;; |
439 | 407 |
440 msvc7) | |
441 if test "$libtool" = yes; then | |
442 showIncludes=-Wc,-showIncludes | |
443 else | |
444 showIncludes=-showIncludes | |
445 fi | |
446 "$@" $showIncludes > "$tmpdepfile" | |
447 stat=$? | |
448 grep -v '^Note: including file: ' "$tmpdepfile" | |
449 if test "$stat" = 0; then : | |
450 else | |
451 rm -f "$tmpdepfile" | |
452 exit $stat | |
453 fi | |
454 rm -f "$depfile" | |
455 echo "$object : \\" > "$depfile" | |
456 # The first sed program below extracts the file names and escapes | |
457 # backslashes for cygpath. The second sed program outputs the file | |
458 # name when reading, but also accumulates all include files in the | |
459 # hold buffer in order to output them again at the end. This only | |
460 # works with sed implementations that can handle large buffers. | |
461 sed < "$tmpdepfile" -n ' | |
462 /^Note: including file: *\(.*\)/ { | |
463 s//\1/ | |
464 s/\\/\\\\/g | |
465 p | |
466 }' | $cygpath_u | sort -u | sed -n ' | |
467 s/ /\\ /g | |
468 s/\(.*\)/'"$tab"'\1 \\/p | |
469 s/.\(.*\) \\/\1:/ | |
470 H | |
471 $ { | |
472 s/.*/'"$tab"'/ | |
473 G | |
474 p | |
475 }' >> "$depfile" | |
476 rm -f "$tmpdepfile" | |
477 ;; | |
478 | |
479 msvc7msys) | |
480 # This case exists only to let depend.m4 do its work. It works by | |
481 # looking at the text of this script. This case will never be run, | |
482 # since it is checked for above. | |
483 exit 1 | |
484 ;; | |
485 | |
486 #nosideeffect) | 408 #nosideeffect) |
487 # This comment above is used by automake to tell side-effect | 409 # This comment above is used by automake to tell side-effect |
488 # dependency tracking mechanisms from slower ones. | 410 # dependency tracking mechanisms from slower ones. |
489 | 411 |
490 dashmstdout) | 412 dashmstdout) |
498 shift | 420 shift |
499 done | 421 done |
500 shift | 422 shift |
501 fi | 423 fi |
502 | 424 |
503 # Remove '-o $object'. | 425 # Remove `-o $object'. |
504 IFS=" " | 426 IFS=" " |
505 for arg | 427 for arg |
506 do | 428 do |
507 case $arg in | 429 case $arg in |
508 -o) | 430 -o) |
518 ;; | 440 ;; |
519 esac | 441 esac |
520 done | 442 done |
521 | 443 |
522 test -z "$dashmflag" && dashmflag=-M | 444 test -z "$dashmflag" && dashmflag=-M |
523 # Require at least two characters before searching for ':' | 445 # Require at least two characters before searching for `:' |
524 # in the target name. This is to cope with DOS-style filenames: | 446 # in the target name. This is to cope with DOS-style filenames: |
525 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. | 447 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. |
526 "$@" $dashmflag | | 448 "$@" $dashmflag | |
527 sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" | 449 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" |
528 rm -f "$depfile" | 450 rm -f "$depfile" |
529 cat < "$tmpdepfile" > "$depfile" | 451 cat < "$tmpdepfile" > "$depfile" |
530 tr ' ' "$nl" < "$tmpdepfile" | \ | 452 tr ' ' ' |
453 ' < "$tmpdepfile" | \ | |
531 ## Some versions of the HPUX 10.20 sed can't process this invocation | 454 ## Some versions of the HPUX 10.20 sed can't process this invocation |
532 ## correctly. Breaking it into two sed invocations is a workaround. | 455 ## correctly. Breaking it into two sed invocations is a workaround. |
533 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 456 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
534 rm -f "$tmpdepfile" | 457 rm -f "$tmpdepfile" |
535 ;; | 458 ;; |
578 done | 501 done |
579 obj_suffix=`echo "$object" | sed 's/^.*\././'` | 502 obj_suffix=`echo "$object" | sed 's/^.*\././'` |
580 touch "$tmpdepfile" | 503 touch "$tmpdepfile" |
581 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" | 504 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" |
582 rm -f "$depfile" | 505 rm -f "$depfile" |
583 # makedepend may prepend the VPATH from the source file name to the object. | 506 cat < "$tmpdepfile" > "$depfile" |
584 # No need to regex-escape $object, excess matching of '.' is harmless. | 507 sed '1,2d' "$tmpdepfile" | tr ' ' ' |
585 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" | 508 ' | \ |
586 sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ | |
587 ## Some versions of the HPUX 10.20 sed can't process this invocation | 509 ## Some versions of the HPUX 10.20 sed can't process this invocation |
588 ## correctly. Breaking it into two sed invocations is a workaround. | 510 ## correctly. Breaking it into two sed invocations is a workaround. |
589 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 511 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
590 rm -f "$tmpdepfile" "$tmpdepfile".bak | 512 rm -f "$tmpdepfile" "$tmpdepfile".bak |
591 ;; | 513 ;; |
601 shift | 523 shift |
602 done | 524 done |
603 shift | 525 shift |
604 fi | 526 fi |
605 | 527 |
606 # Remove '-o $object'. | 528 # Remove `-o $object'. |
607 IFS=" " | 529 IFS=" " |
608 for arg | 530 for arg |
609 do | 531 do |
610 case $arg in | 532 case $arg in |
611 -o) | 533 -o) |
670 done | 592 done |
671 "$@" -E 2>/dev/null | | 593 "$@" -E 2>/dev/null | |
672 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" | 594 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" |
673 rm -f "$depfile" | 595 rm -f "$depfile" |
674 echo "$object : \\" > "$depfile" | 596 echo "$object : \\" > "$depfile" |
675 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" | 597 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" |
676 echo "$tab" >> "$depfile" | 598 echo " " >> "$depfile" |
677 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" | 599 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" |
678 rm -f "$tmpdepfile" | 600 rm -f "$tmpdepfile" |
679 ;; | 601 ;; |
680 | 602 |
681 msvcmsys) | 603 msvcmsys) |