为什么要坚持要求文件是最新的

问题描述 投票:0回答:1

考虑一下FreeBSD上这个Makefile的简单示例。

all: hello

hello: hello.o
     gcc -o hello hello.o

hello.o: hello.c
     gcc -c hello.c

clean:
     rm hello.o hello

然后我做任何事情,更改hello.c,或者即使我更改Makefile中的内容以完全废话,make也会说:

`makefile' is up to date.

这可能是什么解释?

makefile gnu-make freebsd
1个回答
0
投票
我想您对makefile有点混乱。请注意(对于GNU Make):By default, when make looks for the makefile, it tries the following names, in order: GNUmakefile, makefile and Makefile.-确保尚未创建GNUmakefile`

基于FreeBSDmake将是:If no -f makefile makefile option is given, make will try to open 'makefile' then 'Makefile' in order to find the specifications.

我可以想象的唯一情况是:

> cat Makefile all: hello hello: hello.o cc -o hello hello.o hello.o: hello.c cc -c hello.c clean: rm hello.o hello > make cc -c hello.c cc -o hello hello.o > ./hello Hello world! > make clean rm hello.o hello > touch makefile > make `makefile' is up to date.

© www.soinside.com 2019 - 2024. All rights reserved.