makefile - 如何在makefile中添加多行注释

标签 makefile

有没有办法像 C 语法 /* */ 一样注释掉 makefile 中的多行?

最佳答案

不,makefile 中没有类似 C 风格的 /* */ 注释。正如其他人所建议的,您可以通过使用行延续来进行多行注释。例如:

# This is the first line of a comment \
and this is still part of the comment \
as is this, since I keep ending each line \
with a backslash character

但是,我想您可能出于调试原因暂时注释掉 makefile 的一部分,并且在每一行上添加反斜杠并不实际。如果您使用 GNU make,我建议您使用带有故意错误表达式的 ifeq 指令。例如:

ifeq ("x","y")
# here's all your 'commented' makefile content...
endif

关于makefile - 如何在makefile中添加多行注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4493291/

相关文章:

c++ - 如果我在 GCC 中编译和链接不需要的库会怎样?

c - 发生错误时如何在makefile中同时退出并记录文件中的数据

c - 正确设置cmakelist来编译项目

assembly - GNU 链接器 : file not recognized

python - 使用自定义 openssl 版本编译 python 时的 Coredump

macos - 如何在没有管理员访问权限或使用 Xcode 的情况下在 Mac 上安装 GCC 和 make?

c - 如何使 'make' 在 Windows 7 上与 mingw32 一起工作

c - 未定义对已定义函数的引用

c - 我的 makefile 有什么问题?我收到 "undefined reference"错误

c++ - 生成文件 |对头文件中包含的另一个头文件的依赖