diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-27 18:40:52 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-27 18:40:52 +0200 |
commit | 566bcb8c4c36d12e398f00349c5f27cae06fa7a9 (patch) | |
tree | d7090693a6f13cf4995a24724675faa8a5582296 /build2/target.ixx | |
parent | d14d3123c7cdb53a635d4be55902c09a410c28cc (diff) |
Implement displaying build progress (--progress|-p)
Diffstat (limited to 'build2/target.ixx')
-rw-r--r-- | build2/target.ixx | 21 |
1 files changed, 14 insertions, 7 deletions
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<recipe_function*> ()) - { - if (*f == &noop_action) - state_ = target_state::unchanged; - } + recipe_function** f (recipe_.target<recipe_function*> ()); + + 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); } } |