automake-patches
[Top][All Lists]
Advanced

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

depcomp: support newer HP compilers


From: Zack Weinberg
Subject: depcomp: support newer HP compilers
Date: Mon, 16 May 2005 16:19:21 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

I discovered today that the newer HP compilers (for their ia64
systems) don't match any depcomp style.  The preprocessor has been
integrated into the compiler front end, so -Wp, is silently ignored.
These systems don't ship 'makedepend', so that doesn't work either.
And the last-resort "cpp" style doesn't work because these compilers
print "#line", not "# ", at the beginning of their marker lines in -E
mode.

HP's documentation claims that a suitable option for "dashMstdout"
style would be "+M", but that provokes an error message and the advice
to use "+Make".  *That* works.  Better still, there's "+Maked" which
can be used as the basis of a new side-effect style.

The appended patch implements the new style and teaches the fallback
to handle this kind of -E output.

zw

        * lib/depcomp: Add 'ia64hp' dependency style.
        Handle "#line" markers as well as "# " markers in "cpp" style.

===================================================================
Index: lib/depcomp
--- lib/depcomp 14 May 2005 20:28:50 -0000      1.54
+++ lib/depcomp 16 May 2005 23:15:48 -0000
@@ -1,7 +1,7 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2005-05-14.22
+scriptversion=2005-05-16.16
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
 
@@ -276,6 +276,29 @@ icc)
   rm -f "$tmpdepfile"
   ;;
 
+ia64hp)
+  # The "hp" stanza above does not work with HP's ia64 compilers,
+  # which have integrated preprocessors.  The correct option to use
+  # with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  tmpdepfile=`echo "$object" | sed -e 's/\.o$/.d/'`
+  "$@" +Maked
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile"
+     exit $stat
+  fi
+  rm -f "$depfile"
+
+  # The object file name is correct already.
+  cat "$tmpdepfile" > "$depfile"
+  # Add `dependent.h:' lines.
+  sed -ne '2,${; s/^ //; s/ \\*$//; s/$/:/; p; }' "$tmpdepfile" >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
 tru64)
    # The Tru64 compiler uses -MD to generate dependencies as a side
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@@ -467,7 +490,8 @@ cpp)
   done
 
   "$@" -E |
-    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
     sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"




reply via email to

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