comparison depcomp @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children 04ced10e8804
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
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=2005-05-16.16 4 scriptversion=2009-04-28.21; # UTC
5 5
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
7 # Software Foundation, Inc.
7 8
8 # 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
9 # 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
10 # the Free Software Foundation; either version 2, or (at your option) 11 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version. 12 # any later version.
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details. 17 # GNU General Public License for more details.
17 18
18 # 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
19 # along with this program; if not, write to the Free Software 20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 # 02110-1301, USA.
22 21
23 # 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
24 # distribute this file as part of a program that contains a 23 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under 24 # configuration script generated by Autoconf, you may include it under
26 # 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.
84 # This is just like dashmstdout with a different argument. 83 # This is just like dashmstdout with a different argument.
85 dashmflag=-xM 84 dashmflag=-xM
86 depmode=dashmstdout 85 depmode=dashmstdout
87 fi 86 fi
88 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
89 case "$depmode" in 97 case "$depmode" in
90 gcc3) 98 gcc3)
91 ## gcc 3 implements dependency tracking that does exactly what 99 ## gcc 3 implements dependency tracking that does exactly what
92 ## 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
93 ## it if -MD -MP comes after the -MF stuff. Hmm. 101 ## it if -MD -MP comes after the -MF stuff. Hmm.
94 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 102 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
103 ## the command line argument order; so add the flags where they
104 ## appear in depend2.am. Note that the slowdown incurred here
105 ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
106 for arg
107 do
108 case $arg in
109 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
110 *) set fnord "$@" "$arg" ;;
111 esac
112 shift # fnord
113 shift # $arg
114 done
115 "$@"
95 stat=$? 116 stat=$?
96 if test $stat -eq 0; then : 117 if test $stat -eq 0; then :
97 else 118 else
98 rm -f "$tmpdepfile" 119 rm -f "$tmpdepfile"
99 exit $stat 120 exit $stat
176 # dependency line. 197 # dependency line.
177 tr ' ' ' 198 tr ' ' '
178 ' < "$tmpdepfile" \ 199 ' < "$tmpdepfile" \
179 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 200 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
180 tr ' 201 tr '
181 ' ' ' >> $depfile 202 ' ' ' >> "$depfile"
182 echo >> $depfile 203 echo >> "$depfile"
183 204
184 # The second pass generates a dummy entry for each header file. 205 # The second pass generates a dummy entry for each header file.
185 tr ' ' ' 206 tr ' ' '
186 ' < "$tmpdepfile" \ 207 ' < "$tmpdepfile" \
187 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 208 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
188 >> $depfile 209 >> "$depfile"
189 else 210 else
190 # The sourcefile does not contain any dependencies, so just 211 # The sourcefile does not contain any dependencies, so just
191 # store a dummy comment line, to avoid errors with the Makefile 212 # store a dummy comment line, to avoid errors with the Makefile
192 # "include basename.Plo" scheme. 213 # "include basename.Plo" scheme.
193 echo "#dummy" > "$depfile" 214 echo "#dummy" > "$depfile"
199 # The C for AIX Compiler uses -M and outputs the dependencies 220 # The C for AIX Compiler uses -M and outputs the dependencies
200 # 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
201 # current directory. Also, the AIX compiler puts `$object:' at the 222 # current directory. Also, the AIX compiler puts `$object:' at the
202 # start of each line; $object doesn't have directory information. 223 # start of each line; $object doesn't have directory information.
203 # Version 6 uses the directory in both cases. 224 # Version 6 uses the directory in both cases.
204 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 225 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
205 tmpdepfile="$stripped.u" 226 test "x$dir" = "x$object" && dir=
227 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
206 if test "$libtool" = yes; then 228 if test "$libtool" = yes; then
229 tmpdepfile1=$dir$base.u
230 tmpdepfile2=$base.u
231 tmpdepfile3=$dir.libs/$base.u
207 "$@" -Wc,-M 232 "$@" -Wc,-M
208 else 233 else
234 tmpdepfile1=$dir$base.u
235 tmpdepfile2=$dir$base.u
236 tmpdepfile3=$dir$base.u
209 "$@" -M 237 "$@" -M
210 fi 238 fi
211 stat=$? 239 stat=$?
212 240
213 if test -f "$tmpdepfile"; then :
214 else
215 stripped=`echo "$stripped" | sed 's,^.*/,,'`
216 tmpdepfile="$stripped.u"
217 fi
218
219 if test $stat -eq 0; then : 241 if test $stat -eq 0; then :
220 else 242 else
221 rm -f "$tmpdepfile" 243 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
222 exit $stat 244 exit $stat
223 fi 245 fi
224 246
247 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
248 do
249 test -f "$tmpdepfile" && break
250 done
225 if test -f "$tmpdepfile"; then 251 if test -f "$tmpdepfile"; then
226 outname="$stripped.o"
227 # Each line is of the form `foo.o: dependent.h'. 252 # Each line is of the form `foo.o: dependent.h'.
228 # Do two passes, one to just change these to 253 # Do two passes, one to just change these to
229 # `$object: dependent.h' and one to simply `dependent.h:'. 254 # `$object: dependent.h' and one to simply `dependent.h:'.
230 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 255 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
231 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 256 # That's a tab and a space in the [].
257 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
232 else 258 else
233 # The sourcefile does not contain any dependencies, so just 259 # The sourcefile does not contain any dependencies, so just
234 # store a dummy comment line, to avoid errors with the Makefile 260 # store a dummy comment line, to avoid errors with the Makefile
235 # "include basename.Plo" scheme. 261 # "include basename.Plo" scheme.
236 echo "#dummy" > "$depfile" 262 echo "#dummy" > "$depfile"
274 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 300 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
275 sed -e 's/$/ :/' >> "$depfile" 301 sed -e 's/$/ :/' >> "$depfile"
276 rm -f "$tmpdepfile" 302 rm -f "$tmpdepfile"
277 ;; 303 ;;
278 304
279 ia64hp) 305 hp2)
280 # The "hp" stanza above does not work with HP's ia64 compilers, 306 # The "hp" stanza above does not work with aCC (C++) and HP's ia64
281 # which have integrated preprocessors. The correct option to use 307 # compilers, which have integrated preprocessors. The correct option
282 # with these is +Maked; it writes dependencies to a file named 308 # to use with these is +Maked; it writes dependencies to a file named
283 # 'foo.d', which lands next to the object file, wherever that 309 # 'foo.d', which lands next to the object file, wherever that
284 # happens to be. 310 # happens to be.
285 tmpdepfile=`echo "$object" | sed -e 's/\.o$/.d/'` 311 # Much of this is similar to the tru64 case; see comments there.
286 "$@" +Maked 312 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
313 test "x$dir" = "x$object" && dir=
314 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
315 if test "$libtool" = yes; then
316 tmpdepfile1=$dir$base.d
317 tmpdepfile2=$dir.libs/$base.d
318 "$@" -Wc,+Maked
319 else
320 tmpdepfile1=$dir$base.d
321 tmpdepfile2=$dir$base.d
322 "$@" +Maked
323 fi
287 stat=$? 324 stat=$?
288 if test $stat -eq 0; then : 325 if test $stat -eq 0; then :
289 else 326 else
290 rm -f "$tmpdepfile" 327 rm -f "$tmpdepfile1" "$tmpdepfile2"
291 exit $stat 328 exit $stat
292 fi 329 fi
293 rm -f "$depfile" 330
294 331 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
295 # The object file name is correct already. 332 do
296 cat "$tmpdepfile" > "$depfile" 333 test -f "$tmpdepfile" && break
297 # Add `dependent.h:' lines. 334 done
298 sed -ne '2,${; s/^ //; s/ \\*$//; s/$/:/; p; }' "$tmpdepfile" >> "$depfile" 335 if test -f "$tmpdepfile"; then
299 rm -f "$tmpdepfile" 336 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
337 # Add `dependent.h:' lines.
338 sed -ne '2,${
339 s/^ *//
340 s/ \\*$//
341 s/$/:/
342 p
343 }' "$tmpdepfile" >> "$depfile"
344 else
345 echo "#dummy" > "$depfile"
346 fi
347 rm -f "$tmpdepfile" "$tmpdepfile2"
300 ;; 348 ;;
301 349
302 tru64) 350 tru64)
303 # The Tru64 compiler uses -MD to generate dependencies as a side 351 # The Tru64 compiler uses -MD to generate dependencies as a side
304 # 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'.
309 test "x$dir" = "x$object" && dir= 357 test "x$dir" = "x$object" && dir=
310 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$//'`
311 359
312 if test "$libtool" = yes; then 360 if test "$libtool" = yes; then
313 # With Tru64 cc, shared objects can also be used to make a 361 # With Tru64 cc, shared objects can also be used to make a
314 # static library. This mecanism is used in libtool 1.4 series to 362 # static library. This mechanism is used in libtool 1.4 series to
315 # handle both shared and static libraries in a single compilation. 363 # handle both shared and static libraries in a single compilation.
316 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 364 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
317 # 365 #
318 # With libtool 1.5 this exception was removed, and libtool now 366 # With libtool 1.5 this exception was removed, and libtool now
319 # generates 2 separate objects for the 2 libraries. These two 367 # generates 2 separate objects for the 2 libraries. These two
320 # compilations output dependencies in in $dir.libs/$base.o.d and 368 # compilations output dependencies in $dir.libs/$base.o.d and
321 # in $dir$base.o.d. We have to check for both files, because 369 # in $dir$base.o.d. We have to check for both files, because
322 # one of the two compilations can be disabled. We should prefer 370 # one of the two compilations can be disabled. We should prefer
323 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 371 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
324 # automatically cleaned when .libs/ is deleted, while ignoring 372 # automatically cleaned when .libs/ is deleted, while ignoring
325 # the former would cause a distcleancheck panic. 373 # the former would cause a distcleancheck panic.
366 # always write the preprocessed file to stdout, regardless of -o. 414 # always write the preprocessed file to stdout, regardless of -o.
367 "$@" || exit $? 415 "$@" || exit $?
368 416
369 # Remove the call to Libtool. 417 # Remove the call to Libtool.
370 if test "$libtool" = yes; then 418 if test "$libtool" = yes; then
371 while test $1 != '--mode=compile'; do 419 while test "X$1" != 'X--mode=compile'; do
372 shift 420 shift
373 done 421 done
374 shift 422 shift
375 fi 423 fi
376 424
417 465
418 makedepend) 466 makedepend)
419 "$@" || exit $? 467 "$@" || exit $?
420 # Remove any Libtool call 468 # Remove any Libtool call
421 if test "$libtool" = yes; then 469 if test "$libtool" = yes; then
422 while test $1 != '--mode=compile'; do 470 while test "X$1" != 'X--mode=compile'; do
423 shift 471 shift
424 done 472 done
425 shift 473 shift
426 fi 474 fi
427 # X makedepend 475 # X makedepend
428 shift 476 shift
429 cleared=no 477 cleared=no eat=no
430 for arg in "$@"; do 478 for arg
479 do
431 case $cleared in 480 case $cleared in
432 no) 481 no)
433 set ""; shift 482 set ""; shift
434 cleared=yes ;; 483 cleared=yes ;;
435 esac 484 esac
485 if test $eat = yes; then
486 eat=no
487 continue
488 fi
436 case "$arg" in 489 case "$arg" in
437 -D*|-I*) 490 -D*|-I*)
438 set fnord "$@" "$arg"; shift ;; 491 set fnord "$@" "$arg"; shift ;;
439 # Strip any option that makedepend may not understand. Remove 492 # Strip any option that makedepend may not understand. Remove
440 # 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 ;;
441 -*|$object) 496 -*|$object)
442 ;; 497 ;;
443 *) 498 *)
444 set fnord "$@" "$arg"; shift ;; 499 set fnord "$@" "$arg"; shift ;;
445 esac 500 esac
446 done 501 done
447 obj_suffix="`echo $object | sed 's/^.*\././'`" 502 obj_suffix=`echo "$object" | sed 's/^.*\././'`
448 touch "$tmpdepfile" 503 touch "$tmpdepfile"
449 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 504 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
450 rm -f "$depfile" 505 rm -f "$depfile"
451 cat < "$tmpdepfile" > "$depfile" 506 cat < "$tmpdepfile" > "$depfile"
452 sed '1,2d' "$tmpdepfile" | tr ' ' ' 507 sed '1,2d' "$tmpdepfile" | tr ' ' '
462 # always write the preprocessed file to stdout. 517 # always write the preprocessed file to stdout.
463 "$@" || exit $? 518 "$@" || exit $?
464 519
465 # Remove the call to Libtool. 520 # Remove the call to Libtool.
466 if test "$libtool" = yes; then 521 if test "$libtool" = yes; then
467 while test $1 != '--mode=compile'; do 522 while test "X$1" != 'X--mode=compile'; do
468 shift 523 shift
469 done 524 done
470 shift 525 shift
471 fi 526 fi
472 527
500 rm -f "$tmpdepfile" 555 rm -f "$tmpdepfile"
501 ;; 556 ;;
502 557
503 msvisualcpp) 558 msvisualcpp)
504 # Important note: in order to support this mode, a compiler *must* 559 # Important note: in order to support this mode, a compiler *must*
505 # always write the preprocessed file to stdout, regardless of -o, 560 # always write the preprocessed file to stdout.
506 # because we must use -o when running libtool.
507 "$@" || 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
508 IFS=" " 571 IFS=" "
509 for arg 572 for arg
510 do 573 do
511 case "$arg" in 574 case "$arg" in
575 -o)
576 shift
577 ;;
578 $object)
579 shift
580 ;;
512 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 581 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
513 set fnord "$@" 582 set fnord "$@"
514 shift 583 shift
515 shift 584 shift
516 ;; 585 ;;
519 shift 588 shift
520 shift 589 shift
521 ;; 590 ;;
522 esac 591 esac
523 done 592 done
524 "$@" -E | 593 "$@" -E 2>/dev/null |
525 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 > "$tmpdepfile"
526 rm -f "$depfile" 595 rm -f "$depfile"
527 echo "$object : \\" > "$depfile" 596 echo "$object : \\" > "$depfile"
528 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 597 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
529 echo " " >> "$depfile" 598 echo " " >> "$depfile"
530 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 599 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
531 rm -f "$tmpdepfile" 600 rm -f "$tmpdepfile"
601 ;;
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
532 ;; 608 ;;
533 609
534 none) 610 none)
535 exec "$@" 611 exec "$@"
536 ;; 612 ;;
547 # mode: shell-script 623 # mode: shell-script
548 # sh-indentation: 2 624 # sh-indentation: 2
549 # eval: (add-hook 'write-file-hooks 'time-stamp) 625 # eval: (add-hook 'write-file-hooks 'time-stamp)
550 # time-stamp-start: "scriptversion=" 626 # time-stamp-start: "scriptversion="
551 # time-stamp-format: "%:y-%02m-%02d.%02H" 627 # time-stamp-format: "%:y-%02m-%02d.%02H"
552 # time-stamp-end: "$" 628 # time-stamp-time-zone: "UTC"
629 # time-stamp-end: "; # UTC"
553 # End: 630 # End: