From 4be404cd8b7f4c7b450364defea92cd02e9b7a62 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 21 Jul 2015 15:51:54 +0200 Subject: Improve nested operations support The idea is this: we need to be able to override "conditional, inner for outer" recipes with the "unconditional inner" ones. Here is the concrete scenario: we have {update, test} action and the lib{} target that is both mentioned as a prerequisite of ./ and exe{}, which is a test. At first, we want to ignore lib{} when reached as a prerequisite of ./. But then we get to it via exe{} (which is a test and thus should be updated). At this point we should override the recipe for lib{} with the one that would update it rather than ignore. --- build/target | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'build/target') diff --git a/build/target b/build/target index e07f6e0..f5a26b4 100644 --- a/build/target +++ b/build/target @@ -303,16 +303,21 @@ namespace build std::size_t dependents; public: + typedef build::action action_type; + + action_type action; // Action this recipe is for. + + public: typedef build::recipe recipe_type; const recipe_type& - recipe (action a) const {return action_ == a ? recipe_ : empty_recipe;} + recipe (action_type a) const {return a > action ? empty_recipe : recipe_;} void - recipe (action a, recipe_type r) + recipe (action_type a, recipe_type r) { - assert (action_ != a || !recipe_); - action_ = a; + assert (a > action || !recipe_); + action = a; recipe_ = std::move (r); // Also reset the target state. If this is a noop recipe, then @@ -348,7 +353,6 @@ namespace build static const target_type static_type; private: - action action_; // Action this recipe is for. recipe_type recipe_; }; -- cgit v1.1