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



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to