From 566bcb8c4c36d12e398f00349c5f27cae06fa7a9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 27 Jul 2017 18:40:52 +0200 Subject: Implement displaying build progress (--progress|-p) --- build2/target.ixx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'build2/target.ixx') diff --git a/build2/target.ixx b/build2/target.ixx index d2edf89..48036be 100644 --- a/build2/target.ixx +++ b/build2/target.ixx @@ -124,6 +124,8 @@ namespace build2 return r; } + extern atomic_count target_count; // context.hxx + inline void target:: recipe (recipe_type r) { @@ -135,16 +137,21 @@ namespace build2 // if (state_ != target_state::failed) { + state_ = target_state::unknown; + // If this is a noop recipe, then mark the target unchanged to allow for // some optimizations. // - state_ = target_state::unknown; - - if (recipe_function** f = recipe_.target ()) - { - if (*f == &noop_action) - state_ = target_state::unchanged; - } + recipe_function** f (recipe_.target ()); + + if (f != nullptr && *f == &noop_action) + state_ = target_state::unchanged; + else + // This gets tricky when we start considering overrides (which can + // only happen for noop recipes), direct execution, etc. So here seems + // like the best place to do this. + // + target_count.fetch_add (1, memory_order_relaxed); } } -- cgit v1.1