aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/in
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-11-24 13:32:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-11-24 13:32:08 +0200
commit4277226e4b0abea10ff38abdd34636c483a59329 (patch)
tree81045a4c299c02a3afcac0c9744d12e485461d8f /libbuild2/in
parentd82719606408de169097715d673745a96d9b1d56 (diff)
Add ability to add extra depdb entries in in::rule
Diffstat (limited to 'libbuild2/in')
-rw-r--r--libbuild2/in/rule.cxx9
-rw-r--r--libbuild2/in/rule.hxx18
2 files changed, 21 insertions, 6 deletions
diff --git a/libbuild2/in/rule.cxx b/libbuild2/in/rule.cxx
index 4eab287..941f44d 100644
--- a/libbuild2/in/rule.cxx
+++ b/libbuild2/in/rule.cxx
@@ -157,6 +157,10 @@ namespace build2
l4 ([&]{trace << "substitution mode mismatch forcing update of"
<< t;});
+ // Then additional depdb entries, if any.
+ //
+ perform_update_depdb (a, t, dd);
+
// Then the .in file.
//
if (dd.expect (i.path ()) != nullptr)
@@ -407,6 +411,11 @@ namespace build2
}
void rule::
+ perform_update_depdb (action, const target&, depdb&) const
+ {
+ }
+
+ void rule::
process (const location& l,
action a, const target& t,
depdb& dd, size_t dd_skip,
diff --git a/libbuild2/in/rule.hxx b/libbuild2/in/rule.hxx
index 162ce78..ff7a2f3 100644
--- a/libbuild2/in/rule.hxx
+++ b/libbuild2/in/rule.hxx
@@ -5,6 +5,7 @@
#define LIBBUILD2_IN_RULE_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx> // depdb
#include <libbuild2/utility.hxx>
#include <libbuild2/rule.hxx>
@@ -18,7 +19,7 @@ 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.
+ // (e.g., in match() or apply()) to be used in substitute/lookup() calls.
//
// Note also that currently this rule ignores the dry-run mode (see
// perform_update() for the rationale).
@@ -52,11 +53,6 @@ namespace build2
// Customization hooks and helpers.
//
- // Flags can be used by a custom implementation to alter the lookup
- // semantics, for example, for special substitutions. Note, however,
- // that one must make sure this semantics cannot change without changes
- // to the .in file (see the depdb logic for details).
- //
// Perform prerequisite search.
//
@@ -65,8 +61,18 @@ namespace build2
const prerequisite_member&,
include_type) const;
+ // Additional depdb entries.
+ //
+ virtual void
+ perform_update_depdb (action, const target&, depdb&) const;
+
// Perform variable lookup.
//
+ // Flags can be used by a custom implementation to alter the lookup
+ // semantics, for example, for special substitutions. Note, however,
+ // that one must make sure this semantics cannot change without changes
+ // to the .in file (see the depdb logic for details).
+ //
virtual string
lookup (const location&,
action, const target&,