aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/rule.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/rule.cxx')
-rw-r--r--libbuild2/rule.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx
index 0d6ec8c..13dd467 100644
--- a/libbuild2/rule.cxx
+++ b/libbuild2/rule.cxx
@@ -366,6 +366,8 @@ namespace build2
// Don't fail if we couldn't remove the directory because it is not empty
// (or is current working directory). In this case rmdir() will issue a
// warning when appropriate.
+
+ // The same code as in perform_clean_direct() below.
//
target_state ts (rmdir (t.dir, t, t.ctx.current_diag_noise ? 1 : 2)
? target_state::changed
@@ -377,6 +379,23 @@ namespace build2
return ts;
}
+ void fsdir_rule::
+ perform_clean_direct (action a, const target& t)
+ {
+ // The same code as in perform_clean() above.
+ //
+ rmdir (t.dir, t, t.ctx.current_diag_noise ? 1 : 2);
+
+ // Then clean the parent directory. If present, it is always first.
+ //
+ const target* p (t.prerequisite_targets[a].empty ()
+ ? nullptr
+ : t.prerequisite_targets[a][0]);
+
+ if (p != nullptr && p->is_a<fsdir> ())
+ perform_clean_direct (a, *p);
+ }
+
const fsdir_rule fsdir_rule::instance;
// noop_rule