c - 转义换行符是 POSIX make 的一部分吗?

标签 c makefile posix

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/

相关文章:

C - strcpy 的一般使用

c++ - 由于 istream 中的杂散\n 而不是 scanf() 或 cin,gets () 的结果不正确?

C代码调用程序集: infinite loop

android - 适用于 Android 2.2 的动态 C/C++ 库 : error Symbol not found

c++ - 链接器错误 - clang++

c++ - LD_PRELOAD 的 Makefile __libc_start_main

c - 在 C 中为线程同步结构

c - 打印 ("ABCD"); printf ("ABCD"+1);

c - shmat 返回 errno=13(EACCES) 的段错误

linux - 库大小如何影响应用程序的加载时间和内存占用量?