From ca41ca8f9a6b21588248e5fee1a013363f3f52a8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 13 Mar 2015 14:34:24 +0200 Subject: Add support for "first" and "last" execution modes --- build/algorithm.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'build/algorithm.cxx') diff --git a/build/algorithm.cxx b/build/algorithm.cxx index 776ea3e..109f456 100644 --- a/build/algorithm.cxx +++ b/build/algorithm.cxx @@ -223,6 +223,25 @@ namespace build return ts; } + target_state + reverse_execute_prerequisites (action a, target& t) + { + target_state ts (target_state::unchanged); + + for (const prerequisite& p: reverse_iterate (t.prerequisites)) + { + if (p.target == nullptr) // Skip ignored. + continue; + + target& pt (*p.target); + + if (execute (a, pt) == target_state::changed) + ts = target_state::changed; + } + + return ts; + } + bool execute_prerequisites (action a, target& t, const timestamp& mt) { @@ -314,7 +333,7 @@ namespace build target_state ts (target_state::unchanged); if (!t.prerequisites.empty ()) - ts = execute_prerequisites (a, t); + ts = reverse_execute_prerequisites (a, t); return rs == rmfile_status::success ? target_state::changed : ts; } -- cgit v1.1