aboutsummaryrefslogtreecommitdiff
path: root/build2/install/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-29 10:32:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-29 10:32:36 +0200
commit682836daacdd3dc486187c9d60479b372895a470 (patch)
treea042ab0e46052436b08355f43fd54d9055ce9b82 /build2/install/rule.cxx
parent2b922df93fcea9e3fad8e24b39c7fe579085d3ac (diff)
Implement "see through" installation semantics for utility libraries
Diffstat (limited to 'build2/install/rule.cxx')
-rw-r--r--build2/install/rule.cxx27
1 files changed, 20 insertions, 7 deletions
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 8611247..f2fc233 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -38,20 +38,32 @@ namespace build2
// alias_rule
//
+ const alias_rule alias_rule::instance;
+
match_result alias_rule::
match (action, target&, const string&) const
{
return true;
}
+ const target* alias_rule::
+ filter (action, const target& t, prerequisite_member p) const
+ {
+ return &p.search (t);
+ }
+
recipe alias_rule::
apply (action a, target& t) const
{
tracer trace ("install::alias_rule::apply");
- for (const prerequisite& p: group_prerequisites (t))
+ for (prerequisite_member p: group_prerequisite_members (a, t))
{
- const target& pt (search (t, p));
+ // Let a customized rule have its say.
+ //
+ const target* pt (filter (a, t, p));
+ if (pt == nullptr)
+ continue;
// Check if this prerequisite is explicitly "not installable",
// that is, there is the 'install' variable and its value is
@@ -65,16 +77,15 @@ namespace build2
//
// Note: not the same as lookup() above.
//
- auto l (pt["install"]);
-
+ auto l ((*pt)["install"]);
if (l && cast<path> (l).string () == "false")
{
- l5 ([&]{trace << "ignoring " << pt;});
+ l5 ([&]{trace << "ignoring " << *pt;});
continue;
}
- build2::match (a, pt);
- t.prerequisite_targets.push_back (&pt);
+ build2::match (a, *pt);
+ t.prerequisite_targets.push_back (pt);
}
return default_recipe;
@@ -82,6 +93,8 @@ namespace build2
// file_rule
//
+ const file_rule file_rule::instance;
+
struct match_data
{
bool install;