automake
[Top][All Lists]
Advanced

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

Re: Overriding all commands in Makefile.am


From: Ralf Wildenhues
Subject: Re: Overriding all commands in Makefile.am
Date: Fri, 10 Aug 2007 19:43:57 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

* NightStrike wrote on Fri, Aug 10, 2007 at 12:00:21AM CEST:
> On 8/9/07, Ralf Wildenhues <address@hidden> wrote:
> > * NightStrike wrote on Thu, Aug 09, 2007 at 04:49:00PM CEST:
> > >

> Well, I don't want or need to do this exactly.  I was just
> illustrating that I *could*.  I'll give a better example of something
> that I'm doing with automake that I know is wrong but that I can't
> figure out how to do properly.

Ahh, you're going in the right direction: show what you want to achieve,
not how you think it would be best to do it.

> For a particular project, there are a handful of .c files that need to
> be compiled to .o files and installed as .o files, not linked into any
> executable.  I came up with this ugly workaround:

Well, I think the cheapest and least error-prone operation is the
creation of a static library.  Unless you need it otherwise, set
  RANLIB = :

in this Makefile.am, and
  noinst_LIBRARIES = libfoo.a
  libfoo_a_SOURCES = ...

You could even hack like this (but I won't guarantee that it won't break
with another Automake release):
  AR = :
  ARFLAGS = >

> Specifically, the first gets compiled into both crt1.o and crt2.o, and
> the second gets compiled into both dllcrt1.o and dllcrt2.o.  The
> compilation options for XX1.o are the same, and the options for XX2.o
> are the same.  I came up with this equally ugly workaround:

I don't think this is all that ugly.  But I don't see why you should
need BUILT_SOURCES, at least not from this snippet alone; you could just
as well list those .o files as dependencies to all-local, or put them in
some libexecdir_SCRIPTS or so.  And I think you can make use of COMPILE
to your advantage, instead of using CC directly.

> BUILT_SOURCES = crt1.o crt2.o dllcrt1.o dllcrt2.o
> crt1.o:
>       $(CC) $(AM_CPPFLAGS) -I$(top_srcdir) -D__CRTDLL__ -U__MSVCRT__ -c
> $(top_srcdir)/crtexe.c -o $@
> crt2.o:
>       $(CC) $(AM_CPPFLAGS) -I$(top_srcdir) -D__MSVCRT__ -U__CRTDLL__ -c
> $(top_srcdir)/crtexe.c -o $@
> dllcrt1.o:
>       $(CC) $(AM_CPPFLAGS) -I$(top_srcdir) -D__CRTDLL__ -U__MSVCRT__ -c
> $(top_srcdir)/crtdll.c -o $@
> dllcrt2.o:
>       $(CC) $(AM_CPPFLAGS) -I$(top_srcdir) -D__MSVCRT__ -U__CRTDLL__ -c
> $(top_srcdir)/crtdll.c -o $@

Hope that helps.

Cheers,
Ralf




reply via email to

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