This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: [Combining libraries in subdirectories into one library]
- To: Murray Cumming <murrayc at usa dot net>
- Subject: Re: [Combining libraries in subdirectories into one library]
- From: "Gary V. Vaughan" <gvv at techie dot com>
- Date: Sat, 19 Aug 2000 23:08:27 +0100
- Cc: wgheath at fedex dot com, automake at gnu dot org, libtool at gnu dot org
- References: <20000818173309.6640.qmail@nwcst313.netaddress.usa.net>
On Fri, Aug 18, 2000 at 06:33:08PM +0100, Murray Cumming wrote:
> Tim Heath <th374862@cosd.fedex.com> wrote:
> > I need to understand better the way to combine libraries in
> > subdirectories into one library at the top_srcdir. Does anyone know of
> > an example that does this with static libraries I could look at? I
> > created the static libraries myself so I don't beleive there is any m4
> > macros for them to use in configure.in.
>
> If the page on my site does not explain this well enough then I would welcome
> a suggestion about something that should be improved.
>
> The downloadable example on the 'Building C/C++ libraries...' page combines
> libtool libraries from sub directories. The example on the 'Using autoconf and
> automake...' page combines static libraries from sub directories into an
> executable. It should take much more work to combine static libraries into one
> static library. Although, I believe that there is some way that a libtool
> library can be used to generate a static library.
There is. The libraries in the subdirectories should be built as
libtool convenience libraries. Each corresponding Makefile.am should
look a bit like this:
noinst_LTLIBRARIES = libsubdirectory.la
libsubdirectory_la_SOURCES = src1.c srcn.c
If you only want old style static ar archives, you must add:
libsubdirectory_la_LDFLAGS = -static
To combine a bunch of these in a different directory, the Makefile.am
looks something like this:
lib_LTLIBRARIES = libcombine.la
libcombine_la_SOURCES = comb1.c combn.c
libcombine_la_LIBADD = $(top_builddir)/sub1/libsubdirectory.la \
$(top_builddir)/subn/libanothersubdir.la
Again you can also add:
libcombin_la_LDFLAGS = -static
if you only want ar archives.
Cheers,
Gary.
--
___ _ ___ __ _ mailto: gvv@techie.com
/ __|__ _ _ ___ _| | / / | / /_ _ _ _ __ _| |_ __ _ ___ gary@gnu.org
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
\___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
home page: /___/ /___/ gpg public key:
http://www.oranda.demon.co.uk http://www.oranda.demon.co.uk/key.asc