makefile - 为什么 make 坚持要求文件是最新的
问题描述
考虑这个 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):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
> echo "makefile:" > .depend
> make
`makefile' is up to date.
推荐阅读
- django - 使用 Docker Container - Django 构建后维护媒体文件
- automation - 有没有办法让测试让它的 TestCaseSource 从外部源(如 excel)读取数据?
- node.js - npm 开始显示 index.html 未定义,尽管 index.html 存在
- python - 如何从复杂的验证码中提取数字
- c - 试图用空格分割 C 中的字符串并使用第二个单词
- vba - Powerpoint VBA - 如何在“形状内”存储信息?
- apache-camel - 为什么camel route中bean的一个参数是exchange的body值?
- image-processing - 可以使用morphology.remove_small_objects 去除小噪声吗?
- r - 如何将大量 igraph 组合成一个 igraph - R
- elasticsearch - Elasticsearch 不对双字段进行排序