Makefile Make无法处理多行shell函数

Makefile Make无法处理多行shell函数,makefile,Makefile,显示之后,Make可以快速地从shell函数argumnet中删除新行 我尝试了这个makefile: # The original lines of the command were too long # and in-fact, that's why i split them into 2 lines. # For simplicity, I replaced the lines with single-character words. define cmd rm dir endef

显示之后,Make可以快速地从shell函数argumnet中删除新行

我尝试了这个makefile:

# The original lines of the command were too long
# and in-fact, that's why i split them into 2 lines.
# For simplicity, I replaced the lines with single-character words.

define cmd
rm
dir
endef


x := $(shell $(cmd))

all:
    @:
跑步,我得到:

make: rm
dir: Command not found
这是否意味着Make传递命令“rm\ndir”(注意中间的NL字符!)


因为,这肯定不是我们在上面的链接中看到的。是的。如果在
rm
后面加上额外的空格,您应该会看到输出
rm:cannot remove'\ndir':没有这样的文件或目录
。但是,正如我之前回答的,如果您使用


它将执行
rm dir

是的。如果在
rm
后面加上额外的空格,您应该会看到输出
rm:cannot remove'\ndir':没有这样的文件或目录
。但是,正如我之前回答的,如果您使用

它将执行
rm dir

define cmd
rm dir
endef
define cmd
rm \
dir
endef