Here's a patch to the depcomp cpp method that:

* makes its output more similar to the gcc method
* removes trailing line numbers produced by cpp

I wasn't convinced that the old method actually gave make the right
dependencies, so I copied the gcc format which is easier to read and
it wider use.

Old depcomp cpp method output:

object: foo.h 1
object: foo2.h 2
object: bar.h 3
object: bar2.h 4
foo.h:
foo2.h:
bar.h:
bar2.h:

Newer more "gcc like" cpp method output (apologys for the extra new line :^):

object: \
 foo.h \
 foo2.h \
 bar.h \
 bar2.h \

foo.h:
foo2.h:
bar.h:
bar2.h:

Here's the patch against cvs.

Index: depcomp
===================================================================
RCS file: /cvs/automake/automake/depcomp,v
retrieving revision 1.7
diff -u -r1.7 depcomp
--- depcomp     2000/06/02 23:27:02     1.7
+++ depcomp     2000/06/23 11:41:47
@@ -250,7 +250,8 @@
       ;;
     esac
     "$@" -E |
-    sed -n '/^# [0-9][0-9]* "\([^"]*\)"/ s::'"$object"'\: \1:p' > "$tmpdepfile"
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' > "$tmpdepfile"
+    echo >> "$tmpdepfile"
   ) &
   proc=$!
   "$@"
@@ -258,8 +259,9 @@
   wait "$proc"
   if test "$stat" != 0; then exit $stat; fi
   rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed < "$tmpdepfile" -e 's/^[^:]*: //' -e 's/$/ :/' >> "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" -e '/^$/d' -e 's/^ //' -e 's/ \\$//' -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 

Reply via email to