aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-03 11:58:35 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-03 11:58:35 +0900
commit6ff74ce8ee4a618060a5bc7dac408be909151518 (patch)
tree9c6420088317fd9b65b0fae98179877a1dbd568e
parent867fb12908f2eedbb3ebbc28a971680b534a0b8b (diff)
downloadplatform_build_kati-6ff74ce8ee4a618060a5bc7dac408be909151518.tar.gz
platform_build_kati-6ff74ce8ee4a618060a5bc7dac408be909151518.tar.bz2
platform_build_kati-6ff74ce8ee4a618060a5bc7dac408be909151518.zip
[C++] Fix target specific variables with --gen_all_targets
--gen_all_targets started traversing the dependency graph from random node. This may prevent target specific variables in parents from being applied. With this patch, we always traverse the graph from nodes without parents.
-rw-r--r--dep.cc18
-rwxr-xr-xruntest.rb5
2 files changed, 19 insertions, 4 deletions
diff --git a/dep.cc b/dep.cc
index 3fa4c98..cb0289f 100644
--- a/dep.cc
+++ b/dep.cc
@@ -150,7 +150,7 @@ class DepBuilder {
}
CHECK(!first_rule_->outputs.empty());
- if (targets.empty()) {
+ if (!g_flags.gen_all_targets && targets.empty()) {
targets.push_back(first_rule_->outputs[0]);
}
if (g_flags.gen_all_phony_targets) {
@@ -158,8 +158,20 @@ class DepBuilder {
targets.push_back(s);
}
if (g_flags.gen_all_targets) {
- for (const auto& p : rules_)
- targets.push_back(p.first);
+ unordered_set<Symbol> non_root_targets;
+ for (const auto& p : rules_) {
+ for (Symbol t : p.second->inputs)
+ non_root_targets.insert(t);
+ for (Symbol t : p.second->order_only_inputs)
+ non_root_targets.insert(t);
+ }
+
+ for (const auto& p : rules_) {
+ Symbol t = p.first;
+ if (!non_root_targets.count(t)) {
+ targets.push_back(p.first);
+ }
+ }
}
// TODO: LogStats?
diff --git a/runtest.rb b/runtest.rb
index 3443930..a3babfe 100755
--- a/runtest.rb
+++ b/runtest.rb
@@ -232,7 +232,10 @@ run_make_test = proc do |mk|
if is_silent_test
cmd += ' -s'
end
- cmd += " #{tc} 2>&1"
+ if !gen_all_targets || mk =~ /makecmdgoals/
+ cmd += " #{tc}"
+ end
+ cmd += " 2>&1"
res = IO.popen(cmd, 'r:binary', &:read)
if via_ninja && File.exist?('build.ninja') && File.exists?('ninja.sh')
cmd = './ninja.sh -j1 -v'