我正在尝试为我的程序创建一个基本的 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/