aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-09-20 15:59:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-09-20 15:59:39 +0200
commitb7cb7f5510de019527f2a7b9e3f81dbb9813b5d9 (patch)
treeb204239436d477224a8664c82d8cf08a9629a504 /libbuild2/target.ixx
parentab978916ef5d3a8f876953697c6eb9cdeedbc998 (diff)
Add support for disabling clean through target-prerequisite relationship
Our current semantics is to clean any prerequisites that are in the same project (root scope) as the target and it may seem more natural to rather only clean prerequisites that are in the same base scope. While it's often true for simple projects, in more complex cases it's not unusual to have common intermediate build results (object files, utility libraries, etc) reside in the parent and/or sibling directories. With such arrangements, cleaning only in base (even from the project root) may leave such intermediate build results laying around (since there is no reason to list them as prerequisites of any directory aliases). So we clean in the root scope by default but now any target-prerequisite relationship can be marked not to trigger a clean with the clean=false prerequisite-specific value.
Diffstat (limited to 'libbuild2/target.ixx')
-rw-r--r--libbuild2/target.ixx20
1 files changed, 4 insertions, 16 deletions
diff --git a/libbuild2/target.ixx b/libbuild2/target.ixx
index 1c8dd8d..50750ca 100644
--- a/libbuild2/target.ixx
+++ b/libbuild2/target.ixx
@@ -287,27 +287,15 @@ namespace build2
// include()
//
LIBBUILD2_SYMEXPORT include_type
- include_impl (action,
- const target&,
- const string&,
- const prerequisite&,
- const target*);
+ include_impl (action, const target&, const prerequisite&, const target*);
inline include_type
include (action a, const target& t, const prerequisite& p, const target* m)
{
- // Most of the time this variable will not be specified, so let's optimize
- // for that.
+ // Most of the time no prerequisite-specific variables will be specified,
+ // so let's optimize for that.
//
- if (p.vars.empty ())
- return true;
-
- const string* v (cast_null<string> (p.vars[t.ctx.var_include]));
-
- if (v == nullptr)
- return true;
-
- return include_impl (a, t, *v, p, m);
+ return p.vars.empty () ? include_type (true) : include_impl (a, t, p, m);
}
// group_prerequisites