In the following makeffile one macro process it's arguments to call another macro. I expect that makefile below will generate two targets and correct list of the targets in $TARGETS. But in fact it only generates one target with correct list. How to do such macro call in correct way?
all: $TARGETS define f2 .PHONY: target$(1) target$(1): echo "We are in $(1)" TARGETS+=target$(1) endef define f1 VAR$(1)=ValueWith$(1) $(eval $(call f2,$$(VAR$(1)))) endef $(eval $(call f1,CallOne)) $(eval $(call f1,CallTwo)) $(warning Warning: $(TARGETS))
output of make:
test.mk:16: warning: overriding recipe for target `target' test.mk:15: warning: ignoring old recipe for target `target' test.mk:18: Warning: targetValueWithCallOne targetValueWithCallTwo gmake: Nothing to be done for `all'.