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: NightStrike
Subject: Re: Overriding all commands in Makefile.am
Date: Fri, 10 Aug 2007 12:13:29 -0400

On 8/10/07, address@hidden <address@hidden> wrote:
>  -------------- Original message ----------------------
> From: NightStrike <address@hidden>
> > Since this list is obviously not dead, here's my first of several questions:
> >
> > (this is all with automake 1.10)
> >
> > How do I individually override everything that takes place for a given
> > target?  For example, if I have this:
> >
> > lib_LIBRARIES = libmylib.a
> > libmylib_a_SOURCES = source1.c source2.c
> >
> > The resulting Makefile will perform:
> >
> > $(CC) $(AM_CPPFLAGS) -o source1.o source1.c
> > $(CC) $(AM_CPPFLAGS) -o source2.o source2.c
> > $(AR) (AR_FLAGS) libmylib.a source1.o source2.o
> > $(RANLIB) libmylib.a
> >
> > I have the ability to override the AR command by setting libmylib_a_AR
> > to any arbitrary set of commands, allowing me to have incredible
> > control over step 3 above.  However, I have not found out how to do
> > the same for steps 1, 2, and 4 (or at the very least prevent RANLIB
> > from running).  For instance, I could, if I chose, do this:
> >
> > lib_LIBRARIES = libmylib.a
> > libmylib_a_SOURCES = source1.c source2.c
> > libmylib_a_AR = echo \!* > /dev/null
> >
> > and it would serve as a very kludgey (albeit effective) way to disable
> > the AR command for that target only (this is just an example..
> > obviously there are other, better ways to do it).  How do I achieve
> > the same overriding capabilities for everything?

> How about
>
> ./configure AR=:  [other arguments etc.]
>
> You also might be able to force this override in configure.ac, but that would
> defeat all the nifty things that the autotools are good for.
> Perhaps what you really want is "--disable-static" on the configure command 
> line.
> You can also make this the default to disable static libs with:
>
>           # Turn off static libraries, since they aren't useful in python 
> modules and
>           # make the build process take too long.
>           AC_DISABLE_STATIC
>           AC_PROG_LIBTOOL
>
> One of these should have the desired effect, depending on what you desire. ;)

I can't pass it in to configure, since this project includes many many
files, most of which are built normally.  There's just a few oddballs
that I need to override.  This is again my fault for not being more
explicit and oversimplifying my goals.

For most of the project, automake handles things well.  I use
xx_LIBRARIES, _SOURCES, etc and AR and RANLIB do what they need to do
very well.

For a few libraries, however, things get screwy.  Here's one example
of what I did to try to overcome that which I didn't understand:

lib_LIBRARIES += libmoldname.a
libmoldname_a_SOURCES = isascii.c iscsym.c iscsymf.c toascii.c
strcasecmp.c strncasecmp.c wcscmpi.c
libmoldname_a_AR = \
  $(DLLTOOL) --as $(AS) -k -U --dllname msvcrt.dll --def
$(top_srcdir)/moldname-msvcrt.def --output-lib $@ ; \
  $(AR) $(ARFLAGS)


Now, you can see that I am essentially trying to use DLLTOOL to work
in a .def file before calling $(AR), and then $(RANLIB) follows
naturally.  This works, but there is probably a more "correct" way of
doing it.  Any ideas?




reply via email to

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