automake-patches
[Top][All Lists]
Advanced

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

Re: depcomp: support newer HP compilers


From: Ralf Wildenhues
Subject: Re: depcomp: support newer HP compilers
Date: Tue, 3 Jan 2006 13:01:52 +0100
User-agent: Mutt/1.5.11

Hi Zack, Alexandre,

Sorry for a very late comment to this old thread; I now have access to
such a system.

* Zack Weinberg wrote on Sat, Jul 09, 2005 at 07:40:01PM CEST:
> Alexandre Duret-Lutz said:
> 
> >  zw> HP's documentation claims that a suitable option for "dashMstdout"
> >  zw> style would be "+M", but that provokes an error message and the
> >  zw> advice to use "+Make".  *That* works.  Better still, there's
> >  zw> "+Maked" which can be used as the basis of a new side-effect style.
> >
> > Is there an option to specify the name of the dependency output file?
> 
> I could not find any such option.

Me neither.

> > (I tried to find the documentation on HP's website, but got
> > lost, not knowing the name of the compiler and what OS to search
> > for.)
> 
> HP-UX 11.23 for ia64; the compiler is usually known as "acc".  However,
> the documentation that came with the compiler was out of date; it didn't
> mention +Make nor +Maked at all, and recommended the use of +M which
> doesn't work... They might have fixed it by now, though.

Yep, it's mentioned now.

> > This means that when depcomp runs libtool to do the compilation,
> > and libtool creates its object down in ./.libs/foo.o, then
> > we must fetch ./.libs/foo.d ?

Yes.

> > Unless we can specify the output file, we would need a scheme
> > similar to the tru64 mode.

Yes, this can be dealt with similarly to the tru64 case.

> >  zw> +  cat "$tmpdepfile" > "$depfile"
> >  zw> +  # Add `dependent.h:' lines.
> >  zw> +  sed -ne '2,${; s/^ //; s/ \\*$//; s/$/:/; p; }' "$tmpdepfile" >>
> > "$depfile"
> >
> > I assume the first line (ignored) contains the object file?
> 
> Yes.  This is not unlike other sed scripts in depcomp.
> 
> > Is the leading `;' important?
> 
> You mean the one immediately after the '{'?  Yes, that has to be there, or
> sed will give syntax errors.

I cannot reproduce the syntax errors (on B.11.23);
  sed -ne '2,${s/^ *//; s/ \\*$//; s/$/:/; p;}'

seems to work just fine (note I changed the first command to `s/^ *//').

Proposed patch below.  Tested with libtool-1.5 only, but I think it
should be ok for 1.4 as well (I have little desire to test though).

Note that ia64hp style, unlike tru64, removes all possible tmpdepfiles
with this patch.  It may be useful to change tru64 style to do this as
well.

I will try to rewrite a couple of the tests I used so they are suitable
for inclusion in Automake test suite.

I also noticed that the `gcc' and `hp' depmodes wrongly create
additional dummy dependencies for the primary (.c) source file or also
the object file (the latter of which is harmless).  In another mail.

Cheers,
Ralf

2006-0?-??  Zack Weinberg  <address@hidden>,
            Ralf Wildenhues  <address@hidden>

        * lib/depcomp: Add 'ia64hp' dependency style.
        (tru64): Fix typo.

Index: lib/depcomp
===================================================================
RCS file: /cvs/automake/automake/lib/depcomp,v
retrieving revision 1.55
diff -u -r1.55 depcomp
--- lib/depcomp 9 Jul 2005 09:24:40 -0000       1.55
+++ lib/depcomp 3 Jan 2006 04:28:51 -0000
@@ -276,6 +276,46 @@
   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.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
 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'.
@@ -288,7 +328,7 @@
 
    if test "$libtool" = yes; then
       # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mecanism is used in libtool 1.4 series to
+      # static library.  This mechanism is used in libtool 1.4 series to
       # handle both shared and static libraries in a single compilation.
       # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
       #




reply via email to

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