[EMAIL PROTECTED] wrote:
ALL_BLOCKS := a b c d e
SOME_BLOCKS := c d
$(ALL_BLOCKS):
@echo "the target is ->$@<-"
ifeq ($@, $(filter $@, $(SOME_BLOCKS)))
@echo "yes ->$@<=>$(filter $@, $(SOME_BLOCKS))<-"
else
@echo "no ->$@<=>$(filter $@, $(SOME_BLOCKS))<-"
endif
That's not going to work because ifeq is handled when the Makefile is
parsed (not when the rule is when). While the Makefile is being parsed
$@ (and other automatic variables) are not set and hence you will not
get the result you expect.
I think you have two choice: replace your ifeq with $(if) or use $(eval)
(GNU Make 3.80 or above) to iterate through $(ALL_BLOCKS) and create
each rule with the appropriate body programmatically.
The $(if) variant would look something like this (I used the GNU Make
Standard Library to get its seq function):
include gmsl
ALL_BLOCKS := a b c d e
SOME_BLOCKS := c d
all: $(ALL_BLOCKS)
$(ALL_BLOCKS):
@echo "the target is ->$@<-"
$(if $(call seq,$@,$(filter $@,$(SOME_BLOCKS))), \
@echo "yes ->$@<=>$(filter $@, $(SOME_BLOCKS))<-", \
@echo "no ->$@<=>$(filter $@, $(SOME_BLOCKS))<-")
(You could in fact simplify $(call seq,$@,$(filter $@,$(SOME_BLOCKS)))
to just $(filter $@,$(SOME_BLOCKS)) and get the same result).
John.
--
John Graham-Cumming
[EMAIL PROTECTED]
Home: http://www.jgc.org/
POPFile: http://getpopfile.org/
Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make