From c865883666028da1982b082a0754cc4a261afd27 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Jul 2016 17:07:27 +0200 Subject: Add dependency on fsdir{} in alias rules This makes sure that a directory with only dir{} target gets cleaned up. --- build2/rule.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'build2/rule.cxx') diff --git a/build2/rule.cxx b/build2/rule.cxx index b010ae2..cbb7d08 100644 --- a/build2/rule.cxx +++ b/build2/rule.cxx @@ -144,6 +144,11 @@ namespace build2 recipe alias_rule:: apply (action a, target& t, const match_result&) const { + // Inject dependency on our directory (note: not parent) so that it is + // automatically created on update and removed on clean. + // + inject_fsdir (a, t, false); + search_and_match_prerequisites (a, t); return default_recipe; } @@ -161,11 +166,12 @@ namespace build2 recipe fsdir_rule:: apply (action a, target& t, const match_result&) const { - // Inject dependency on the parent directory. Note that we - // don't do it for clean since we shouldn't be removing it. + // Inject dependency on the parent directory. Note that we don't do it for + // clean since we shouldn't (and can't possibly, since it's our parent) be + // removing it. // if (a.operation () != clean_id) - inject_parent_fsdir (a, t); + inject_fsdir (a, t); search_and_match_prerequisites (a, t); -- cgit v1.1