Makefile gmake:eval函数中的配方内部

Makefile gmake:eval函数中的配方内部,makefile,gnu-make,Makefile,Gnu Make,在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,$(go

在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}

据我所知,我不能在定义规则的函数之外定义配方的一部分,是吗?

不需要第一个
eval
;它只是告诉Make在解析fun_one的定义时执行这一行。消除eval,生成文件将工作:

define fun_two
$(1):
$(call fun_one,$(1))
endef

这没有帮助:foreach行出错:“***缺少分隔符。停止。”当@echo“blabla”被注释时-否errors@Riga:我要冒险出去:那应该是
fun\u one
中的一个标签,但我敢打赌它只是空格。