help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Building libraries 101


From: Brendan Heading
Subject: Building libraries 101
Date: Thu, 26 May 2005 21:50:27 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

OK,

Here's what probably a dumb question. Say I've got a bunch of libraries to build. At present I'm doing :

libfoo.a: $(FOO_OBJS)
        $(AR) ...

libbar.a: $(BAR_OBJS)
        $(AR) ...

and I have to repeat that sequence for each library. If I've got 50 libraries, it seems like a lot of repetition to essentially keep saying the same thing. Is there any way I can state my build rules for libraries more concisely ?

I can do one optimization like :

libbar.a: $(BAR_OBJS)
        $(AR_FUNCTION)

and set AR_FUNCTION to be my $(AR) ... command line. That way at least I define the linker commands in only one place.

Any suggestions ?

a couple of ideas .. can I specify the same rule twice ? ie in one part of the makefile have the prerequisites defined :

libfoo.a:$(FOO_OBJS)
libbar.a:$(BAR_OBJS)
libbaz.a:$(BAZ_OBJS)

and then in another part of the makefile have a generic rule that determines what must be done to satisfy a build, ie

lib*.a:
        $(AR_COMMAND) ...

??

Brendan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]