On Thu, 2005-05-26 at 21:50 +0100, Brendan Heading wrote:
> libfoo.a: $(FOO_OBJS)
>       $(AR) ...
> 
> libbar.a: $(BAR_OBJS)
>       $(AR) ...

I assume that the command being run as specified in the rule is
identical?

> 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) ...

I assume that the what you are doing is building a library (.a) from a
bunch of .o files.  You could do something like this:

    lib%.a:
        $(AR) r '$@' $^
        ranlib '$@'

then (as you have above), just specify the list of objects like this:

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

John.
-- 
John Graham-Cumming

Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/




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

Reply via email to