diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-06-24 10:29:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-06-24 10:29:09 +0200 |
commit | f1c981a22365411794806ed0744b857ef0804e35 (patch) | |
tree | af453c932bfa597a04dc7af17d5f5720f863d081 /libbuild2/cc | |
parent | 1c12242aa7cd00e35a9be43b664e5486b2adc846 (diff) |
Allow ad hoc rules not to list targets that are updated during match
For example, this allows a Qt moc rule not to list generated headers
from libQtCore since they are pre-generated by the library.
Diffstat (limited to 'libbuild2/cc')
-rw-r--r-- | libbuild2/cc/common.cxx | 4 | ||||
-rw-r--r-- | libbuild2/cc/common.hxx | 5 | ||||
-rw-r--r-- | libbuild2/cc/link-rule.cxx | 18 |
3 files changed, 19 insertions, 8 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx index 976127f..a320626 100644 --- a/libbuild2/cc/common.cxx +++ b/libbuild2/cc/common.cxx @@ -397,7 +397,9 @@ namespace build2 { // See link_rule for details. // - const target* g ((pt.include & 4) != 0 ? f->group : nullptr); + const target* g ((pt.include & include_group) != 0 + ? f->group + : nullptr); if (sysd == nullptr) find_sysd (); if (!li) find_linfo (); diff --git a/libbuild2/cc/common.hxx b/libbuild2/cc/common.hxx index a5a4859..2aaa0d0 100644 --- a/libbuild2/cc/common.hxx +++ b/libbuild2/cc/common.hxx @@ -305,6 +305,11 @@ namespace build2 using library_cache = small_vector<library_cache_entry, 32>; + // The prerequisite_target::include bit that indicates a library + // member has been picked from the group. + // + static const uintptr_t include_group = 0x100; + void process_libraries ( action, diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 0081fe2..d0a1f4a 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -1003,7 +1003,7 @@ namespace build2 if (*um) { pto.target = &p.search (t); // mark 0 - pto.include |= 2; + pto.include |= prerequisite_target::include_udm; update_match = true; } } @@ -1144,7 +1144,7 @@ namespace build2 if (const libx* l = pt->is_a<libx> ()) { pt = link_member (*l, a, li); - pto.include |= 4; + pto.include |= include_group; } } else @@ -1231,7 +1231,7 @@ namespace build2 << "not supported by this rule"; m = 0; - pto.include |= 2; + pto.include |= prerequisite_target::include_udm; update_match = true; } } @@ -1245,10 +1245,14 @@ namespace build2 // of the libraries (for example, if generation requires some of the // metadata; think poptions needed by Qt moc). // - match_members (a, t, pts, start, {2 /* mask */, 0 /* value */}); + { + auto mask (prerequisite_target::include_udm); - if (update_match) - match_members (a, t, pts, start, {2, 2}); + match_members (a, t, pts, start, {mask, 0}); + + if (update_match) + match_members (a, t, pts, start, {mask, mask}); + } // Check if we have any binful utility libraries. // @@ -1383,7 +1387,7 @@ namespace build2 // prerequisite_target::data. // if (update_match) - update_during_match_prerequisites (trace, a, t, 2 /* mask */); + update_during_match_prerequisites (trace, a, t); // Now that we know for sure whether we are binless, derive file name(s) // and add ad hoc group members. Note that for binless we still need the |