【发布时间】:2015-08-20 03:59:00
【问题描述】:
给定一个 makefile:
# Create the following sequence of files, in the following order: 1)'old' then 2)'all', finally 3)'new'.
$(shell touch 'old')
$(shell sleep 1)
$(shell touch 'all')
$(shell sleep 1)
$(shell touch 'new')
all: new
echo '$@'
# Let the modification-time of 'new', to be like 'old' ("older" than 'all').
new : phony
cp -p old new
.PHONY : phony
.INTERMEDIATE: new
运行,我们得到:
$ make -Wnew
cp -p old new
echo 'all'
all
rm new
现在,虽然 all 早于文件 new 解析构建之前,在 Make 完成构建 new 文件后,事情发生了变化,配方 cp -p old new,基本上将 old 的修改时间复制到 new,因此:all 是 现在 em> 比文件new“更新”。
那么,为什么要构建最新的文件all,因为它贯穿了它的依赖项——他们各自的构建——我们发现@ 987654332@ modify-time 在其依赖项“new”之后。
【问题讨论】: