| 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=2005-07-09.11 | 4 scriptversion=2007-03-29.01 |
| 5 | 5 |
| 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. | 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software |
| 7 # 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. |
| 12 | 13 |
| 13 # 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, |
| 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. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 # This is just like dashmstdout with a different argument. | 85 # This is just like dashmstdout with a different argument. |
| 85 dashmflag=-xM | 86 dashmflag=-xM |
| 86 depmode=dashmstdout | 87 depmode=dashmstdout |
| 87 fi | 88 fi |
| 88 | 89 |
| 89 case "$depmode" in | 90 case "$depmode" in |
| 90 gcc3) | 91 gcc3) |
| 91 ## gcc 3 implements dependency tracking that does exactly what | 92 ## gcc 3 implements dependency tracking that does exactly what |
| 92 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like | 93 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like |
| 93 ## it if -MD -MP comes after the -MF stuff. Hmm. | 94 ## it if -MD -MP comes after the -MF stuff. Hmm. |
| 94 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" | 95 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon |
| 96 ## the command line argument order; so add the flags where they |
| 97 ## appear in depend2.am. Note that the slowdown incurred here |
| 98 ## affects only configure: in makefiles, %FASTDEP% shortcuts this. |
| 99 for arg |
| 100 do |
| 101 case $arg in |
| 102 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; |
| 103 *) set fnord "$@" "$arg" ;; |
| 104 esac |
| 105 shift # fnord |
| 106 shift # $arg |
| 107 done |
| 108 "$@" |
| 95 stat=$? | 109 stat=$? |
| 96 if test $stat -eq 0; then : | 110 if test $stat -eq 0; then : |
| 97 else | 111 else |
| 98 rm -f "$tmpdepfile" | 112 rm -f "$tmpdepfile" |
| 99 exit $stat | 113 exit $stat |
| 100 fi | 114 fi |
| 101 mv "$tmpdepfile" "$depfile" | 115 mv "$tmpdepfile" "$depfile" |
| 102 ;; | 116 ;; |
| 103 | 117 |
| 104 gcc) | 118 gcc) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 fi | 208 fi |
| 195 rm -f "$tmpdepfile" | 209 rm -f "$tmpdepfile" |
| 196 ;; | 210 ;; |
| 197 | 211 |
| 198 aix) | 212 aix) |
| 199 # The C for AIX Compiler uses -M and outputs the dependencies | 213 # 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 | 214 # in a .u file. In older versions, this file always lives in the |
| 201 # current directory. Also, the AIX compiler puts `$object:' at the | 215 # current directory. Also, the AIX compiler puts `$object:' at the |
| 202 # start of each line; $object doesn't have directory information. | 216 # start of each line; $object doesn't have directory information. |
| 203 # Version 6 uses the directory in both cases. | 217 # Version 6 uses the directory in both cases. |
| 204 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` | 218 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
| 205 tmpdepfile="$stripped.u" | 219 test "x$dir" = "x$object" && dir= |
| 220 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
| 206 if test "$libtool" = yes; then | 221 if test "$libtool" = yes; then |
| 222 tmpdepfile1=$dir$base.u |
| 223 tmpdepfile2=$base.u |
| 224 tmpdepfile3=$dir.libs/$base.u |
| 207 "$@" -Wc,-M | 225 "$@" -Wc,-M |
| 208 else | 226 else |
| 227 tmpdepfile1=$dir$base.u |
| 228 tmpdepfile2=$dir$base.u |
| 229 tmpdepfile3=$dir$base.u |
| 209 "$@" -M | 230 "$@" -M |
| 210 fi | 231 fi |
| 211 stat=$? | 232 stat=$? |
| 212 | 233 |
| 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 : | 234 if test $stat -eq 0; then : |
| 220 else | 235 else |
| 221 rm -f "$tmpdepfile" | 236 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
| 222 exit $stat | 237 exit $stat |
| 223 fi | 238 fi |
| 224 | 239 |
| 240 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
| 241 do |
| 242 test -f "$tmpdepfile" && break |
| 243 done |
| 225 if test -f "$tmpdepfile"; then | 244 if test -f "$tmpdepfile"; then |
| 226 outname="$stripped.o" | |
| 227 # Each line is of the form `foo.o: dependent.h'. | 245 # Each line is of the form `foo.o: dependent.h'. |
| 228 # Do two passes, one to just change these to | 246 # Do two passes, one to just change these to |
| 229 # `$object: dependent.h' and one to simply `dependent.h:'. | 247 # `$object: dependent.h' and one to simply `dependent.h:'. |
| 230 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" | 248 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
| 231 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" | 249 # That's a tab and a space in the []. |
| 250 sed -e 's,^.*\.[a-z]*:[» ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" |
| 232 else | 251 else |
| 233 # The sourcefile does not contain any dependencies, so just | 252 # The sourcefile does not contain any dependencies, so just |
| 234 # store a dummy comment line, to avoid errors with the Makefile | 253 # store a dummy comment line, to avoid errors with the Makefile |
| 235 # "include basename.Plo" scheme. | 254 # "include basename.Plo" scheme. |
| 236 echo "#dummy" > "$depfile" | 255 echo "#dummy" > "$depfile" |
| 237 fi | 256 fi |
| 238 rm -f "$tmpdepfile" | 257 rm -f "$tmpdepfile" |
| 239 ;; | 258 ;; |
| 240 | 259 |
| 241 icc) | 260 icc) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 269 # Do two passes, one to just change these to | 288 # Do two passes, one to just change these to |
| 270 # `$object: dependent.h' and one to simply `dependent.h:'. | 289 # `$object: dependent.h' and one to simply `dependent.h:'. |
| 271 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" | 290 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" |
| 272 # Some versions of the HPUX 10.20 sed can't process this invocation | 291 # Some versions of the HPUX 10.20 sed can't process this invocation |
| 273 # correctly. Breaking it into two sed invocations is a workaround. | 292 # correctly. Breaking it into two sed invocations is a workaround. |
| 274 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | | 293 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | |
| 275 sed -e 's/$/ :/' >> "$depfile" | 294 sed -e 's/$/ :/' >> "$depfile" |
| 276 rm -f "$tmpdepfile" | 295 rm -f "$tmpdepfile" |
| 277 ;; | 296 ;; |
| 278 | 297 |
| 298 hp2) |
| 299 # The "hp" stanza above does not work with aCC (C++) and HP's ia64 |
| 300 # compilers, which have integrated preprocessors. The correct option |
| 301 # to use with these is +Maked; it writes dependencies to a file named |
| 302 # 'foo.d', which lands next to the object file, wherever that |
| 303 # happens to be. |
| 304 # Much of this is similar to the tru64 case; see comments there. |
| 305 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
| 306 test "x$dir" = "x$object" && dir= |
| 307 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
| 308 if test "$libtool" = yes; then |
| 309 tmpdepfile1=$dir$base.d |
| 310 tmpdepfile2=$dir.libs/$base.d |
| 311 "$@" -Wc,+Maked |
| 312 else |
| 313 tmpdepfile1=$dir$base.d |
| 314 tmpdepfile2=$dir$base.d |
| 315 "$@" +Maked |
| 316 fi |
| 317 stat=$? |
| 318 if test $stat -eq 0; then : |
| 319 else |
| 320 rm -f "$tmpdepfile1" "$tmpdepfile2" |
| 321 exit $stat |
| 322 fi |
| 323 |
| 324 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" |
| 325 do |
| 326 test -f "$tmpdepfile" && break |
| 327 done |
| 328 if test -f "$tmpdepfile"; then |
| 329 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" |
| 330 # Add `dependent.h:' lines. |
| 331 sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" |
| 332 else |
| 333 echo "#dummy" > "$depfile" |
| 334 fi |
| 335 rm -f "$tmpdepfile" "$tmpdepfile2" |
| 336 ;; |
| 337 |
| 279 tru64) | 338 tru64) |
| 280 # The Tru64 compiler uses -MD to generate dependencies as a side | 339 # The Tru64 compiler uses -MD to generate dependencies as a side |
| 281 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. | 340 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. |
| 282 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put | 341 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put |
| 283 # dependencies in `foo.d' instead, so we check for that too. | 342 # dependencies in `foo.d' instead, so we check for that too. |
| 284 # Subdirectories are respected. | 343 # Subdirectories are respected. |
| 285 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 344 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
| 286 test "x$dir" = "x$object" && dir= | 345 test "x$dir" = "x$object" && dir= |
| 287 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | 346 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
| 288 | 347 |
| 289 if test "$libtool" = yes; then | 348 if test "$libtool" = yes; then |
| 290 # With Tru64 cc, shared objects can also be used to make a | 349 # With Tru64 cc, shared objects can also be used to make a |
| 291 # static library. This mecanism is used in libtool 1.4 series to | 350 # static library. This mechanism is used in libtool 1.4 series to |
| 292 # handle both shared and static libraries in a single compilation. | 351 # handle both shared and static libraries in a single compilation. |
| 293 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. | 352 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. |
| 294 # | 353 # |
| 295 # With libtool 1.5 this exception was removed, and libtool now | 354 # With libtool 1.5 this exception was removed, and libtool now |
| 296 # generates 2 separate objects for the 2 libraries. These two | 355 # generates 2 separate objects for the 2 libraries. These two |
| 297 # compilations output dependencies in in $dir.libs/$base.o.d and | 356 # compilations output dependencies in $dir.libs/$base.o.d and |
| 298 # in $dir$base.o.d. We have to check for both files, because | 357 # in $dir$base.o.d. We have to check for both files, because |
| 299 # one of the two compilations can be disabled. We should prefer | 358 # one of the two compilations can be disabled. We should prefer |
| 300 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is | 359 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is |
| 301 # automatically cleaned when .libs/ is deleted, while ignoring | 360 # automatically cleaned when .libs/ is deleted, while ignoring |
| 302 # the former would cause a distcleancheck panic. | 361 # the former would cause a distcleancheck panic. |
| 303 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 | 362 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 |
| 304 tmpdepfile2=$dir$base.o.d # libtool 1.5 | 363 tmpdepfile2=$dir$base.o.d # libtool 1.5 |
| 305 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 | 364 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 |
| 306 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 | 365 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 |
| 307 "$@" -Wc,-MD | 366 "$@" -Wc,-MD |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 exit 0 | 580 exit 0 |
| 522 | 581 |
| 523 # Local Variables: | 582 # Local Variables: |
| 524 # mode: shell-script | 583 # mode: shell-script |
| 525 # sh-indentation: 2 | 584 # sh-indentation: 2 |
| 526 # eval: (add-hook 'write-file-hooks 'time-stamp) | 585 # eval: (add-hook 'write-file-hooks 'time-stamp) |
| 527 # time-stamp-start: "scriptversion=" | 586 # time-stamp-start: "scriptversion=" |
| 528 # time-stamp-format: "%:y-%02m-%02d.%02H" | 587 # time-stamp-format: "%:y-%02m-%02d.%02H" |
| 529 # time-stamp-end: "$" | 588 # time-stamp-end: "$" |
| 530 # End: | 589 # End: |
| OLD | NEW |