aboutsummaryrefslogtreecommitdiff
path: root/build2/in/rule.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-17 13:18:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-17 13:18:17 +0200
commitfe6f3ec0868185511f5acefb2729eb879798f052 (patch)
tree63a44a73be76ebbdc0be95c72b85756a6442c4eb /build2/in/rule.hxx
parent3a739d4fe0aa7ed1786a93a20c7f43a69b0ebd16 (diff)
Reimplement version::in_rule in terms of in::rule
Significantly, the version::in_rule rule now track changes to the substitution values.
Diffstat (limited to 'build2/in/rule.hxx')
-rw-r--r--build2/in/rule.hxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/build2/in/rule.hxx b/build2/in/rule.hxx
index a68e80c..17fbaed 100644
--- a/build2/in/rule.hxx
+++ b/build2/in/rule.hxx
@@ -16,11 +16,24 @@ namespace build2
{
// Preprocess an .in file.
//
+ // Note that a derived rule can use the target data pad to cache data
+ // (e.g., in match()) to be used in substitute/lookup() calls.
+ //
class rule: public build2::rule
{
public:
- rule (char symbol = '$', bool strict = true)
- : symbol_ (symbol), strict_ (strict) {}
+ // The rule id is used to form the rule name/version entry in depdb. The
+ // program argument is the pseudo-program name to use in the command
+ // line diagnostics.
+ //
+ rule (string rule_id,
+ string program,
+ char symbol = '$',
+ bool strict = true)
+ : rule_id_ (move (rule_id)),
+ program_ (move (program)),
+ symbol_ (symbol),
+ strict_ (strict) {}
virtual bool
match (action, target&, const string&) const override;
@@ -46,6 +59,8 @@ namespace build2
perform_update (action, const target&) const;
protected:
+ const string rule_id_;
+ const string program_;
char symbol_;
bool strict_;
};