help-make
[Top][All Lists]
Advanced

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

expanding $(%) in prerequisites


From: William F. Dowling
Subject: expanding $(%) in prerequisites
Date: Thu, 14 Dec 2000 11:32:18 -0500 (EST)

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?

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




reply via email to

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