aboutsummaryrefslogtreecommitdiff
path: root/build/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-13 14:34:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-13 14:34:24 +0200
commitca41ca8f9a6b21588248e5fee1a013363f3f52a8 (patch)
tree6e791ddac1c6f794273a9701c0c7f1bc9ec3d000 /build/algorithm.cxx
parent0cee33621a93d3348a1bf19a0c94441b717cbcbc (diff)
Add support for "first" and "last" execution modes
Diffstat (limited to 'build/algorithm.cxx')
-rw-r--r--build/algorithm.cxx21
1 files changed, 20 insertions, 1 deletions
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;
}