automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC 10/20] depcomp: less duplication between AIX and Tru64 modes


From: Stefano Lattarini
Subject: [RFC 10/20] depcomp: less duplication between AIX and Tru64 modes
Date: Thu, 18 Oct 2012 22:40:44 +0200

* lib/depcomp (tru64, aix): In these entries of the big 'case'
switch, with the help of ...
(aix_post_process_depfile): ... this new function.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 lib/depcomp | 47 +++++++++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 20 deletions(-)

diff --git a/lib/depcomp b/lib/depcomp
index 7325cc9..f1ba7e5 100755
--- a/lib/depcomp
+++ b/lib/depcomp
@@ -74,6 +74,30 @@ set_base_from ()
   base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
 }
 
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    # No dependency file was actually created by the compiler invocation.
+    # No real dependency information will be available.
+    echo "#dummy" > "$depfile"
+  fi
+}
+
 # A tabulation character.
 tab='  '
 # A newline character.
@@ -291,19 +315,7 @@ aix)
   do
     test -f "$tmpdepfile" && break
   done
-  if test -f "$tmpdepfile"; then
-    # 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,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile"
-    sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> 
"$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
+  aix_post_process_depfile
   ;;
 
 icc)
@@ -517,13 +529,8 @@ tru64)
    do
      test -f "$tmpdepfile" && break
    done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile"
-      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> 
"$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
+   # Same post-processing that is required for AIX mode.
+   aix_post_process_depfile
    ;;
 
 msvc7)
-- 
1.8.0.rc2.11.gd25c58c




reply via email to

[Prev in Thread] Current Thread [Next in Thread]