为什么 Make 中的 `shell` 命令会删除换行符?
Why does the `shell` command in Make remove newlines?
根据此处的 Make 文档:http://www.ecoop.net/coop/translated/GNUMake3.77/make_8.html#SEC80
The only processing make does on the result, before substituting it into the surrounding text, is to convert each newline or carriage-return / newline pair to a single space. It also removes the trailing (carriage-return and) newline, if it's the last thing in the result.
为什么 Make 会做这个处理?
如果没有递归通配符命令,能够从 find
return 分隔列表肯定会很好。
当您使用变量时,变量的值将被替换。
Make docs(类似于 C 中的 "define")。
新行会对 make 的解析能力造成严重破坏。
虽然变量中可以有新行:
Another question
我想这只是因为 "no new lines" 是使用最多的情况。在 make 尝试替换它们之前,您可以使用其他 shell 命令将这些新行替换为其他内容。
根据此处的 Make 文档:http://www.ecoop.net/coop/translated/GNUMake3.77/make_8.html#SEC80
The only processing make does on the result, before substituting it into the surrounding text, is to convert each newline or carriage-return / newline pair to a single space. It also removes the trailing (carriage-return and) newline, if it's the last thing in the result.
为什么 Make 会做这个处理?
如果没有递归通配符命令,能够从 find
return 分隔列表肯定会很好。
当您使用变量时,变量的值将被替换。 Make docs(类似于 C 中的 "define")。
新行会对 make 的解析能力造成严重破坏。
虽然变量中可以有新行: Another question
我想这只是因为 "no new lines" 是使用最多的情况。在 make 尝试替换它们之前,您可以使用其他 shell 命令将这些新行替换为其他内容。