aboutsummaryrefslogtreecommitdiff
path: root/build2/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-08 17:07:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-08 17:07:27 +0200
commitc865883666028da1982b082a0754cc4a261afd27 (patch)
tree1ea2b0e188366f0b04f3eaacddbfd62ef32ab980 /build2/rule.cxx
parent86576cdd3c8d959ffe93f49b7744a99164f172ee (diff)
Add dependency on fsdir{} in alias rules
This makes sure that a directory with only dir{} target gets cleaned up.
Diffstat (limited to 'build2/rule.cxx')
-rw-r--r--build2/rule.cxx12
1 files changed, 9 insertions, 3 deletions
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);