aboutsummaryrefslogtreecommitdiff
path: root/dep.cc
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-01 18:38:02 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-02 16:08:40 +0900
commit3ac2a09fb0b47ce8e212c21fa4c9fc9d2236a7a0 (patch)
tree7fa578a283a54cf0ebf8b50a4a12013d45073631 /dep.cc
parenta62b02a1251a0f6c452a25fce03258f12472507f (diff)
[C++] Add .KATI_RESTAT builtin target
This is an experimental kati-specific expansion for GNU make. Targets specified by this will have "restat = 1" in generated ninja files. Even with this change, kati should be still compatible with GNU make. GNU make will ignore this but this only means GNU make will do some extra unnecessary builds. This different should not change the final output as long as .KATI_RESTAT is used appropriately. TODO: Implement the same feature in exec.cc and add a test.
Diffstat (limited to 'dep.cc')
-rw-r--r--dep.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/dep.cc b/dep.cc
index 6f4fc11..c1e9fcf 100644
--- a/dep.cc
+++ b/dep.cc
@@ -100,11 +100,12 @@ class RuleTrie {
} // namespace
-DepNode::DepNode(Symbol o, bool p)
+DepNode::DepNode(Symbol o, bool p, bool r)
: output(o),
has_rule(false),
- is_phony(p),
is_default_target(false),
+ is_phony(p),
+ is_restat(r),
rule_vars(NULL),
output_pattern(Symbol::IsUninitialized()) {
g_dep_node_pool->push_back(this);
@@ -131,6 +132,12 @@ class DepBuilder {
phony_.insert(input);
}
}
+ found = rules_.find(Intern(".KATI_RESTAT"));
+ if (found != rules_.end()) {
+ for (Symbol input : found->second->inputs) {
+ restat_.insert(input);
+ }
+ }
}
~DepBuilder() {
@@ -446,7 +453,9 @@ class DepBuilder {
return found->second;
}
- DepNode* n = new DepNode(output, phony_.count(output));
+ DepNode* n = new DepNode(output,
+ phony_.count(output),
+ restat_.count(output));
done_[output] = n;
shared_ptr<Rule> rule;
@@ -535,6 +544,7 @@ class DepBuilder {
shared_ptr<Rule> first_rule_;
unordered_map<Symbol, DepNode*> done_;
unordered_set<Symbol> phony_;
+ unordered_set<Symbol> restat_;
};
void MakeDep(Evaluator* ev,