aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/algorithm.ixx3
-rw-r--r--build/context.txx2
-rw-r--r--build/rule.cxx9
3 files changed, 10 insertions, 4 deletions
diff --git a/build/algorithm.ixx b/build/algorithm.ixx
index ce581c5..bb66b53 100644
--- a/build/algorithm.ixx
+++ b/build/algorithm.ixx
@@ -126,7 +126,8 @@ namespace build
switch (target_state ts = t.state ())
{
case target_state::unchanged:
- case target_state::changed: return ts;
+ case target_state::changed:
+ return ts;
default:
{
// Handle the "last" execution mode.
diff --git a/build/context.txx b/build/context.txx
index b9004e0..eb1568c 100644
--- a/build/context.txx
+++ b/build/context.txx
@@ -52,7 +52,7 @@ namespace build
{
using namespace butl;
- bool w (d == work); // Don't try to remove working directory.
+ bool w (work.sub (d)); // Don't try to remove working directory.
rmdir_status rs;
// We don't want to print the command if we couldn't remove the
diff --git a/build/rule.cxx b/build/rule.cxx
index 9f17a2c..97cd20f 100644
--- a/build/rule.cxx
+++ b/build/rule.cxx
@@ -242,8 +242,13 @@ namespace build
//
switch (rs)
{
- case rmdir_status::success: ts |= target_state::changed;
- case rmdir_status::not_empty: ts |= target_state::postponed;
+ case rmdir_status::success: ts |= target_state::changed; break;
+ case rmdir_status::not_empty:
+ {
+ if (!work.sub (t.dir)) // No use postponing removing working directory.
+ ts |= target_state::postponed;
+ break;
+ }
default: break;
}