为什么我不能在GNU makefile中定义之后使用'='?文档建议我可以

blu*_*ift 2 makefile gnu-make

我正试图define在GNU make中使用.在这个测试上运行make Makefile回应"虚拟":

define FOO =
$$(error foo $(1))
endef

$(eval $(call FOO,bar))

all:
    @echo dummy
Run Code Online (Sandbox Code Playgroud)

如果我删除了=,那么它会foo bar按照我的意图出错.

GNU make手册包含所有定义示例,使用带有等号的表单.为什么这对我来说似乎被忽略了?

Eld*_*mov 6

define 在GNU Make 3.82中引入了赋值,很可能是你使用的是旧版本.

但是,在最近的版本define foo =中与plain相同define foo,只需使用后者即可使用3.82之前的版本.