aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-07-20 10:18:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-07-20 10:18:54 +0200
commit317e2cb68753c7b89783a3c829ba53889a370f8c (patch)
tree04b803c94b95645130dc7942cdf53aa9a0357672 /libbuild2/build
parentd3ef150c45d9325bc075d33a00c8cf0a6b1bf954 (diff)
Don't treat unmatched prerequisites as implicitly ad hoc
It was surprising and inconvenient that they didn't end up in $<. Plus, such prerequisites can always be marked as ad hoc explicitly.
Diffstat (limited to 'libbuild2/build')
-rw-r--r--libbuild2/build/script/script.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/libbuild2/build/script/script.cxx b/libbuild2/build/script/script.cxx
index 0f31e7f..0d96cc3 100644
--- a/libbuild2/build/script/script.cxx
+++ b/libbuild2/build/script/script.cxx
@@ -7,6 +7,8 @@
#include <libbuild2/target.hxx>
+#include <libbuild2/adhoc-rule-buildscript.hxx> // include_unmatch*
+
#include <libbuild2/script/timeout.hxx>
#include <libbuild2/build/script/parser.hxx>
@@ -91,13 +93,25 @@ namespace build2
// much sense, they could be handy to exclude certain prerequisites
// from $< while still treating them as such, especially in rule.
//
+ // While initially we treated update=unmatch prerequisites as
+ // implicitly ad hoc, this turned out to be not quite correct, so
+ // now we add them unless they are explicitly marked ad hoc.
+ //
names ns;
- for (const prerequisite_target& pt: target.prerequisite_targets[a])
+ for (const prerequisite_target& p: target.prerequisite_targets[a])
{
// See adhoc_buildscript_rule::execute_update_prerequisites().
//
- if (pt.target != nullptr && !pt.adhoc ())
- pt.target->as_name (ns);
+ if (const target_type* pt =
+ p.target != nullptr ? (p.adhoc () ? nullptr : p.target) :
+ (p.include & adhoc_buildscript_rule::include_unmatch) != 0 &&
+ (p.include & prerequisite_target::include_adhoc) == 0 &&
+ (p.include & adhoc_buildscript_rule::include_unmatch_adhoc) == 0
+ ? reinterpret_cast<target_type*> (p.data)
+ : nullptr)
+ {
+ pt->as_name (ns);
+ }
}
assign (var_ps) = move (ns);