Mercurial > urweb
comparison depcomp @ 1693:27d68ccb2c9e
New release
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 10 Mar 2012 13:13:15 -0500 |
parents | 482815817e99 |
children | 40557fb08e98 |
comparison
equal
deleted
inserted
replaced
1692:a1a1d66aebac | 1693:27d68ccb2c9e |
---|---|
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=2009-04-28.21; # UTC | 4 scriptversion=2011-12-04.11; # UTC |
5 | 5 |
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free | 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, |
7 # Software Foundation, Inc. | 7 # 2011 Free 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. |
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 outputing dependencies. | 47 tmpdepfile Temporary file to use when outputting 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 $? |
88 cygpath_u="cygpath -u -f -" | 88 cygpath_u="cygpath -u -f -" |
89 if test "$depmode" = msvcmsys; then | 89 if test "$depmode" = msvcmsys; then |
90 # This is just like msvisualcpp but w/o cygpath translation. | 90 # This is just like msvisualcpp but w/o cygpath translation. |
91 # Just convert the backslash-escaped backslashes to single forward | 91 # Just convert the backslash-escaped backslashes to single forward |
92 # slashes to satisfy depend.m4 | 92 # slashes to satisfy depend.m4 |
93 cygpath_u="sed s,\\\\\\\\,/,g" | 93 cygpath_u='sed s,\\\\,/,g' |
94 depmode=msvisualcpp | 94 depmode=msvisualcpp |
95 fi | |
96 | |
97 if test "$depmode" = msvc7msys; then | |
98 # This is just like msvc7 but w/o cygpath translation. | |
99 # Just convert the backslash-escaped backslashes to single forward | |
100 # slashes to satisfy depend.m4 | |
101 cygpath_u='sed s,\\\\,/,g' | |
102 depmode=msvc7 | |
95 fi | 103 fi |
96 | 104 |
97 case "$depmode" in | 105 case "$depmode" in |
98 gcc3) | 106 gcc3) |
99 ## gcc 3 implements dependency tracking that does exactly what | 107 ## gcc 3 implements dependency tracking that does exactly what |
156 ## this for us directly. | 164 ## this for us directly. |
157 tr ' ' ' | 165 tr ' ' ' |
158 ' < "$tmpdepfile" | | 166 ' < "$tmpdepfile" | |
159 ## Some versions of gcc put a space before the `:'. On the theory | 167 ## Some versions of gcc put a space before the `:'. On the theory |
160 ## that the space means something, we add a space to the output as | 168 ## that the space means something, we add a space to the output as |
161 ## well. | 169 ## well. hp depmode also adds that space, but also prefixes the VPATH |
170 ## to the object. Take care to not repeat it in the output. | |
162 ## Some versions of the HPUX 10.20 sed can't process this invocation | 171 ## Some versions of the HPUX 10.20 sed can't process this invocation |
163 ## correctly. Breaking it into two sed invocations is a workaround. | 172 ## correctly. Breaking it into two sed invocations is a workaround. |
164 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 173 sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ |
174 | sed -e 's/$/ :/' >> "$depfile" | |
165 rm -f "$tmpdepfile" | 175 rm -f "$tmpdepfile" |
166 ;; | 176 ;; |
167 | 177 |
168 hp) | 178 hp) |
169 # This case exists only to let depend.m4 do its work. It works by | 179 # This case exists only to let depend.m4 do its work. It works by |
403 echo "#dummy" > "$depfile" | 413 echo "#dummy" > "$depfile" |
404 fi | 414 fi |
405 rm -f "$tmpdepfile" | 415 rm -f "$tmpdepfile" |
406 ;; | 416 ;; |
407 | 417 |
418 msvc7) | |
419 if test "$libtool" = yes; then | |
420 showIncludes=-Wc,-showIncludes | |
421 else | |
422 showIncludes=-showIncludes | |
423 fi | |
424 "$@" $showIncludes > "$tmpdepfile" | |
425 stat=$? | |
426 grep -v '^Note: including file: ' "$tmpdepfile" | |
427 if test "$stat" = 0; then : | |
428 else | |
429 rm -f "$tmpdepfile" | |
430 exit $stat | |
431 fi | |
432 rm -f "$depfile" | |
433 echo "$object : \\" > "$depfile" | |
434 # The first sed program below extracts the file names and escapes | |
435 # backslashes for cygpath. The second sed program outputs the file | |
436 # name when reading, but also accumulates all include files in the | |
437 # hold buffer in order to output them again at the end. This only | |
438 # works with sed implementations that can handle large buffers. | |
439 sed < "$tmpdepfile" -n ' | |
440 /^Note: including file: *\(.*\)/ { | |
441 s//\1/ | |
442 s/\\/\\\\/g | |
443 p | |
444 }' | $cygpath_u | sort -u | sed -n ' | |
445 s/ /\\ /g | |
446 s/\(.*\)/ \1 \\/p | |
447 s/.\(.*\) \\/\1:/ | |
448 H | |
449 $ { | |
450 s/.*/ / | |
451 G | |
452 p | |
453 }' >> "$depfile" | |
454 rm -f "$tmpdepfile" | |
455 ;; | |
456 | |
457 msvc7msys) | |
458 # This case exists only to let depend.m4 do its work. It works by | |
459 # looking at the text of this script. This case will never be run, | |
460 # since it is checked for above. | |
461 exit 1 | |
462 ;; | |
463 | |
408 #nosideeffect) | 464 #nosideeffect) |
409 # This comment above is used by automake to tell side-effect | 465 # This comment above is used by automake to tell side-effect |
410 # dependency tracking mechanisms from slower ones. | 466 # dependency tracking mechanisms from slower ones. |
411 | 467 |
412 dashmstdout) | 468 dashmstdout) |
501 done | 557 done |
502 obj_suffix=`echo "$object" | sed 's/^.*\././'` | 558 obj_suffix=`echo "$object" | sed 's/^.*\././'` |
503 touch "$tmpdepfile" | 559 touch "$tmpdepfile" |
504 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" | 560 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" |
505 rm -f "$depfile" | 561 rm -f "$depfile" |
506 cat < "$tmpdepfile" > "$depfile" | 562 # makedepend may prepend the VPATH from the source file name to the object. |
563 # No need to regex-escape $object, excess matching of '.' is harmless. | |
564 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" | |
507 sed '1,2d' "$tmpdepfile" | tr ' ' ' | 565 sed '1,2d' "$tmpdepfile" | tr ' ' ' |
508 ' | \ | 566 ' | \ |
509 ## Some versions of the HPUX 10.20 sed can't process this invocation | 567 ## Some versions of the HPUX 10.20 sed can't process this invocation |
510 ## correctly. Breaking it into two sed invocations is a workaround. | 568 ## correctly. Breaking it into two sed invocations is a workaround. |
511 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 569 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |