Nathan Straz <[EMAIL PROTECTED]> writes:

> I have a makefile like this:
> ------------------------------
> $(LIBBAR): ../lib/libbar.a
>       $(MAKE) -C ../lib libbar.a
> $(LIBFAR): ../lib/libfar.a
>       $(MAKE) -C ../lib libfar.a
> 
> LIBS_foo := $(LIBBAR)
> LIBS_boo := $(LIBFAR)
> 
> %: %.c $(LIBS_%)
>       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) $(LIBS_$@)
> ------------------------------

You cannot do (at least not in mainline GNU make):

%: %.c $(LIBS_%)

The $(LIBS_%) expansion happens when makefile is read and stem (%) 
substitution happens later when the rule is tried.


> Can this be done with pattern rules?

Why don't you just tell make directly what you want:

foo: $(LIBBAR)
boo: $(LIBFAR)

%: %.c
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^

-boris



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

Reply via email to