OT (maybe) RESOLVED - How to create a library of libraries
Robert S. Grimes
rsg at alum.mit.edu
Wed Aug 22 12:51:58 UTC 2007
Hi Chris,
That worked like a charm!!! Thanks, to you, and whoever wrote the
original code! Here's what I'm now using in my new Makefile, which is
simplified a bit, as I'm only assembling libraries:
$(LIB): ${SUBLIBS}
rm -f $@
rm -rf $(ARCH)/*.o
for f in $(SUBLIBS); do \
cd $(ARCH); \
$(AR) xv ../$$f || exit 1; \
chmod a-w * ; \
cd ..; \
done
ls $(ARCH)/* > $@-list
$(AR) rc $@ @$@-list
rm -f $@-list $(ARCH)/*.o
$(RANLIB) $@
And now I only need to link in one library, instead of seven (now, and
still counting!) - wicked!
Thanks again,
-Bob
Chris Johns wrote:
> 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:
>
> cpukit/wrapup/Makefile.am
>
> 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.
>
> Regards
> Chris
>
>
More information about the users
mailing list