Here's a puzzler.  Using the test.mk attached, I get the output I expect
with a "make all:"

VARa1 = var1
VARa2 = 
vara1 yes
testa done!
VARb1 = var1
VARb2 = 
varb1 yes
testb done!

However, if I uncomment one of the lines calling testera or testerb, I get
a "missing separator" error.  I might have expected both $(info) calls to 
fire when passing args 3 and 4 to testa/testb (which isn't what I want)
but I don't see any syntax problems.

Any ideas?

How can I properly delay the $(info) calls to only fire under the $(if) in
the testa/testb rules?  Assume the call depth is arbitrary.

Thanks.

                                                 -Dave
testb1 = $(info varb1 yes)
testb2 = $(info varb2 yes)

define testa
.PHONY: testa
testa: varseta
	$$(info $(1) = $$($(1)))
	$$(info $(2) = $$($(2)))
	$$(if $$($(1)),$(3))
	$$(if $$($(2)),$(4))
	@echo testa done!

TESTS += testa
endef

define testb
.PHONY: testb
testb: varsetb
	$$(info $(1) = $$($(1)))
	$$(info $(2) = $$($(2)))
	$$(if $$($(1)),$$($(3)))
	$$(if $$($(2)),$$($(4)))
	@echo testb done!

TESTS += testb
endef

testera = $(eval $(call testa,$(1),$(2),$(3),$(4)))
testerb = $(eval $(call testb,$(1),$(2),$(3),$(4)))


#$(call testera,VAR1,VAR2,$$(info var1 yes),$$(info var2 yes)))
#$(call testerb,VAR1,VAR2,test1,test2))

$(eval $(call testa,VARa1,VARa2,$$(info vara1 yes),$$(info vara2 yes)))
$(eval $(call testb,VARb1,VARb2,testb1,testb2))

all: $(TESTS)

.PHONY: varseta
varseta:
	$(eval VARa1 := var1)
	$(eval VARa2 :=)

.PHONY: varsetb
varsetb:
	$(eval VARb1 := var1)
	$(eval VARb2 :=)

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

Reply via email to