diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-26 15:38:23 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-26 15:38:23 +0200 |
commit | 4177d70e63893d0a2c76beb9166ebbf79c4697a0 (patch) | |
tree | 5f78750577a76919ac93d9cffbff91ffde5ce7b7 /build2/cc/link-rule.cxx | |
parent | e9e1cdc98cb56fd0aac0c91f8609bfee57457847 (diff) |
Add support for for_install prerequisite-specific var in link rule
Also reserve for_test.
Diffstat (limited to 'build2/cc/link-rule.cxx')
-rw-r--r-- | build2/cc/link-rule.cxx | 25 |
1 files changed, 25 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 |