diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-03-03 12:48:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-03-07 13:58:48 +0200 |
commit | 8475c82a2ca186f4ca987e50b4249bb8eb32ba01 (patch) | |
tree | 20c782983f70f7e45ab71ce347ffba3d53650e25 /libbuild2/cc | |
parent | d28553772a3010fb545eae09967fa54adbe63bdb (diff) |
Add support for update=unmatch|match to ad hoc recipes
Diffstat (limited to 'libbuild2/cc')
-rw-r--r-- | libbuild2/cc/compile-rule.cxx | 12 | ||||
-rw-r--r-- | libbuild2/cc/link-rule.cxx | 10 |
2 files changed, 15 insertions, 7 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index aaaa43c..e7e90ad 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -1010,7 +1010,7 @@ namespace build2 // @@ If for some reason unmatch fails, this messes up the for_install // logic because we will update this library during match. Perhaps // we should postpone updating them until execute if we failed to - // unmatch. + // unmatch. See how we do this in ad hoc rule. // pair<bool, target_state> mr ( build2::match ( @@ -5889,7 +5889,10 @@ namespace build2 ps.push_back (prerequisite (lt)); for (prerequisite_member p: group_prerequisite_members (a, lt)) { - if (include (a, lt, p) != include_type::normal) // Excluded/ad hoc. + // Ignore update=match. + // + lookup l; + if (include (a, lt, p, &l) != include_type::normal) // Excluded/ad hoc. continue; if (p.is_a<libx> () || @@ -6123,7 +6126,10 @@ namespace build2 // for (prerequisite_member p: group_prerequisite_members (a, t)) { - if (include (a, t, p) != include_type::normal) // Excluded/ad hoc. + // Ignore update=match. + // + lookup l; + if (include (a, t, p, &l) != include_type::normal) // Excluded/ad hoc. continue; if (p.is_a<libx> () || diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index c993df6..d90cd75 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -286,7 +286,8 @@ namespace build2 // value (since we may not match). Instead we do this in apply(). // lookup l; - if (include (a, t, p, &l) != include_type::normal) + if (include (a, t, p, a.operation () == update_id ? &l : nullptr) != + include_type::normal) continue; if (p.is_a (x_src) || @@ -1199,7 +1200,7 @@ namespace build2 // if (update_match) { - for (prerequisite_target& pto: pts) + for (const prerequisite_target& pto: pts) { if ((pto.include & 2) != 0) update_during_match (trace, a, *pto.target); @@ -1559,7 +1560,8 @@ namespace build2 if (!pt->has_prerequisites () && (!group || !rt.has_prerequisites ())) { - prerequisites ps {p.as_prerequisite ()}; // Source. + prerequisites ps; + ps.push_back (p.as_prerequisite ()); // Source. // Add our lib*{} (see the export.* machinery for details) and // bmi*{} (both original and chained; see module search logic) @@ -1578,7 +1580,7 @@ namespace build2 // might depend on the imported one(s) which we will never "see" // unless we start with this library. // - // Note: have similar logic in make_module_sidebuild(). + // Note: have similar logic in make_{module,header}_sidebuild(). // size_t j (start); for (prerequisite_member p: group_prerequisite_members (a, t)) |