| 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=2005-07-09.11 |
| 5 | 5 |
| 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software | 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 7 # Foundation, Inc. | |
| 8 | 7 |
| 9 # This program is free software; you can redistribute it and/or modify | 8 # 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 | 9 # 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) | 10 # the Free Software Foundation; either version 2, or (at your option) |
| 12 # any later version. | 11 # any later version. |
| 13 | 12 |
| 14 # This program is distributed in the hope that it will be useful, | 13 # This program is distributed in the hope that it will be useful, |
| 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 # GNU General Public License for more details. | 16 # GNU General Public License for more details. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 # This is just like dashmstdout with a different argument. | 84 # This is just like dashmstdout with a different argument. |
| 86 dashmflag=-xM | 85 dashmflag=-xM |
| 87 depmode=dashmstdout | 86 depmode=dashmstdout |
| 88 fi | 87 fi |
| 89 | 88 |
| 90 case "$depmode" in | 89 case "$depmode" in |
| 91 gcc3) | 90 gcc3) |
| 92 ## gcc 3 implements dependency tracking that does exactly what | 91 ## gcc 3 implements dependency tracking that does exactly what |
| 93 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like | 92 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like |
| 94 ## it if -MD -MP comes after the -MF stuff. Hmm. | 93 ## it if -MD -MP comes after the -MF stuff. Hmm. |
| 95 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon | 94 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" |
| 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 "$@" | |
| 109 stat=$? | 95 stat=$? |
| 110 if test $stat -eq 0; then : | 96 if test $stat -eq 0; then : |
| 111 else | 97 else |
| 112 rm -f "$tmpdepfile" | 98 rm -f "$tmpdepfile" |
| 113 exit $stat | 99 exit $stat |
| 114 fi | 100 fi |
| 115 mv "$tmpdepfile" "$depfile" | 101 mv "$tmpdepfile" "$depfile" |
| 116 ;; | 102 ;; |
| 117 | 103 |
| 118 gcc) | 104 gcc) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 fi | 194 fi |
| 209 rm -f "$tmpdepfile" | 195 rm -f "$tmpdepfile" |
| 210 ;; | 196 ;; |
| 211 | 197 |
| 212 aix) | 198 aix) |
| 213 # The C for AIX Compiler uses -M and outputs the dependencies | 199 # The C for AIX Compiler uses -M and outputs the dependencies |
| 214 # in a .u file. In older versions, this file always lives in the | 200 # in a .u file. In older versions, this file always lives in the |
| 215 # current directory. Also, the AIX compiler puts `$object:' at the | 201 # current directory. Also, the AIX compiler puts `$object:' at the |
| 216 # start of each line; $object doesn't have directory information. | 202 # start of each line; $object doesn't have directory information. |
| 217 # Version 6 uses the directory in both cases. | 203 # Version 6 uses the directory in both cases. |
| 218 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 204 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` |
| 219 test "x$dir" = "x$object" && dir= | 205 tmpdepfile="$stripped.u" |
| 220 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | |
| 221 if test "$libtool" = yes; then | 206 if test "$libtool" = yes; then |
| 222 tmpdepfile1=$dir$base.u | |
| 223 tmpdepfile2=$base.u | |
| 224 tmpdepfile3=$dir.libs/$base.u | |
| 225 "$@" -Wc,-M | 207 "$@" -Wc,-M |
| 226 else | 208 else |
| 227 tmpdepfile1=$dir$base.u | |
| 228 tmpdepfile2=$dir$base.u | |
| 229 tmpdepfile3=$dir$base.u | |
| 230 "$@" -M | 209 "$@" -M |
| 231 fi | 210 fi |
| 232 stat=$? | 211 stat=$? |
| 233 | 212 |
| 213 if test -f "$tmpdepfile"; then : |
| 214 else |
| 215 stripped=`echo "$stripped" | sed 's,^.*/,,'` |
| 216 tmpdepfile="$stripped.u" |
| 217 fi |
| 218 |
| 234 if test $stat -eq 0; then : | 219 if test $stat -eq 0; then : |
| 235 else | 220 else |
| 236 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" | 221 rm -f "$tmpdepfile" |
| 237 exit $stat | 222 exit $stat |
| 238 fi | 223 fi |
| 239 | 224 |
| 240 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" | |
| 241 do | |
| 242 test -f "$tmpdepfile" && break | |
| 243 done | |
| 244 if test -f "$tmpdepfile"; then | 225 if test -f "$tmpdepfile"; then |
| 226 outname="$stripped.o" |
| 245 # Each line is of the form `foo.o: dependent.h'. | 227 # Each line is of the form `foo.o: dependent.h'. |
| 246 # Do two passes, one to just change these to | 228 # Do two passes, one to just change these to |
| 247 # `$object: dependent.h' and one to simply `dependent.h:'. | 229 # `$object: dependent.h' and one to simply `dependent.h:'. |
| 248 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" | 230 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" |
| 249 # That's a tab and a space in the []. | 231 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" |
| 250 sed -e 's,^.*\.[a-z]*:[» ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
| 251 else | 232 else |
| 252 # The sourcefile does not contain any dependencies, so just | 233 # The sourcefile does not contain any dependencies, so just |
| 253 # store a dummy comment line, to avoid errors with the Makefile | 234 # store a dummy comment line, to avoid errors with the Makefile |
| 254 # "include basename.Plo" scheme. | 235 # "include basename.Plo" scheme. |
| 255 echo "#dummy" > "$depfile" | 236 echo "#dummy" > "$depfile" |
| 256 fi | 237 fi |
| 257 rm -f "$tmpdepfile" | 238 rm -f "$tmpdepfile" |
| 258 ;; | 239 ;; |
| 259 | 240 |
| 260 icc) | 241 icc) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 288 # Do two passes, one to just change these to | 269 # Do two passes, one to just change these to |
| 289 # `$object: dependent.h' and one to simply `dependent.h:'. | 270 # `$object: dependent.h' and one to simply `dependent.h:'. |
| 290 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" | 271 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" |
| 291 # Some versions of the HPUX 10.20 sed can't process this invocation | 272 # Some versions of the HPUX 10.20 sed can't process this invocation |
| 292 # correctly. Breaking it into two sed invocations is a workaround. | 273 # correctly. Breaking it into two sed invocations is a workaround. |
| 293 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | | 274 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | |
| 294 sed -e 's/$/ :/' >> "$depfile" | 275 sed -e 's/$/ :/' >> "$depfile" |
| 295 rm -f "$tmpdepfile" | 276 rm -f "$tmpdepfile" |
| 296 ;; | 277 ;; |
| 297 | 278 |
| 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 | |
| 338 tru64) | 279 tru64) |
| 339 # The Tru64 compiler uses -MD to generate dependencies as a side | 280 # 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'. | 281 # 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 | 282 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put |
| 342 # dependencies in `foo.d' instead, so we check for that too. | 283 # dependencies in `foo.d' instead, so we check for that too. |
| 343 # Subdirectories are respected. | 284 # Subdirectories are respected. |
| 344 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 285 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
| 345 test "x$dir" = "x$object" && dir= | 286 test "x$dir" = "x$object" && dir= |
| 346 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | 287 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
| 347 | 288 |
| 348 if test "$libtool" = yes; then | 289 if test "$libtool" = yes; then |
| 349 # With Tru64 cc, shared objects can also be used to make a | 290 # With Tru64 cc, shared objects can also be used to make a |
| 350 # static library. This mechanism is used in libtool 1.4 series to | 291 # static library. This mecanism is used in libtool 1.4 series to |
| 351 # handle both shared and static libraries in a single compilation. | 292 # handle both shared and static libraries in a single compilation. |
| 352 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. | 293 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. |
| 353 # | 294 # |
| 354 # With libtool 1.5 this exception was removed, and libtool now | 295 # With libtool 1.5 this exception was removed, and libtool now |
| 355 # generates 2 separate objects for the 2 libraries. These two | 296 # generates 2 separate objects for the 2 libraries. These two |
| 356 # compilations output dependencies in $dir.libs/$base.o.d and | 297 # compilations output dependencies in in $dir.libs/$base.o.d and |
| 357 # in $dir$base.o.d. We have to check for both files, because | 298 # in $dir$base.o.d. We have to check for both files, because |
| 358 # one of the two compilations can be disabled. We should prefer | 299 # one of the two compilations can be disabled. We should prefer |
| 359 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is | 300 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is |
| 360 # automatically cleaned when .libs/ is deleted, while ignoring | 301 # automatically cleaned when .libs/ is deleted, while ignoring |
| 361 # the former would cause a distcleancheck panic. | 302 # the former would cause a distcleancheck panic. |
| 362 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 | 303 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 |
| 363 tmpdepfile2=$dir$base.o.d # libtool 1.5 | 304 tmpdepfile2=$dir$base.o.d # libtool 1.5 |
| 364 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 | 305 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 |
| 365 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 | 306 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 |
| 366 "$@" -Wc,-MD | 307 "$@" -Wc,-MD |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 exit 0 | 521 exit 0 |
| 581 | 522 |
| 582 # Local Variables: | 523 # Local Variables: |
| 583 # mode: shell-script | 524 # mode: shell-script |
| 584 # sh-indentation: 2 | 525 # sh-indentation: 2 |
| 585 # eval: (add-hook 'write-file-hooks 'time-stamp) | 526 # eval: (add-hook 'write-file-hooks 'time-stamp) |
| 586 # time-stamp-start: "scriptversion=" | 527 # time-stamp-start: "scriptversion=" |
| 587 # time-stamp-format: "%:y-%02m-%02d.%02H" | 528 # time-stamp-format: "%:y-%02m-%02d.%02H" |
| 588 # time-stamp-end: "$" | 529 # time-stamp-end: "$" |
| 589 # End: | 530 # End: |
| OLD | NEW |