diff options
| author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-10-01 18:38:02 +0900 |
|---|---|---|
| committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-10-02 16:08:40 +0900 |
| commit | 3ac2a09fb0b47ce8e212c21fa4c9fc9d2236a7a0 (patch) | |
| tree | 7fa578a283a54cf0ebf8b50a4a12013d45073631 /dep.cc | |
| parent | a62b02a1251a0f6c452a25fce03258f12472507f (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.cc | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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, |
