OT (maybe) How to create a library of libraries

Chris Johns chrisj at rtems.org
Tue Aug 21 21:50:11 UTC 2007

Robert S. Grimes wrote:
> So I created a new library (in projectroot/libs/uberlib) that has
> another Makefile.lib-based Makefile, except instead of putting object
> files into the output library, it puts the other libraries.

This will not work. The linker does not know the library is a library of 
libraries. The linker will only work with a library of object files. You need 
to *merge* the libraries.

> Am I missing something?  Or more accurately, what am I missing?

There is no standard way to do this. It is often hand crafted to suit your 
build system specifics. A nice example is already in RTEMS and used to build 
the librtemscpu.a library. Take a look in:


and search for 'librtemscpu.a: $(TMP_LIBS)'. This script code extracts the 
libraries into a directory then creates a new library containing all the 
extracted object files.


More information about the users mailing list