c - make : 'file' is up to date, 后面什么都不做

标签 c gcc makefile

我正在尝试为我的程序创建一个基本的 makefile。它看起来像这样:

all: example
example: example.c
    gcc -o example example.c
clean:
    rm example

如果我“make clean”,然后输入“make”,我会收到“make:Nothing to be do for all”。

如果我对源代码进行轻微更改,保存它,然后运行 ​​make,我会收到“gcc -o example example.c

如果我输入“make example”,我会收到““example”是最新的。我在 make 文件中的“gcc”和“rm”之前使用缩进,而不是空格,并且缩进不是 secret 的我确信我的 makefile 做错了,但我希望有人帮助我弄清楚我犯了什么错误。 编辑:将“clear make”更改为“make clean”

最佳答案

如果您输入

make  

然后将生成“示例”程序。

然后,如果您输入

make example

不会发生任何事情,因为程序“example”已经完成,并且其依赖项(“example.c”)时间戳尚未更改。

关于c - make : 'file' is up to date, 后面什么都不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46395761/

相关文章:

c++ - 使用 makefile 的 Doxygen 文档

根据鼠标位置计算索引

c++ - 免费CArchive实现?

linux - 来自 gcc 的 pgo 的优化报告

c++ - 在 Makefile 中添加 INCLUDE、LIB 和 LD_LIBRARY_PATH

makefile - BoringSSL 的 undefined symbol

CS50 凯撒计划正在运行,但 check50 表示没有运行

C 错误, "' 预期为 '=' ',' ';' 、 'asm' 或 '__attribute__' 之前 'Bufferpar' "

c - 如何解决 C : 'can' t find a register in class 'GENERAL_REGS' while reloading 'asm' ' 中的内联汇编错误

gcc - 运行时错误 : Segmentation fault with libtommath and libtomcrypt