I have 50 odd utility programs that are all part of one 'system'. I currently have a make file that cascade builds each one from a higher level directory. Each program is in its own directory, and has its own makefile. Each program uses 4 (ish) of 7 libraries. Each program using a different set of 4 out of the 7l. What I'd like to do is place the list of 7 libraries in a higher make file and include them at the lower make file.
However, when I build them, I currently get all 7 libraries linked in, even though the program needs only 4. Is there a way to tell gcc or ld to trim unused libraries?
I did a search, and I found a -strip-dead for ld, but it doesn't seem to work. I also tried --no-whole-archive, and a -Wl switch that escapes me right now.. What does your CFLAGS or LDFLAGS look like? Or, when you link a program: gcc -o <progname> -L<library directory> foo.o -llib1 -llib2 -llib5 -llib7 The -l (lower case l) is what will incorporate the libraries into each
On Tuesday 03 May 2005 4:34 pm, Chris Kwasneski wrote:
program.
In the above case, you should only draw in the listed 4 libraries.
Alternatively:
gcc -o <progname> -L<library directory> foo.o lib1.a, lib2.a, lib5.a, lib7.a
You've also got to be careful that the libraries do not reference eachother.
--
Jerry Feldman