aboutsummaryrefslogtreecommitdiff
path: root/build/cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-14 09:47:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-14 09:47:40 +0200
commit8276259438592439236341b74300cb5538303c83 (patch)
tree0e072ee31bd13ff55f2c3e0d4a0b50725f8dd73f /build/cxx
parent70613e9be046c9cddd2486505a44d3a0324d6d95 (diff)
Add notion of strong/weak amalgamation, make strong new clean boundary
Diffstat (limited to 'build/cxx')
-rw-r--r--build/cxx/rule.cxx35
1 files changed, 28 insertions, 7 deletions
diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx
index e0e5c0f..9228994 100644
--- a/build/cxx/rule.cxx
+++ b/build/cxx/rule.cxx
@@ -126,17 +126,20 @@ namespace build
// code (below) takes care of the ones it is adding.
//
// When cleaning, ignore prerequisites that are not in the same
- // or a subdirectory of ours.
+ // or a subdirectory of our strong amalgamation.
//
+ const dir_path* amlg (
+ a.operation () != clean_id
+ ? nullptr
+ : &t.strong_scope ().path ());
+
for (prerequisite_member p: group_prerequisite_members (a, t))
{
target& pt (p.search ());
- if (a.operation () == clean_id && !pt.dir.sub (t.dir))
+ if (a.operation () == clean_id && !pt.dir.sub (*amlg))
continue;
- build::match (a, pt);
-
// A dependency on a library is there so that we can get its
// cxx.export.poptions. In particular, making sure it is
// executed before us will only restrict parallelism. But we
@@ -144,8 +147,18 @@ namespace build
// populated; see append_lib_options() above.
//
if (pt.is_a<lib> () || pt.is_a<liba> () || pt.is_a<libso> ())
+ {
+ // @@ The fact that we match but never execute messes up
+ // the dependents count. This is a workaround, not a
+ // solution.
+ //
+ if (a.operation () == update_id)
+ build::match (a, pt);
+
continue;
+ }
+ build::match (a, pt);
t.prerequisite_targets.push_back (&pt);
}
@@ -932,6 +945,14 @@ namespace build
// Process prerequisites: do rule chaining for C and C++ source
// files as well as search and match.
//
+ // When cleaning, ignore prerequisites that are not in the same
+ // or a subdirectory of our strong amalgamation.
+ //
+ const dir_path* amlg (
+ a.operation () != clean_id
+ ? nullptr
+ : &t.strong_scope ().path ());
+
for (prerequisite_member p: group_prerequisite_members (a, t))
{
bool group (!p.prerequisite.belongs (t)); // Group's prerequisite.
@@ -943,7 +964,7 @@ namespace build
//
pt = &p.search ();
- if (a.operation () == clean_id && !pt->dir.sub (t.dir))
+ if (a.operation () == clean_id && !pt->dir.sub (*amlg))
continue; // Skip.
// If this is the obj{} or lib{} target group, then pick the
@@ -1042,9 +1063,9 @@ namespace build
target& ot (search (o_type, d, *cp.tk.name, nullptr, cp.scope));
// If we are cleaning, check that this target is in the same or
- // a subdirectory of ours.
+ // a subdirectory of our strong amalgamation.
//
- if (a.operation () == clean_id && !ot.dir.sub (t.dir))
+ if (a.operation () == clean_id && !ot.dir.sub (*amlg))
{
// If we shouldn't clean obj{}, then it is fair to assume
// we shouldn't clean cxx{} either (generated source will