aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-08-04 06:45:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-08-04 06:45:02 +0200
commitea57c514dc169afb3ece21ff2e4c1d2ab0c47d6a (patch)
treee71ca9c5adf25aabb7ddb6a5e887415ecbfb36c0 /libbuild2/parser.cxx
parente767684a3462059852f7067a2297b1e18fdb3137 (diff)
Take into account file-base'ness in ad hoc buildscript recipes
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 a6f6ae6..076bcf5 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -1104,7 +1104,7 @@ namespace build2
if (tt == type::percent || tt == type::multi_lcbrace)
{
small_vector<shared_ptr<adhoc_rule>, 1> recipes;
- parse_recipe (t, tt, token (t), recipes, rn);
+ parse_recipe (t, tt, token (t), recipes, ttype, rn);
for (shared_ptr<adhoc_rule>& pr: recipes)
{
@@ -1533,6 +1533,7 @@ namespace build2
parse_recipe (token& t, type& tt,
const token& start,
small_vector<shared_ptr<adhoc_rule>, 1>& recipes,
+ const target_type* ttype,
const string& name)
{
// Parse a recipe chain.
@@ -1581,6 +1582,7 @@ namespace build2
struct data
{
+ const target_type* ttype;
const string& name;
small_vector<shared_ptr<adhoc_rule>, 1>& recipes;
bool first;
@@ -1589,7 +1591,7 @@ namespace build2
attributes& as;
buildspec& bs;
const location& bsloc;
- } d {name, recipes, first, clean, i, as, bs, bsloc};
+ } d {ttype, name, recipes, first, clean, i, as, bs, bsloc};
// Note that this function must be called at most once per iteration.
//
@@ -1797,7 +1799,11 @@ namespace build2
// Set the recipe text.
//
- if (ar.recipe_text (*scope_, move (t.value), d.as))
+ if (ar.recipe_text (
+ *scope_,
+ d.ttype != nullptr ? *d.ttype : target_->type (),
+ move (t.value),
+ d.as))
d.clean = true;
// Verify we have no unhandled attributes.