From 0db17bfec8b3b6c436f3c9c346d17d98458c3654 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Aug 2015 13:10:28 +0200 Subject: match_only and dependents count rework, part 1 --- build/bin/rule.cxx | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'build/bin') diff --git a/build/bin/rule.cxx b/build/bin/rule.cxx index 0845627..8df1ee0 100644 --- a/build/bin/rule.cxx +++ b/build/bin/rule.cxx @@ -37,8 +37,36 @@ namespace build // members as our prerequisites. // match_result lib_rule:: - match (action, target& t, const std::string&) const + match (action a, target& t, const std::string&) const { + // Search and match prerequisite libraries and add them to the + // prerequisite targets. While we never execute this list + // ourselves (see perform() below), this is necessary to make + // the exported options machinery work for the library chains + // (chaining is the reason why we have to do match, recursively). + // See the cxx.export.*-related code in cxx/compile.cxx for + // details. + // + for (prerequisite& p: group_prerequisites (t)) + { + if (p.is_a ()) + { + target& pt (search (p)); + match_only (a, pt); + t.prerequisite_targets.push_back (&pt); + } + else if (p.is_a () || p.is_a ()) + { + //@@ TMP: C++ link rule hasn't been converted to support + // match_only(). + // + target& pt (search (p)); + build::match (a, pt); + t.prerequisite_targets.push_back (&pt); + pt.dependents--; // No intent to execute. + } + } + return t; } @@ -75,24 +103,6 @@ namespace build build::match (a, *t.so); } - // Search and match prerequisite libraries and add them to the - // prerequisite targets. While we never execute this list - // ourselves (see perform() below), this is necessary to make - // the exported options machinery work for the library chains. - // See cxx.export.*-related code in cxx/compile.cxx for details. - // - // @@ Messes up dependents count. - // - for (prerequisite& p: group_prerequisites (t)) - { - if (p.is_a () || p.is_a () || p.is_a ()) - { - target& pt (search (p)); - build::match (a, pt); - t.prerequisite_targets.push_back (&pt); - } - } - return &perform; } -- cgit v1.1