summaryrefslogtreecommitdiffstats
path: root/src/build.cc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-12-04 02:51:30 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2011-12-06 09:07:07 (GMT)
commit1b471c1c4251dc05c2d5b71dd5d1d335c7827a9b (patch)
treeb409050a0240eca0949edb8a2bdcd8b7eadc110f /src/build.cc
parent57d8557ff3bfe6772f2dbada1d1ffa5d378ca763 (diff)
downloadNinja-1b471c1c4251dc05c2d5b71dd5d1d335c7827a9b.zip
Ninja-1b471c1c4251dc05c2d5b71dd5d1d335c7827a9b.tar.gz
Ninja-1b471c1c4251dc05c2d5b71dd5d1d335c7827a9b.tar.bz2
Use the modification time of the depfile when computing restat_mtime
Fixes issue #144.
Diffstat (limited to 'src/build.cc')
-rw-r--r--src/build.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/build.cc b/src/build.cc
index bb73f7d..f3d7d9b 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -593,7 +593,7 @@ void Builder::FinishEdge(Edge* edge, bool success, const string& output) {
if (node_cleaned) {
// If any output was cleaned, find the most recent mtime of any
- // (existing) non-order-only input.
+ // (existing) non-order-only input or the depfile.
for (vector<Node*>::iterator i = edge->inputs_.begin();
i != edge->inputs_.end() - edge->order_only_deps_; ++i) {
time_t input_mtime = disk_interface_->Stat((*i)->file_->path_);
@@ -605,6 +605,14 @@ void Builder::FinishEdge(Edge* edge, bool success, const string& output) {
restat_mtime = input_mtime;
}
+ if (restat_mtime != 0 && !edge->rule_->depfile_.empty()) {
+ time_t depfile_mtime = disk_interface_->Stat(edge->EvaluateDepFile());
+ if (depfile_mtime == 0)
+ restat_mtime = 0;
+ else if (depfile_mtime > restat_mtime)
+ restat_mtime = depfile_mtime;
+ }
+
// The total number of edges in the plan may have changed as a result
// of a restat.
status_->PlanHasTotalEdges(plan_.command_edge_count());