]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* depcomp (gcc): Imported comments removed from depend2.am, so
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Tue, 27 Apr 1999 15:57:42 +0000 (15:57 +0000)
committerAlexandre Oliva <oliva@dcc.unicamp.br>
Tue, 27 Apr 1999 15:57:42 +0000 (15:57 +0000)
that we don't lose them.

ChangeLog
depcomp

index 614add582ac84e7e6a612ae4a54b02114fa988b8..2d5ad82d7058323087666d1198e742571bc09a73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1999-04-27  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
+       * depcomp (gcc): Imported comments removed from depend2.am, so
+       that we don't lose them.
+
        * m4/depout.m4 (AM_OUTPUT_DEPENDENCY_COMMANDS): Avoid sed s/$U//
        when not using ansi2knr.
 
diff --git a/depcomp b/depcomp
index 694ec3ce1b1ff2257d9e442e6206c2b56983ea1c..951a984ca057ceb5cd4d211232b0b64a24fb68fb 100755 (executable)
--- a/depcomp
+++ b/depcomp
@@ -36,6 +36,15 @@ rm -f "$tmpdepfile"
 
 case "$depmode" in
 gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
   if "$@" -Wp,-MD,"$tmpdepfile"; then :
   else
     stat=$?
@@ -45,8 +54,17 @@ gcc)
   rm -f "$depfile" 
   echo "$object : \\" > "$depfile"
   sed 's/^[^:]*: / /' < "$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.  Too bad gcc doesn't do
+## this for us directly.
   tr ' ' '
-' < "$tmpdepfile" | \
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;