jww*_*jww 1 shell makefile gnu-make cat
我正在尝试向我的 makefile 添加一条警告消息。Make 无法找到右括号。
以下内容来自我的 GNUmakefile:
341 ALIGNED_ACCESS = $(shell cat config.h | $(EGREP) -c "^#define NO_UNALIGNED_DATA_ACCESS")
342 ifeq ($(ALIGNED_ACCESS),0)
343 $(info WARNING: NO_UNALIGNED_DATA_ACCESS is not defined in config.h)
344 endif
Run Code Online (Sandbox Code Playgroud)
提出投诉:
$ make
GNUmakefile:341: *** unterminated call to function 'shell': missing ')'. Stop.
Run Code Online (Sandbox Code Playgroud)
我真的在 makefile 中另外 25 次,所以我不确定为什么它找不到上面 shell 的正确括号。
我还将命令移到第 1 行进行测试,我得到了相同的消息(以行号更改为模)。为了好玩,我添加了一个不平衡的右括号,但我得到了同样的信息。
为什么找不到正确的括号?
如何强制执行命令?
您必须#在 makefile 中转义 ,因为这会开始评论...
ALIGNED_ACCESS = $(shell cat config.h | $(EGREP) -c "^\#define NO_UNALIGNED_DATA_ACCESS")
Run Code Online (Sandbox Code Playgroud)
注意'#'之前的'\'