aboutsummaryrefslogtreecommitdiff
path: root/contrib/cvs/depcomp
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2002-09-02 05:50:28 +0000
committerPeter Wemm <peter@FreeBSD.org>2002-09-02 05:50:28 +0000
commitb2b29aad0d0d63394479a7459a0f17936ce7c064 (patch)
tree8440832ece5130fad994f5f3489b01676ab1ca4a /contrib/cvs/depcomp
parent025111ae1321e9d30f5615b762a47fb354971ba1 (diff)
Import cvs-1.11.2 onto vendor branch
Obtained from: http://www.cvshome.org/
Notes
Notes: svn path=/vendor/cvs/dist/; revision=102840
Diffstat (limited to 'contrib/cvs/depcomp')
-rwxr-xr-xcontrib/cvs/depcomp81
1 files changed, 60 insertions, 21 deletions
diff --git a/contrib/cvs/depcomp b/contrib/cvs/depcomp
index 86774be1e7cd..02458b8923a3 100755
--- a/contrib/cvs/depcomp
+++ b/contrib/cvs/depcomp
@@ -123,18 +123,29 @@ sgi)
rm -f "$tmpdepfile"
exit $stat
fi
+ rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
- rm -f "$depfile"
- cp "$tmpdepfile" "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header). We avoid this by adding
-## dummy dependencies for each header file.
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
tr ' ' '
-' < "$tmpdepfile" | \
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' -e '/^#/d' | sed -e 's/$/ :/' >> "$depfile"
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -146,8 +157,12 @@ sgi)
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
- # in a .u file.
- tmpdepfile=`echo "$object" | sed 's/\(.*\)\..*$/\1.u/'`
+ # in a .u file. This file always lives in the current directory.
+ # Also, the AIX compiler puts `$object:' at the start of each line;
+ # $object doesn't have directory information.
+ stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
@@ -162,16 +177,11 @@ aix)
fi
if test -f "$tmpdepfile"; then
- rm -f "$depfile"
- cp "$tmpdepfile" "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header). We avoid this by adding
-## dummy dependencies for each header file.
- tr ' ' '
-' < "$tmpdepfile" | \
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -181,6 +191,35 @@ aix)
rm -f "$tmpdepfile"
;;
+tru64)
+ # The Tru64 AIX compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # Subdirectories are respected.
+
+ tmpdepfile="$object.d"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-MD
+ else
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a space and a tab in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.