Bash 为什么我的makefile变量在使用;定义;指令?
我用的是GNU Make 3.81。以下makefile工作正常:Bash 为什么我的makefile变量在使用;定义;指令?,bash,shell,makefile,gnu-make,Bash,Shell,Makefile,Gnu Make,我用的是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) 为什么第二个版本不起作用?谢谢 编辑:已
name=lucas
all: test
.PHONY: test
test:
echo $(name) # outputs variable correctly
但当我尝试使用“define”指令定义变量时,它停止工作:
define name =
lucas
endef
all: test
.PHONY: test
test:
echo $(name)
为什么第二个版本不起作用?谢谢
编辑:已找到。看起来这是一个版本的东西。
=
符号显然是从3.82版开始才在define语句中识别出来的。我很确定您的测试目标在echo$(name)
之前没有'\t'
。
当我复制并粘贴你的makefile代码时,我看到了这一点,我不认为这是错误的
markdown语言,因为我用makefiles检查了其他问题,它在那里工作。找到了。看起来这是一个版本的东西。显然,3.82之前版本的define语句中无法识别=符号。我使用的是GNU Make 3.81版本。我想知道这个版本是否是我的问题。我完全不知所措,我无法让它工作。你的意思是,“在define
3.82版之前的语句中,=符号无法识别”,我想。