考虑一下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.
这可能是什么解释?
By default, when make looks for the makefile, it tries the following names, in order: GNUmakefile, makefile and Makefile.
-确保尚未创建GNUmakefile`基于FreeBSD
的make
将是: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.