From: Keith M. <kei...@to...> - 2007-03-16 10:57:31
|
Damian Donnelly wrote: > The resulting ffpis.lib isn't a valid library. I could link both libs in > separately, but I would prefer to have just one binary. I'm investigating > how to do this, but if anyone already knows, I'd be grateful of help. > > ...I guess that they should be properly linked with a linker. No, I don't think that's going to help, unless it's a DLL you are trying to build. Offhand, I don't know of a direct way to merge two static libraries into one; (that's not to say that there isn't one; no doubt someone will enlighten us, if there is). Here is a brute force technique, which should work: $ cat Makefile all: foo.exe foo.c: echo '#include <stdio.h>' > $@ echo 'int main(){fee();fie();foe();fum();return 0;}' >> $@ fee.c fie.c foe.c fum.c: echo 'void $*(){printf("This is function '"'$*'"'\n");}' > $@ feefie.lib: fee.o fie.o; ar rcS $@ $^ foefum.lib: foe.o fum.o; ar rcS $@ $^ foobar.lib: feefie.lib foefum.lib for lib in $^; do \ ofiles=`ar t $$lib`; \ ar x $$lib $$ofiles; \ ar rc $@ $$ofiles; \ done ranlib $@ foo.exe: foo.c foobar.lib gcc -o $@ foo.c -L. -lfoobar HTH, Keith. |