aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bash
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/bash')
-rw-r--r--libbuild2/bash/rule.cxx18
-rw-r--r--libbuild2/bash/rule.hxx4
2 files changed, 15 insertions, 7 deletions
diff --git a/libbuild2/bash/rule.cxx b/libbuild2/bash/rule.cxx
index 6e287e0..6e96b34 100644
--- a/libbuild2/bash/rule.cxx
+++ b/libbuild2/bash/rule.cxx
@@ -63,10 +63,12 @@ namespace build2
// in_rule
//
bool in_rule::
- match (action a, target& t, const string& hint, match_extra&) const
+ match (action a, target& xt, const string& hint, match_extra&) const
{
tracer trace ("bash::in_rule::match");
+ file& t (xt.as<file> ()); // Only registered for exe{} and bash{}.
+
// Note that for bash{} and for exe{} with hint we match even if the
// target does not depend on any modules (while it could have been
// handled by the in module, that would require loading it).
@@ -89,6 +91,12 @@ namespace build2
l4 ([&]{trace << "no bash module prerequisite or hint for target "
<< t;});
+ // If we match, derive the file name early as recommended by the in
+ // rule.
+ //
+ if (fi && fm)
+ t.derive_path ();
+
return fi && fm;
}
@@ -406,7 +414,7 @@ namespace build2
"source \"$(dirname"
" \"$(readlink -f"
" \"${BASH_SOURCE[0]}\")\")/"
- + iip.string () + "\"";
+ + iip.string () + '"';
}
else
{
@@ -427,7 +435,7 @@ namespace build2
return
"source \"$(dirname"
" \"${BASH_SOURCE[0]}\")/"
- + o + iip.string () + "\"";
+ + o + iip.string () + '"';
}
}
else
@@ -447,9 +455,9 @@ namespace build2
}
recipe install_rule::
- apply (action a, target& t) const
+ apply (action a, target& t, match_extra& me) const
{
- recipe r (file_rule::apply_impl (a, t));
+ recipe r (file_rule::apply_impl (a, t, me));
if (r == nullptr)
return noop_recipe;
diff --git a/libbuild2/bash/rule.hxx b/libbuild2/bash/rule.hxx
index 5bd7fa7..3f9618f 100644
--- a/libbuild2/bash/rule.hxx
+++ b/libbuild2/bash/rule.hxx
@@ -29,7 +29,7 @@ namespace build2
class LIBBUILD2_BASH_SYMEXPORT in_rule: public in::rule
{
public:
- in_rule (): rule ("bash.in 1", "bash.in", '@', false /* strict */) {}
+ in_rule (): rule ("bash.in 1", "bash", '@', false /* strict */) {}
virtual bool
match (action, target&, const string&, match_extra&) const override;
@@ -74,7 +74,7 @@ namespace build2
match (action, target&) const override;
virtual recipe
- apply (action, target&) const override;
+ apply (action, target&, match_extra&) const override;
protected:
const in_rule& in_;