From 3cc5e3bd441fc9d18fece3d9e99fae75c78438e7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 28 Jun 2018 09:44:15 +0200 Subject: Implement support for excluded and ad hoc prerequisites The inclusion/exclusion is controlled via the 'include' prerequisite-specific variable. Valid values are: false - exclude true - include adhoc - include but treat as an ad hoc input For example: lib{foo}: cxx{win32-utility}: include = ($cxx.targe.class == 'windows') exe{bar}: libs{plugin}: include = adhoc --- build2/install/rule.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'build2/install/rule.cxx') diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index 4b50a35..58182cb 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -82,6 +82,13 @@ namespace build2 { const prerequisite& p (i->prerequisite); + // Ignore excluded. + // + include_type pi (include (a, t, p)); + + if (!pi) + continue; + // Ignore unresolved targets that are imported from other projects. // We are definitely not installing those. // @@ -119,7 +126,7 @@ namespace build2 } build2::match (a, *pt); - pts.push_back (pt); + pts.push_back (prerequisite_target (pt, pi)); } return default_recipe; @@ -228,7 +235,7 @@ namespace build2 } build2::match (a, *mt); - pts.push_back (mt); + pts.push_back (mt); // Never ad hoc. } } @@ -292,6 +299,13 @@ namespace build2 { const prerequisite& p (i->prerequisite); + // Ignore excluded. + // + include_type pi (include (a, t, p)); + + if (!pi) + continue; + // Ignore unresolved targets that are imported from other projects. // We are definitely not installing those. // @@ -327,7 +341,7 @@ namespace build2 // static installable content (headers, documentation, etc). // if (!build2::match (a, *pt, unmatch::unchanged)) - pts.push_back (pt); + pts.push_back (prerequisite_target (pt, pi)); } if (a.operation () == update_id) -- cgit v1.1