automake
[Top][All Lists]
Advanced

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

Re: The automake/libtool way to make a dynamic lib from multiple sources


From: Ryan McDougall
Subject: Re: The automake/libtool way to make a dynamic lib from multiple sources
Date: Fri, 22 Sep 2006 09:54:21 +0900

On Thu, 2006-09-21 at 13:32 +0200, Ralf Wildenhues wrote:
> Hello Ryan,
> 
> * Ryan McDougall wrote on Thu, Sep 21, 2006 at 11:40:37AM CEST:
> > 
> > Im porting a large code-base from windows to linux, and attempting to
> > use autotools to do so. The code in SVN is essentially one big tree of
> > somewhat related modules -- lets call them foo, bar, etc (Projects under
> > MS VS). I need to produce 3 dynamic libraries that can be built from
> > those modules -- lets call them A.so, B.so, and C.so (Solutions under
> > VS). They depend on a non-overlapping, non-disjoint set of the source
> > code modules in the directory.
> 
> non-overlapping, non-disjoint sounds a bit like a typo; is it?
> Or do you mean they just partially overlap?

Yes, that was me being tired and not having my brain entirely in
English. :)
> 
> > Directories for A, B, and C also
> > contain .cpp files and appear in the same parent directory as foo, bar,
> > etc.
> > 
> > Currently I have all directories building respective "foo.la"s --
> > including A.la, B.la, and C.la, and have them installing correctly.
> > 
> > Problems: 
> > - I dont need the foo,bar,etc constituent libraries, I just need A,B,C
> > libraries, which means I have to manually delete them from the install
> > location afterwords
> 
> 2 possibilities:
> 
> 1) If you prefer recursive makefiles then you can have each directory
> create one (or a number of) libtool convenience archives
> (noinst_LTLIBRARIES), which you can merge into the real modules
> (A_la_LIBADD = ../foo/libfoo.la)
> 
> You should keep in mind that the convenience archives will end up in
> total (i.e., all their symbols, not just needed ones) in the resulting
> module.

This is a good point, thank you. Do you have any more information
somewhere that elaborates on this point?
> 
> 2) If you prefer nonrecursive makefiles (you may include makefile
> snippets from one into another), then you can just
> 
>   AUTOMAKE_OPTIONS = subdir-objects
>   module_LTLIBRARIES = libA.la libB.la libC.la
>   libA_la_SOURCES = foo/foo1.c bar/bar2.c A/a1.c ...
>   libB_la_SOURCES = baz/baz1/c bar/bar2.c B/b1.c ..

I thought of this, but in this case libA_la_SOURCES could be on the
order of 100-50 files long, which Id like to avoid if possible.

AUTOMAKE_OPTIONS=subdir-objects tells automake to build temporary
objects ("foo.lo") in the sub directories to improve build times?

What is the "module" target?

> > - I would like to be able to type "Make A" from the parent directory,
> > and have the build system figure out which among foo,bar,etc libraries
> > are needed by A and build them in the manner you would expect
> 
> The second approach will enable you to
>   make libA.la
> 
> in the toplevel directory.  Otherwise, there is nothing that prevents
> you from adding your own targets a la
>   A:
>         cd src/A && $(MAKE) $(AM_MAKEFLAGS) libA.la
>   .PHONY: A
> 
> just as in ordinary makefiles.

I already have this done, but I was hoping the was a more magic way to
do this.
> 
> Cheers,
> Ralf
> 

Thanks for all your help Ralf!

Cheers,





reply via email to

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