On Tuesday 03 May 2005 5:05 pm, Chris Kwasneski wrote:
LIBS = -llib1 -llib2 -llib3 -llib4 -llib5 -llib6 -llib7
And then in each directory (prog1, prog2...) makefile:
include ../Makefile ... gcc -o $(PROGRAM) $(libs) -Xlinker --strip-unused-libs This is going to cause all 7 libraries to be included.
One possible solution is to make your libraries shared objects. Then they
will only be used at run time. In theory, only those libraries that have
symbols required by your objects should be linked in.
if you have 2 libraries, lib1 and lib2. lib1 contains the definition for
function foo and bar, and lib2 contains the definitions for fubar and
barfu. You have a C file that references foo:
The gcc -o foobar foobar.c -llib1 -llib2
In this case only lib1 SHOULD be pulled in.
But, as I mentioned before, be careful not to reference anything in lib2
from foo.c.
--
Jerry Feldman