summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-09-14 00:32:15 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2011-09-14 02:01:12 (GMT)
commitf14039d44a93b7717e5335a371ea22fe4561aaf8 (patch)
treea888a3578c1d2eaf452d9f86273aa7cbadad136c /src/graph.cc
parent22c309760a5a38ccc88a6f700e101868236ce4ab (diff)
downloadNinja-f14039d44a93b7717e5335a371ea22fe4561aaf8.zip
Ninja-f14039d44a93b7717e5335a371ea22fe4561aaf8.tar.gz
Ninja-f14039d44a93b7717e5335a371ea22fe4561aaf8.tar.bz2
Consider missing phony targets with no dependencies out of date
Commit 639c8f0 ("don't mark phony edges dirty if none of their inputs are dirty") modified the behaviour of the "phony" built-in rule. Previously, when the output file was missing, it was marked as dirty. After 639c8f0, it was always marked as clean unless one of the dependencies was dirty. The depfile mechanism uses the old behaviour of "phony" to rebuild an object file if any of the headers were missing. Restore the old "phony" behaviour only for the case where the build statement has no dependencies. This is slightly inconsistent, but I can't really see any other use case for an alias of nothing. Also, document this behaviour.
Diffstat (limited to 'src/graph.cc')
-rw-r--r--src/graph.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/graph.cc b/src/graph.cc
index 5c37ac0..9c99b3d 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -77,9 +77,12 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
if (is_phony()) {
// Phony edges don't write any output.
- // They're only dirty if an input is dirty.
+ // They're only dirty if an input is dirty, or if there are no inputs
+ // and we're missing the output.
if (dirty)
(*i)->dirty_ = true;
+ else if (inputs_.empty() && !(*i)->file_->exists())
+ (*i)->dirty_ = true;
continue;
}