[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
expanding $(%) in prerequisites
From: |
Jacob Burckhardt |
Subject: |
expanding $(%) in prerequisites |
Date: |
Thu, 14 Dec 2000 11:36:05 -0800 (PST) |
William F. Dowling writes:
>
> I have definitions and rules like this:
>
> foo_EXTRAOBJS = $(BIN)/bar.o
> goo_EXTRAOBJS = $(BIN)/baz.o
>
> $(BIN)/foo : foo.c $(foo_EXTRAOBJS)
> $(CC) $(CFLAGS) -o $@ foo.c $(foo_EXTRAOBJS)
> $(BIN)/goo : goo.c $(goo_EXTRAOBJS)
> $(CC) $(CFLAGS) -o $@ goo.c $(goo_EXTRAOBJS)
>
> Naturally, I'd like to keep my nice declarative style for specifying
> extra objects that need to be linked, while using a pattern rule for
> the build. I've tried this:
>
> $(BIN)/% : %.c $(%_EXTRAOBJS)
> $(CC) $(CFLAGS) -o $@ $< $(*_EXTRAOBJS)
>
> Although the command seems ok, $(foo_EXTRAOBJS) is not being picked up
> as a prerequisite. I've tried quite a few other strategems too, but I
> never seem to be able to get the prerequisite to work.
>
> Can someone suggest a way to make something like this work?
BIN = bin
$(BIN)/foo: $(BIN)/bar.o
$(BIN)/goo: $(BIN)/baz.o $(BIN)/baz2.o
$(BIN)/% : %.c
$(CC) $(CFLAGS) -o $@ $^
>
> Please reply to me (address@hidden) as well as the list.
> Many thanks in advance.
>
> Will
>
>
> --
> William F. Dowling
> ISI/Thomson Scientific (www.isinet.com)
> 215-386-0100 x-1156
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make
--