From c5feaaf745421f2ecda672585c462cf4c807d25d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 31 May 2021 12:37:59 +0200 Subject: Only pass target to recipe_text() if recipe is not shared --- libbuild2/parser.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libbuild2/parser.cxx') 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, 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. -- cgit v1.1