From 4277226e4b0abea10ff38abdd34636c483a59329 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 24 Nov 2021 13:32:08 +0200 Subject: Add ability to add extra depdb entries in in::rule --- libbuild2/in/rule.cxx | 9 +++++++++ libbuild2/in/rule.hxx | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'libbuild2') 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 +#include // depdb #include #include @@ -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&, -- cgit v1.1