summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-13 17:47:26 (GMT)
committerEvan Martin <martine@danga.com>2011-05-13 23:28:41 (GMT)
commit54ae1a37ea6396628b75bdc0021f1ef4848deb84 (patch)
tree80396559a2aaa190854654acd2af00b646e1dd9f /src/graph.cc
parent400ca686fed88e4ab49541829657d0edec02f9aa (diff)
downloadNinja-54ae1a37ea6396628b75bdc0021f1ef4848deb84.zip
Ninja-54ae1a37ea6396628b75bdc0021f1ef4848deb84.tar.gz
Ninja-54ae1a37ea6396628b75bdc0021f1ef4848deb84.tar.bz2
SEMANTIC CHANGE: implicit inputs are now required to exist
Edges found through depfiles are special: they get an extra empty "phony" rule. (This is identical to the way you hack this with Makefiles.)
Diffstat (limited to 'src/graph.cc')
-rw-r--r--src/graph.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/graph.cc b/src/graph.cc
index d953361..cb51618 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -43,9 +43,7 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
return false;
} else {
// This input has no in-edge; it is dirty if it is missing.
- // But it's ok for implicit deps to be missing.
- if (!is_implicit(i - inputs_.begin()))
- (*i)->dirty_ = !(*i)->file_->exists();
+ (*i)->dirty_ = !(*i)->file_->exists();
}
}
@@ -165,6 +163,15 @@ bool Edge::LoadDepFile(State* state, DiskInterface* disk_interface,
inputs_.insert(inputs_.end() - order_only_deps_, node);
node->out_edges_.push_back(this);
++implicit_deps_;
+
+ // If we don't have a edge that generates this input already,
+ // create one; this makes us not abort if the input is missing,
+ // but instead will rebuild in that circumstance.
+ if (!node->in_edge_) {
+ Edge* phony_edge = state->AddEdge(&State::kPhonyRule);
+ node->in_edge_ = phony_edge;
+ phony_edge->outputs_.push_back(node);
+ }
}
return true;