[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optional prerequisites
From: |
Vilar Camara Neto |
Subject: |
Re: Optional prerequisites |
Date: |
Wed, 31 Aug 2005 16:34:13 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Windows/20050716) |
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