OLD | NEW |
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=2007-03-29.01 | 4 scriptversion=2009-04-28.21; # UTC |
5 | 5 |
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software | 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free |
7 # 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. |
13 | 13 |
14 # This program is distributed in the hope that it will be useful, | 14 # This program is distributed in the hope that it will be useful, |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 # GNU General Public License for more details. | 17 # GNU General Public License for more details. |
18 | 18 |
19 # You should have received a copy of the GNU General Public License | 19 # You should have received a copy of the GNU General Public License |
20 # along with this program; if not, write to the Free Software | 20 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
22 # 02110-1301, USA. | |
23 | 21 |
24 # As a special exception to the GNU General Public License, if you | 22 # As a special exception to the GNU General Public License, if you |
25 # distribute this file as part of a program that contains a | 23 # distribute this file as part of a program that contains a |
26 # configuration script generated by Autoconf, you may include it under | 24 # configuration script generated by Autoconf, you may include it under |
27 # the same distribution terms that you use for the rest of that program. | 25 # the same distribution terms that you use for the rest of that program. |
28 | 26 |
29 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. | 27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. |
30 | 28 |
31 case $1 in | 29 case $1 in |
32 '') | 30 '') |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 gccflag=-M | 78 gccflag=-M |
81 depmode=gcc | 79 depmode=gcc |
82 fi | 80 fi |
83 | 81 |
84 if test "$depmode" = dashXmstdout; then | 82 if test "$depmode" = dashXmstdout; then |
85 # This is just like dashmstdout with a different argument. | 83 # This is just like dashmstdout with a different argument. |
86 dashmflag=-xM | 84 dashmflag=-xM |
87 depmode=dashmstdout | 85 depmode=dashmstdout |
88 fi | 86 fi |
89 | 87 |
| 88 cygpath_u="cygpath -u -f -" |
| 89 if test "$depmode" = msvcmsys; then |
| 90 # This is just like msvisualcpp but w/o cygpath translation. |
| 91 # Just convert the backslash-escaped backslashes to single forward |
| 92 # slashes to satisfy depend.m4 |
| 93 cygpath_u="sed s,\\\\\\\\,/,g" |
| 94 depmode=msvisualcpp |
| 95 fi |
| 96 |
90 case "$depmode" in | 97 case "$depmode" in |
91 gcc3) | 98 gcc3) |
92 ## gcc 3 implements dependency tracking that does exactly what | 99 ## gcc 3 implements dependency tracking that does exactly what |
93 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like | 100 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like |
94 ## it if -MD -MP comes after the -MF stuff. Hmm. | 101 ## it if -MD -MP comes after the -MF stuff. Hmm. |
95 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon | 102 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon |
96 ## the command line argument order; so add the flags where they | 103 ## the command line argument order; so add the flags where they |
97 ## appear in depend2.am. Note that the slowdown incurred here | 104 ## appear in depend2.am. Note that the slowdown incurred here |
98 ## affects only configure: in makefiles, %FASTDEP% shortcuts this. | 105 ## affects only configure: in makefiles, %FASTDEP% shortcuts this. |
99 for arg | 106 for arg |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 # 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 |
186 # 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 |
187 # lines with more than a fixed number of characters (4096 in | 194 # lines with more than a fixed number of characters (4096 in |
188 # 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; |
189 # 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 |
190 # dependency line. | 197 # dependency line. |
191 tr ' ' ' | 198 tr ' ' ' |
192 ' < "$tmpdepfile" \ | 199 ' < "$tmpdepfile" \ |
193 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ | 200 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ |
194 tr ' | 201 tr ' |
195 ' ' ' >> $depfile | 202 ' ' ' >> "$depfile" |
196 echo >> $depfile | 203 echo >> "$depfile" |
197 | 204 |
198 # The second pass generates a dummy entry for each header file. | 205 # The second pass generates a dummy entry for each header file. |
199 tr ' ' ' | 206 tr ' ' ' |
200 ' < "$tmpdepfile" \ | 207 ' < "$tmpdepfile" \ |
201 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ | 208 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ |
202 >> $depfile | 209 >> "$depfile" |
203 else | 210 else |
204 # The sourcefile does not contain any dependencies, so just | 211 # The sourcefile does not contain any dependencies, so just |
205 # store a dummy comment line, to avoid errors with the Makefile | 212 # store a dummy comment line, to avoid errors with the Makefile |
206 # "include basename.Plo" scheme. | 213 # "include basename.Plo" scheme. |
207 echo "#dummy" > "$depfile" | 214 echo "#dummy" > "$depfile" |
208 fi | 215 fi |
209 rm -f "$tmpdepfile" | 216 rm -f "$tmpdepfile" |
210 ;; | 217 ;; |
211 | 218 |
212 aix) | 219 aix) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 exit $stat | 328 exit $stat |
322 fi | 329 fi |
323 | 330 |
324 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" | 331 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" |
325 do | 332 do |
326 test -f "$tmpdepfile" && break | 333 test -f "$tmpdepfile" && break |
327 done | 334 done |
328 if test -f "$tmpdepfile"; then | 335 if test -f "$tmpdepfile"; then |
329 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" | 336 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" |
330 # Add `dependent.h:' lines. | 337 # Add `dependent.h:' lines. |
331 sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" | 338 sed -ne '2,${ |
| 339 » s/^ *// |
| 340 » s/ \\*$// |
| 341 » s/$/:/ |
| 342 » p |
| 343 » }' "$tmpdepfile" >> "$depfile" |
332 else | 344 else |
333 echo "#dummy" > "$depfile" | 345 echo "#dummy" > "$depfile" |
334 fi | 346 fi |
335 rm -f "$tmpdepfile" "$tmpdepfile2" | 347 rm -f "$tmpdepfile" "$tmpdepfile2" |
336 ;; | 348 ;; |
337 | 349 |
338 tru64) | 350 tru64) |
339 # The Tru64 compiler uses -MD to generate dependencies as a side | 351 # The Tru64 compiler uses -MD to generate dependencies as a side |
340 # 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'. |
341 # 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 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 # This comment above is used by automake to tell side-effect | 409 # This comment above is used by automake to tell side-effect |
398 # dependency tracking mechanisms from slower ones. | 410 # dependency tracking mechanisms from slower ones. |
399 | 411 |
400 dashmstdout) | 412 dashmstdout) |
401 # Important note: in order to support this mode, a compiler *must* | 413 # Important note: in order to support this mode, a compiler *must* |
402 # always write the preprocessed file to stdout, regardless of -o. | 414 # always write the preprocessed file to stdout, regardless of -o. |
403 "$@" || exit $? | 415 "$@" || exit $? |
404 | 416 |
405 # Remove the call to Libtool. | 417 # Remove the call to Libtool. |
406 if test "$libtool" = yes; then | 418 if test "$libtool" = yes; then |
407 while test $1 != '--mode=compile'; do | 419 while test "X$1" != 'X--mode=compile'; do |
408 shift | 420 shift |
409 done | 421 done |
410 shift | 422 shift |
411 fi | 423 fi |
412 | 424 |
413 # Remove `-o $object'. | 425 # Remove `-o $object'. |
414 IFS=" " | 426 IFS=" " |
415 for arg | 427 for arg |
416 do | 428 do |
417 case $arg in | 429 case $arg in |
(...skipping 30 matching lines...) Expand all Loading... |
448 dashXmstdout) | 460 dashXmstdout) |
449 # This case only exists to satisfy depend.m4. It is never actually | 461 # This case only exists to satisfy depend.m4. It is never actually |
450 # run, as this mode is specially recognized in the preamble. | 462 # run, as this mode is specially recognized in the preamble. |
451 exit 1 | 463 exit 1 |
452 ;; | 464 ;; |
453 | 465 |
454 makedepend) | 466 makedepend) |
455 "$@" || exit $? | 467 "$@" || exit $? |
456 # Remove any Libtool call | 468 # Remove any Libtool call |
457 if test "$libtool" = yes; then | 469 if test "$libtool" = yes; then |
458 while test $1 != '--mode=compile'; do | 470 while test "X$1" != 'X--mode=compile'; do |
459 shift | 471 shift |
460 done | 472 done |
461 shift | 473 shift |
462 fi | 474 fi |
463 # X makedepend | 475 # X makedepend |
464 shift | 476 shift |
465 cleared=no | 477 cleared=no eat=no |
466 for arg in "$@"; do | 478 for arg |
| 479 do |
467 case $cleared in | 480 case $cleared in |
468 no) | 481 no) |
469 set ""; shift | 482 set ""; shift |
470 cleared=yes ;; | 483 cleared=yes ;; |
471 esac | 484 esac |
| 485 if test $eat = yes; then |
| 486 eat=no |
| 487 continue |
| 488 fi |
472 case "$arg" in | 489 case "$arg" in |
473 -D*|-I*) | 490 -D*|-I*) |
474 set fnord "$@" "$arg"; shift ;; | 491 set fnord "$@" "$arg"; shift ;; |
475 # Strip any option that makedepend may not understand. Remove | 492 # Strip any option that makedepend may not understand. Remove |
476 # the object too, otherwise makedepend will parse it as a source file. | 493 # the object too, otherwise makedepend will parse it as a source file. |
| 494 -arch) |
| 495 eat=yes ;; |
477 -*|$object) | 496 -*|$object) |
478 ;; | 497 ;; |
479 *) | 498 *) |
480 set fnord "$@" "$arg"; shift ;; | 499 set fnord "$@" "$arg"; shift ;; |
481 esac | 500 esac |
482 done | 501 done |
483 obj_suffix="`echo $object | sed 's/^.*\././'`" | 502 obj_suffix=`echo "$object" | sed 's/^.*\././'` |
484 touch "$tmpdepfile" | 503 touch "$tmpdepfile" |
485 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" | 504 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" |
486 rm -f "$depfile" | 505 rm -f "$depfile" |
487 cat < "$tmpdepfile" > "$depfile" | 506 cat < "$tmpdepfile" > "$depfile" |
488 sed '1,2d' "$tmpdepfile" | tr ' ' ' | 507 sed '1,2d' "$tmpdepfile" | tr ' ' ' |
489 ' | \ | 508 ' | \ |
490 ## 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 |
491 ## correctly. Breaking it into two sed invocations is a workaround. | 510 ## correctly. Breaking it into two sed invocations is a workaround. |
492 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 511 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
493 rm -f "$tmpdepfile" "$tmpdepfile".bak | 512 rm -f "$tmpdepfile" "$tmpdepfile".bak |
494 ;; | 513 ;; |
495 | 514 |
496 cpp) | 515 cpp) |
497 # Important note: in order to support this mode, a compiler *must* | 516 # Important note: in order to support this mode, a compiler *must* |
498 # always write the preprocessed file to stdout. | 517 # always write the preprocessed file to stdout. |
499 "$@" || exit $? | 518 "$@" || exit $? |
500 | 519 |
501 # Remove the call to Libtool. | 520 # Remove the call to Libtool. |
502 if test "$libtool" = yes; then | 521 if test "$libtool" = yes; then |
503 while test $1 != '--mode=compile'; do | 522 while test "X$1" != 'X--mode=compile'; do |
504 shift | 523 shift |
505 done | 524 done |
506 shift | 525 shift |
507 fi | 526 fi |
508 | 527 |
509 # Remove `-o $object'. | 528 # Remove `-o $object'. |
510 IFS=" " | 529 IFS=" " |
511 for arg | 530 for arg |
512 do | 531 do |
513 case $arg in | 532 case $arg in |
(...skipping 17 matching lines...) Expand all Loading... |
531 sed '$ s: \\$::' > "$tmpdepfile" | 550 sed '$ s: \\$::' > "$tmpdepfile" |
532 rm -f "$depfile" | 551 rm -f "$depfile" |
533 echo "$object : \\" > "$depfile" | 552 echo "$object : \\" > "$depfile" |
534 cat < "$tmpdepfile" >> "$depfile" | 553 cat < "$tmpdepfile" >> "$depfile" |
535 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" | 554 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" |
536 rm -f "$tmpdepfile" | 555 rm -f "$tmpdepfile" |
537 ;; | 556 ;; |
538 | 557 |
539 msvisualcpp) | 558 msvisualcpp) |
540 # Important note: in order to support this mode, a compiler *must* | 559 # Important note: in order to support this mode, a compiler *must* |
541 # always write the preprocessed file to stdout, regardless of -o, | 560 # always write the preprocessed file to stdout. |
542 # because we must use -o when running libtool. | |
543 "$@" || exit $? | 561 "$@" || exit $? |
| 562 |
| 563 # Remove the call to Libtool. |
| 564 if test "$libtool" = yes; then |
| 565 while test "X$1" != 'X--mode=compile'; do |
| 566 shift |
| 567 done |
| 568 shift |
| 569 fi |
| 570 |
544 IFS=" " | 571 IFS=" " |
545 for arg | 572 for arg |
546 do | 573 do |
547 case "$arg" in | 574 case "$arg" in |
| 575 -o) |
| 576 shift |
| 577 ;; |
| 578 $object) |
| 579 shift |
| 580 ;; |
548 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") | 581 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") |
549 set fnord "$@" | 582 set fnord "$@" |
550 shift | 583 shift |
551 shift | 584 shift |
552 ;; | 585 ;; |
553 *) | 586 *) |
554 set fnord "$@" "$arg" | 587 set fnord "$@" "$arg" |
555 shift | 588 shift |
556 shift | 589 shift |
557 ;; | 590 ;; |
558 esac | 591 esac |
559 done | 592 done |
560 "$@" -E | | 593 "$@" -E 2>/dev/null | |
561 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' |
sort | uniq > "$tmpdepfile" | 594 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$t
mpdepfile" |
562 rm -f "$depfile" | 595 rm -f "$depfile" |
563 echo "$object : \\" > "$depfile" | 596 echo "$object : \\" > "$depfile" |
564 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::» \1 \\:p' >> "$de
pfile" | 597 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::» \1 \\:p' >> "$de
pfile" |
565 echo " " >> "$depfile" | 598 echo " " >> "$depfile" |
566 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile
" | 599 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" |
567 rm -f "$tmpdepfile" | 600 rm -f "$tmpdepfile" |
568 ;; | 601 ;; |
569 | 602 |
| 603 msvcmsys) |
| 604 # This case exists only to let depend.m4 do its work. It works by |
| 605 # looking at the text of this script. This case will never be run, |
| 606 # since it is checked for above. |
| 607 exit 1 |
| 608 ;; |
| 609 |
570 none) | 610 none) |
571 exec "$@" | 611 exec "$@" |
572 ;; | 612 ;; |
573 | 613 |
574 *) | 614 *) |
575 echo "Unknown depmode $depmode" 1>&2 | 615 echo "Unknown depmode $depmode" 1>&2 |
576 exit 1 | 616 exit 1 |
577 ;; | 617 ;; |
578 esac | 618 esac |
579 | 619 |
580 exit 0 | 620 exit 0 |
581 | 621 |
582 # Local Variables: | 622 # Local Variables: |
583 # mode: shell-script | 623 # mode: shell-script |
584 # sh-indentation: 2 | 624 # sh-indentation: 2 |
585 # eval: (add-hook 'write-file-hooks 'time-stamp) | 625 # eval: (add-hook 'write-file-hooks 'time-stamp) |
586 # time-stamp-start: "scriptversion=" | 626 # time-stamp-start: "scriptversion=" |
587 # time-stamp-format: "%:y-%02m-%02d.%02H" | 627 # time-stamp-format: "%:y-%02m-%02d.%02H" |
588 # time-stamp-end: "$" | 628 # time-stamp-time-zone: "UTC" |
| 629 # time-stamp-end: "; # UTC" |
589 # End: | 630 # End: |
OLD | NEW |