aboutsummaryrefslogtreecommitdiff
path: root/build/bin/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-03 13:10:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-03 13:10:28 +0200
commit0db17bfec8b3b6c436f3c9c346d17d98458c3654 (patch)
treec9dcd1d7678972b0a40450b21a7d23dd6ec1121b /build/bin/rule.cxx
parent3a2efbc3d33c70aa5d0a87c9a1d16b458541bdde (diff)
match_only and dependents count rework, part 1
Diffstat (limited to 'build/bin/rule.cxx')
-rw-r--r--build/bin/rule.cxx48
1 files changed, 29 insertions, 19 deletions
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<lib> ())
+ {
+ target& pt (search (p));
+ match_only (a, pt);
+ t.prerequisite_targets.push_back (&pt);
+ }
+ else if (p.is_a<liba> () || p.is_a<libso> ())
+ {
+ //@@ 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<lib> () || p.is_a<liba> () || p.is_a<libso> ())
- {
- target& pt (search (p));
- build::match (a, pt);
- t.prerequisite_targets.push_back (&pt);
- }
- }
-
return &perform;
}