有没有办法在gmake的makefile中执行此类操作:
GOALS := g1
define fun_one
@echo "blabla" #this causes an error - maybe can't be recognized as a recipe
endef
define fun_two
$(1):
$(eval $(call fun_one,$(1)))
endef
$(forech goal, $(GOALS), $(eval $(call fun_two,$(goal))))
all: ${GOALS}
据我了解,我不能在定义规则的函数之外定义配方的一部分,我写的吗?
答案 0 :(得分:2)
不需要第一个eval
;它只是告诉Make制作该行,同时它还在解析fun_one 的定义。消除eval,makefile将起作用:
define fun_two
$(1):
$(call fun_one,$(1))
endef