aboutsummaryrefslogtreecommitdiff
path: root/build/bin/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-20 17:35:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-20 17:35:47 +0200
commitcb8399da1f0b1c5f28e443c98bfc3cb4e12b8cbf (patch)
tree434f2137e8ccac53bf6ec8a62bab501363d898f4 /build/bin/rule.cxx
parentf0aca8db08518ab7f66a8c86200616fed8bcc8d4 (diff)
Implement pre/post operation support
Also, extend execution mode/postponed logic to propagate the postponed target state. At the top, we now re-try postponed targets. This results in the expected behavior when, for example, cleaning two targets with one depending on the other.
Diffstat (limited to 'build/bin/rule.cxx')
-rw-r--r--build/bin/rule.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/build/bin/rule.cxx b/build/bin/rule.cxx
index 0fc0e40..0eb8363 100644
--- a/build/bin/rule.cxx
+++ b/build/bin/rule.cxx
@@ -114,15 +114,25 @@ namespace build
if (current_mode == execution_mode::last)
swap (m1, m2);
- target_state ts (target_state::unchanged);
+ target_state r (target_state::unchanged), ts;
- if (m1 != nullptr && execute (a, *m1) == target_state::changed)
- ts = target_state::changed;
+ if (m1 != nullptr)
+ {
+ ts = execute (a, *m1);
+ if (ts == target_state::changed ||
+ (ts == target_state::postponed && r == target_state::unchanged))
+ r = ts;
+ }
- if (m2 != nullptr && execute (a, *m2) == target_state::changed)
- ts = target_state::changed;
+ if (m2 != nullptr)
+ {
+ ts = execute (a, *m2);
+ if (ts == target_state::changed ||
+ (ts == target_state::postponed && r == target_state::unchanged))
+ r = ts;
+ }
- return ts;
+ return r;
}
}
}