在手册中:
The eval function is very special: it allows you to define new
makefile constructs that are not constant; which are the result of
evaluating other variables and functions. The argument to the eval
function is expanded,then the results of that expansion are parsed as
makefile Syntax.It’s important to realize that the eval argument is expanded twice;
first by the eval function,then the results of that expansion are
expanded again when they are parsed as makefile Syntax. This means you
may need to provide extra levels of escaping for “$” characters when
using eval.
“扩大两次”让我感到困惑.
例如,我创建一个makefile:
define func tmp = $(OBJPATH)/$(strip $1) objs += $$(tmp) $$(tmp) : $2 gcc $$^ -o $$@ endef all : foo $(eval $(call func,foo,1.c))
如何扩展评估功能?