aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cc/link-rule.cxx25
-rw-r--r--build2/cc/link-rule.hxx1
-rw-r--r--libbuild2/install/init.cxx1
-rw-r--r--libbuild2/test/init.cxx4
4 files changed, 31 insertions, 0 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index bfc31d7..fa6d5e4 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -1299,6 +1299,7 @@ namespace build2
}
md.binless = binless;
+ md.start = start;
switch (a)
{
@@ -1801,6 +1802,30 @@ namespace build2
ts = target_state::changed;
}
+ // Check for the for_install variable on each prerequisite and blank out
+ // those that don't match. Note that we have to do it after updating
+ // prerequisites to keep the dependency counts straight.
+ //
+ if (const variable* var_fi = ctx.var_pool.find ("for_install"))
+ {
+ // Parallel prerequisites/prerequisite_targets loop.
+ //
+ size_t i (md.start);
+ for (prerequisite_member p: group_prerequisite_members (a, t))
+ {
+ const target*& pt (t.prerequisite_targets[a][i++]);
+
+ if (pt == nullptr)
+ continue;
+
+ if (lookup l = p.prerequisite.vars[var_fi])
+ {
+ if (cast<bool> (l) != for_install)
+ pt = nullptr;
+ }
+ }
+ }
+
// (Re)generate pkg-config's .pc file. While the target itself might be
// up-to-date from a previous run, there is no guarantee that .pc exists
// or also up-to-date. So to keep things simple we just regenerate it
diff --git a/build2/cc/link-rule.hxx b/build2/cc/link-rule.hxx
index c572ab3..da6181b 100644
--- a/build2/cc/link-rule.hxx
+++ b/build2/cc/link-rule.hxx
@@ -116,6 +116,7 @@ namespace build2
optional<bool> for_install;
bool binless; // Binary-less library.
+ size_t start; // Parallel prerequisites/prerequisite_targets start.
link_rule::libs_paths libs_paths;
};
diff --git a/libbuild2/install/init.cxx b/libbuild2/install/init.cxx
index d2321b5..445f2b1 100644
--- a/libbuild2/install/init.cxx
+++ b/libbuild2/install/init.cxx
@@ -209,6 +209,7 @@ namespace build2
// the trailing directory separator.
//
vp.insert<path> ("install", variable_visibility::target);
+ vp.insert<bool> ("for_install", variable_visibility::prereq);
vp.insert<string> ("install.mode", variable_visibility::project);
vp.insert<bool> ("install.subdirs", variable_visibility::project);
}
diff --git a/libbuild2/test/init.cxx b/libbuild2/test/init.cxx
index 923f047..5681b37 100644
--- a/libbuild2/test/init.cxx
+++ b/libbuild2/test/init.cxx
@@ -97,6 +97,10 @@ namespace build2
vp.insert<target_triplet> ("test.target", variable_visibility::project)
};
+ // This one is used by other modules/rules.
+ //
+ vp.insert<bool> ("for_test", variable_visibility::prereq);
+
// These are only used in testscript.
//
vp.insert<strings> ("test.redirects", variable_visibility::project);