aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-05-31 12:37:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-06-08 15:43:08 +0200
commitc5feaaf745421f2ecda672585c462cf4c807d25d (patch)
treeda5b002dbd03fd624462cacfebb469df63708e63 /libbuild2/parser.cxx
parent274d65d2a76ed48cb618e25e0916e20ba3d5c87b (diff)
Only pass target to recipe_text() if recipe is not shared
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r--libbuild2/parser.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx
index 120d6ab..d1db568 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -1208,6 +1208,7 @@ namespace build2
default_target_ = target_;
}
+ bool multi (replay_ != replay::stop); // Multiple targets.
bool first (replay_ != replay::play); // First target.
bool clean (false); // Seen recipe that requires cleanup.
@@ -1223,13 +1224,14 @@ namespace build2
struct data
{
small_vector<shared_ptr<adhoc_rule>, 1>& recipes;
+ bool multi;
bool first;
bool& clean;
size_t i;
attributes& as;
buildspec& bs;
const location& bsloc;
- } d {recipes, first, clean, i, as, bs, bsloc};
+ } d {recipes, multi, first, clean, i, as, bs, bsloc};
// Note that this function must be called at most once per iteration.
//
@@ -1431,8 +1433,12 @@ namespace build2
{
adhoc_recipe& ar (ars.back ());
- if (ar.rule->recipe_text (
- ctx, *target_, ar.actions, move (t.value), d.as))
+ if (ar.rule->recipe_text (ctx,
+ *scope_,
+ d.multi ? nullptr : target_,
+ ar.actions,
+ move (t.value),
+ d.as))
d.clean = true;
// Verify we have no unhandled attributes.