diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-19 11:10:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-19 11:10:53 +0200 |
commit | 9034f7c51ef6437ce9d4547ba5bde217b4740fb2 (patch) | |
tree | bfaa297fda78b6cafe4487e2281420a4cf77c81a /libbuild2/cc/link-rule.hxx | |
parent | 457f65414031f45174f3c35230a0c0e1de88b51a (diff) |
Use target recipe for auxiliary data storage during match-apply
In particular, we now have separate auxiliary data storage for inner
and outer operations.
Diffstat (limited to 'libbuild2/cc/link-rule.hxx')
-rw-r--r-- | libbuild2/cc/link-rule.hxx | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libbuild2/cc/link-rule.hxx b/libbuild2/cc/link-rule.hxx index f0052e9..14a70d2 100644 --- a/libbuild2/cc/link-rule.hxx +++ b/libbuild2/cc/link-rule.hxx @@ -23,6 +23,8 @@ namespace build2 public: link_rule (data&&); + struct match_data; + struct match_result { bool seen_x = false; @@ -52,10 +54,10 @@ namespace build2 apply (action, target&, match_extra&) const override; target_state - perform_update (action, const target&) const; + perform_update (action, const target&, match_data&) const; target_state - perform_clean (action, const target&) const; + perform_clean (action, const target&, match_data&) const; public: // Library handling. @@ -226,9 +228,9 @@ namespace build2 static void functions (function_family&, const char*); // functions.cxx - private: - friend class install_rule; - friend class libux_install_rule; + // Implementation details. + // + public: // Shared library paths. // @@ -271,6 +273,9 @@ namespace build2 struct match_data { + explicit + match_data (const link_rule& r): rule (r) {} + // The "for install" condition is signalled to us by install_rule when // it is matched for the update operation. It also verifies that if we // have already been executed, then it was for install. @@ -305,10 +310,21 @@ namespace build2 size_t start; // Parallel prerequisites/prerequisite_targets start. link_rule::libs_paths libs_paths; + + const link_rule& rule; + + target_state + operator() (action a, const target& t) + { + return a == perform_update_id + ? rule.perform_update (a, t, *this) + : rule.perform_clean (a, t, *this); + } }; // Windows rpath emulation (windows-rpath.cxx). // + private: struct windows_dll { reference_wrapper<const string> dll; |