linux - Makefile什么都不做

标签 linux makefile

我正在测试一个项目,由于测试目的,它必须包含一个 Makefile,第一个测试命令将是“make”。但是我不需要 makefile 来做任何事情。问题是如果我把它留空,它会在 shell 中打印一行:

make: *** No targets.  Stop.

我需要它在 shell 中调用时打印任何内容 - 甚至不是空行(同样,由于我无法控制的测试格式)。这可能吗?

最佳答案

如果定义一个空目标

 Nothing:

make 命令会告诉您

$ make
make: Nothing to be done for 'Nothing'.

然后,只需添加一个 .SILENT 目标

# A makefile
Nothing:

all: twist again

.SILENT:

参见链接 GNU Make silent by default

关于linux - Makefile什么都不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46645755/

相关文章:

shell - 在 shell 脚本中使用 makefile 变量

ubuntu - makefile 的配方中的前导 "@"是什么

macos - 使用 C++11 在 g++ 中编译库

linux - 历史 | grep <关键字> : how to visualize more lines around the founded commands?

linux - 不使用密码的 SSH 连接

mysql - 最大化 MySQL 分析服务器的内存使用

c - 使用 vpath 的简单 make 文件不起作用

linux - Bash 脚本 - Grep/Awk 输出作为另一个脚本的输入

linux - ubuntu上的j2me开发

makefile - 在makefile中获取没有扩展名的文件名