automake
[Top][All Lists]
Advanced

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

Re: automake/492: Compilation of assembler files with subdir-objects


From: Thomas Schwinge
Subject: Re: automake/492: Compilation of assembler files with subdir-objects
Date: Thu, 12 Oct 2006 11:13:11 +0200
User-agent: Mutt/1.5.6+20040907i

Hello!

On Thu, Oct 12, 2006 at 04:21:01AM -0000, Ralf Corsepius wrote:
> From: Ralf Corsepius <address@hidden>
>  On Thu, 2006-10-12 at 00:05 +0200, Thomas Schwinge wrote:
>  > On Wed, Oct 11, 2006 at 05:48:12AM +0200, Ralf Corsepius wrote:
>  > > On Tue, 2006-10-10 at 16:15 +0200, Thomas Schwinge wrote:
>  > > > On Sun, May 14, 2006 at 06:09:10AM +0200, Ralf Wildenhues wrote:
>  > > > > 
> http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=automake&pr=492
>  > 
>  > > > We were talking about the issue why Automake doesn't emit proper rules
>  > > > for compiling (pre processed) Assembler files (the .S ones) when using
>  > > > `AM_INIT_AUTOMAKE([subdir-objects])'.
>  > > >
>  > > > When using code file `libfoo_a_SOURCES = somewhere/a.S', Automake
>  > > > currently assembles `somewhere/a.S' and puts `a.o' into the current
>  > > > directory (as opposed to `somewhere/a.o'), but when creating `libfoo.a'
>  > > > it wants to add `somewhere/a.o', which will then obviously fail.
>  > 
>  > Indeed I can confirm that this isn't a problem anymore with the cvs
>  > version of Automake.
>  > 
>  > > Unfortunately so far, there had not been a new automake release since
>  > > then.
>  > 
>  > Is there already an estimation possible when this will happen?
>  
>  I wish I know that, at least I am eagerly waiting for it, because we
>  (rtems.org) can't avoid to ship a patched/hacked version of automake,
>  exactly because of this problem :(

What I'm doing in the mean time is applying the following hack (which is
both ugly and nice at the same time...  ;-) to _projects_ which depend on
that functionality, i.e. I don't patch Automake itself.

configure.ac
#v+
[...]
#
# Makefile.correct_output_files_for_.S_files.patch
#
# The used version of Automake might emit rules that don't put compiled (pre
# processed) Assembler files where they belong.  We're bitten by this bug
# because we use the Automake option `subdir-objects', to not clutter the main
# build directory with all the object files.  The problem is that the emitted
# rules will place those in the main build directory, but later, when creating
# the libraries, look for them in the subdirectories.
#
# See 
<http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=automake&pr=492>.
#
# Another note: even with versions of Automake that don't have this issue
# fixed, a correct rule is emitted for linux/src/arch/i386/lib/semaphore.S, see
# the comment by Thomas Schwinge on 2006-10-10 on the above bug report.
#
# Again, a real patch is being used here and not some `sed' magic, so that
# it'll fail loudly in case some internals we're relying on are changed.
#

AC_CONFIG_COMMANDS([frob_Makefile_for_correct_output_files_for_.S_files],[
  # Do we have a version of Automake that doesn't have this bug?
  if grep -q CPPASCOMPILE.\*-c.\*-o < "$srcdir"/Makefile.in
  then] AC_MSG_NOTICE([... not a problem with the used version of Automake.])
  [# We don't.
  elif "$PATCH" -f \
    < "$srcdir"/Makefile.correct_output_files_for_.S_files.patch
  then]
    AC_MSG_NOTICE([Applied a patch to fix a bug in your version of Automake.  ]
      [The applied fix should work in most cases.  You could also consider]
      [updating to Automake 1.10 or better.])
  [else]
    AC_MSG_ERROR([failed to patch using ]
      [`Makefile.correct_output_files_for_.S_files.patch'.  ]
      [You have a serious problem.  Please contact <$PACKAGE_BUGREPORT>.])
  [fi
],[
  PACKAGE_BUGREPORT=$PACKAGE_BUGREPORT
  PATCH=$PATCH
])

AC_OUTPUT
#v-

Makefile.correct_output_files_for_.S_files.patch
#v+
--- Makefile.save       2006-10-09 23:43:54.000000000 +0200
+++ Makefile    2006-10-09 23:57:00.000000000 +0200
@@ -1864,6 +1864,6 @@
            $(SHELL) ./config.status;; \
          *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ 
$(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $@ 
$(am__depfiles_maybe);; \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ 
frob_Makefile_for_correct_output_files_for_.S_files $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ 
frob_Makefile_for_correct_output_files_for_.S_files $(am__depfiles_maybe);; \
        esac;

@@ -3520,5 +3520,5 @@

 .S.o:
-       $(CCASCOMPILE) -c $<
+       $(CCASCOMPILE) -c -o $@ $<

 .S.obj:
#v-

As I promised: nice and ugly at the same time...


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


reply via email to

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