www.delorie.com/gnu/docs/automake/automake_43.html   search  
 
Buy GNU books!


automake

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.2 Building a library

Building a library is much like building a program. In this case, the name of the primary is `LIBRARIES'. Libraries can be installed in libdir or pkglibdir.

See section 9.3 Building a Shared Library, for information on how to build shared libraries using Libtool and the `LTLIBRARIES' primary.

Each `_LIBRARIES' variable is a list of the libraries to be built. For instance to create a library named `libcpio.a', but not install it, you would write:

 
noinst_LIBRARIES = libcpio.a

The sources that go into a library are determined exactly as they are for programs, via the `_SOURCES' variables. Note that the library name is canonicalized (see section 2.4 How derived variables are named), so the `_SOURCES' variable corresponding to `liblob.a' is `liblob_a_SOURCES', not `liblob.a_SOURCES'.

Extra objects can be added to a library using the `library_LIBADD' variable. This should be used for objects determined by configure. Again from cpio:

 
libcpio_a_LIBADD = @LIBOBJS@ @ALLOCA@

In addition, sources for extra objects that will not exist until configure-time must be added to the BUILT_SOURCES variable (see section 10.4 Built sources).


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003