POSIX make标准页面有关于转义换行符的说法(强调我的):
The treatment of escaped s throughout the makefile is historical practice. For example, the inference rule:
.c.o\ :
works, and the macro:
f= bar baz\ biz a: echo ==$f==
echoes
"==bar baz biz=="
.
“历史实践”是什么意思?
我是否可以在严格符合 POSIX makefile 中使用转义换行符?
最佳答案
POSIX 标准对转义换行符有这样的规定(这是在实际的标准文本中,而不是在信息部分或理性部分中):
When an escaped <newline> (one preceded by a <backslash>) is found anywhere in the makefile except in a command line, an include line, or a line immediately preceding an include line, it shall be replaced, along with any leading white space on the following line, with a single <space>. When an escaped <newline> is found in a command line in a makefile, the command line shall contain the <backslash>, the <newline>, and the next line, except that the first character of the next line shall not be included if it is a <tab>. When an escaped <newline> is found in an include line or in a line immediately preceding an include line, the behavior is unspecified.
这是您在转义换行符方面所依赖的 POSIX 强制行为。
关于c - 转义换行符是 POSIX make 的一部分吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48078283/