[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
OT (maybe) RESOLVED - How to create a library of libraries
- Date: Wed, 22 Aug 2007 08:51:58 -0400
- From: rsg at alum.mit.edu (Robert S. Grimes)
- Subject: OT (maybe) RESOLVED - How to create a library of libraries
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
>
>