[Top][All Lists]

[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: Ralf Wildenhues
Subject: Re: The automake/libtool way to make a dynamic lib from multiple sources
Date: Thu, 21 Sep 2006 13:32:12 +0200
User-agent: Mutt/1.5.13 (2006-09-01)

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,, and (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?

> 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 ""s --
> including,, and, 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/

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

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_SOURCES = foo/foo1.c bar/bar2.c A/a1.c ...
  libB_la_SOURCES = baz/baz1/c bar/bar2.c B/b1.c ..

> - 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

in the toplevel directory.  Otherwise, there is nothing that prevents
you from adding your own targets a la
        cd src/A && $(MAKE) $(AM_MAKEFLAGS)

just as in ordinary makefiles.


reply via email to

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