[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nested eval
From: |
David A. Greene |
Subject: |
Nested eval |
Date: |
Fri, 31 Aug 2007 21:56:44 -0500 |
User-agent: |
KMail/1.9.5 |
More fun with GNU make 2.81:
I have this Makefile:
define testa
testa_target := $$(eval $(1))
testa: $$(testa_target)
touch $$@
@echo testa done!
TESTS += testa
endef
define testb
$(1):
touch $$@
@echo testb done!
endef
testera = $(eval $(call testa,$(1)))
testerb = $(eval $(call testb,$(1))) $(1)
__sink := $(call testera,$$(call testerb,targetb))
all: $(TESTS)
The intent is to generate rule testa to depend on the target of the rule
created by invoking testerb.
A "make all" results in this:
test.mk:19: *** missing separator. Stop.
A "remake all" (GNU make debugger) gives this:
Reading makefiles...
Reading makefile `test.mk'...
calling testera("$(call testerb,targetb)")
calling testa("$(call testerb,targetb)")
testa() returns "testa_target := $(eval $(call testerb,targetb))
testa: $(testa_target)
touch $@
@echo testa done!
TESTS += testa"
calling testerb("targetb")
calling testb("targetb")
testb() returns "targetb:
touch $@
@echo testb done!"
testerb() returns " targetb"
test.mk:19: *** missing separator. Stop.
Command-line arguments:
"-d -f test.mk"
So it looks like things are generated correctly but remake never reports
the return value for the call to testera, almost like the call sequence got
prematurely terminated.
Is doing a nested eval like this legal? If not, is there an alternative way
to do what I'm attempting?
-Dave
- Nested eval,
David A. Greene <=