aboutsummaryrefslogtreecommitdiff
path: root/build/algorithm.cxx
diff options
context:
space:
mode:
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;
}