在我们的系统中,我们将一个特定的子系统文件创建为.o文件,比如sub.o
。 sub.o
依赖于组件compA.o
,compB.o
和compC.o
,并且每个组件都有一些依赖关系。制作完整系统后,目录中会存在compA.o
,compB.o
,compC.o
和sub.o
。如果我要删除compA.o
并尝试重新制作系统,它会说没有任何事情要做,compA.o
仍然不存在。这是因为compA.o
被视为中间文件。我知道源文件永远不会改变,最终结果很好。
我不明白为什么文件compA.o
仅在重制系统时被认为是中间的。如果在初始构建中被认为是中间的,那么在构建之后它不存在,给定this definition个中间文件?
我应该提一下,这只是在我们从make-3.79转到make-3.81后才存在。
make -d sub.o的相关输出:
Looking for an implicit rule for 'compA.o'.
Trying pattern rule with stem 'compA'.
Found an implicit rule for 'compA.o'.
Looking for an implicit rule for '../pas/compA.c'.
Trying pattern rule with stem 'compA'.
Trying implicit prerequisite '../pas/compA.w'.
Trying pattern rule with stem 'compA.c'.
Trying implicit prerequisite '../pas/RCS/compA.c'.
Trying pattern rule with stem 'compA'.
Trying implicit prerequisite '../pas/compA.w'.
Looking for a rule with intermediate file '../pas/compA.w'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'compA.w'.
Trying implicit prerequisite '../pas/RCS/compA.w'.
No implicit rule found for '../pas/compA.c'.
以后......
Prerequisite 'compA.o' of target 'sub.o' does not exist.
No need to remake target 'sub.o'.
make-3.81: 'sub.o' is up to date.