diff options
Diffstat (limited to 'build/algorithm.cxx')
-rw-r--r-- | build/algorithm.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/build/algorithm.cxx b/build/algorithm.cxx index 83a6510..290bfa5 100644 --- a/build/algorithm.cxx +++ b/build/algorithm.cxx @@ -339,35 +339,39 @@ namespace build target_state execute_prerequisites (action a, target& t) { - target_state ts (target_state::unchanged); + target_state r (target_state::unchanged); for (target* pt: t.prerequisite_targets) { if (pt == nullptr) // Skipped. continue; - if (execute (a, *pt) == target_state::changed) - ts = target_state::changed; + target_state ts (execute (a, *pt)); + if (ts == target_state::changed || + (ts == target_state::postponed && r == target_state::unchanged)) + r = ts; } - return ts; + return r; } target_state reverse_execute_prerequisites (action a, target& t) { - target_state ts (target_state::unchanged); + target_state r (target_state::unchanged); for (target* pt: reverse_iterate (t.prerequisite_targets)) { if (pt == nullptr) // Skipped. continue; - if (execute (a, *pt) == target_state::changed) - ts = target_state::changed; + target_state ts (execute (a, *pt)); + if (ts == target_state::changed || + (ts == target_state::postponed && r == target_state::unchanged)) + r = ts; } - return ts; + return r; } bool |