aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bin/rule.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-24 05:31:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-24 05:33:49 +0200
commit52128dcc2d88a262238c07fe8acdbcfad684035c (patch)
tree14b2e27b18e09c6577100c21bf79659743059867 /libbuild2/bin/rule.hxx
parent73c8c339c5c8fb468c4ddb1632d87d1aeb1cd497 (diff)
Match rule to libul{} with explicit bin.metadata hint
This rule picks, matches, and unmatches (if possible) a member for the purpose of making its metadata (for example, library's poptions, if it's one of the cc libraries) available.
Diffstat (limited to 'libbuild2/bin/rule.hxx')
-rw-r--r--libbuild2/bin/rule.hxx26
1 files changed, 20 insertions, 6 deletions
diff --git a/libbuild2/bin/rule.hxx b/libbuild2/bin/rule.hxx
index 8bc30c7..fcbd0ca 100644
--- a/libbuild2/bin/rule.hxx
+++ b/libbuild2/bin/rule.hxx
@@ -30,19 +30,33 @@ namespace build2
apply (action, target&) const override;
};
- // "Fail rule" for libul{} that issues diagnostics if someone tries to
- // build this group directly.
+ // If metadata is false, the this is a "fail rule" for libul{} that issues
+ // diagnostics if someone tries to build this group directly.
//
- class libul_rule: public simple_rule
+ // If metadata is true, then this rule only matches with the explicit
+ // `bin.metadata` hint. In this case it picks, matches, and unmatches (if
+ // possible) a member for the purpose of making its metadata (for example,
+ // library's poptions, if it's one of the cc libraries) available.
+ //
+ // The underlying idea here is that someone else (e.g., cc::link_rule)
+ // makes a more informed choice and we piggy back on that decision,
+ // falling back to making our own based on bin.lib and bin.exe.lib. Note
+ // that for update this rule always returns target_state::unchanged.
+ //
+ class libul_rule: public rule
{
public:
- libul_rule () {}
+ explicit
+ libul_rule (bool md): metadata_ (md) {}
virtual bool
- match (action, target&) const override;
+ match (action, target&, const string&, match_extra&) const override;
virtual recipe
- apply (action, target&) const override;
+ apply (action, target&, match_extra&) const override;
+
+ private:
+ bool metadata_;
};
// Pass-through to group members rule, similar to alias.