summaryrefslogtreecommitdiffstats
path: root/src/build.cc
diff options
context:
space:
mode:
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());