Paul D. Smith wrote:

>> All you can do is something like this:
>>
>>     %.z: %.x
>>             ...
>>
>>     all: foo.z bar.z
>>
>>     foo.z: $(wildcard foo.y)
>>     bar.z: $(wildcard bar.y)
>>
>> You can do the latter using a loop and avoid writing it out. if you have
>> a GNU make sufficiently new to have the $(eval ...) function.


Yes, $(eval ...) was the key that I was missing.  As you said, a loop
solves the problem:

----------

TARGETS = first.z second.z

all: $(TARGETS)

%.z: %.x
        echo $^

define BUILD_TARGET
 $(1): $(wildcard $(1:%.z=%.y))
endef

$(foreach target,$(TARGETS),$(eval $(call BUILD_TARGET,$(target))))

----------

Charming indeed...  :-)   Thanks very much!

Best regards,
Vilar Neto




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

Reply via email to