我正在使用GNU Make 3.81。以下makefile可以正常工作:
name=lucas
all: test
.PHONY: test
test:
echo $(name) # outputs variable correctly
但是当我尝试使用“ define”指令定义变量时,它将停止工作:
define name =
lucas
endef
all: test
.PHONY: test
test:
echo $(name)
为什么第二个版本不起作用?谢谢。
编辑:找到了this related thread。看起来像是版本的东西。 =
符号显然仅在版本3.82以后才能在define语句中识别。
答案 0 :(得分:1)
我很确定您的test
目标在'\t'
之前没有echo $(name)
。
当我复制并粘贴您的Makefile代码时,我看到了,但我认为不是
markdown语言,因为我检查了makefile文件中的其他问题,并且在那里工作了。
答案 1 :(得分:0)
找到了this related thread。看起来像是版本的东西。显然,在3.82之前的版本的define语句中无法识别=符号。