diff options
-rw-r--r-- | libbuild2/parser.cxx | 32 | ||||
-rw-r--r-- | libbuild2/rule.hxx | 5 |
2 files changed, 33 insertions, 4 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index d50f86f..9c26f74 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -1108,12 +1108,16 @@ namespace build2 for (shared_ptr<adhoc_rule>& pr: recipes) { - adhoc_rule& r (*pr); - r.pattern = &rp; // Connect recipe to pattern. + pr->pattern = &rp; // Connect recipe to pattern. rp.rules.push_back (move (pr)); + } + + // Register this adhoc rule for all its actions. + // + for (shared_ptr<adhoc_rule>& pr: rp.rules) + { + adhoc_rule& r (*pr); - // Register this adhoc rule for all its actions. - // for (action a: r.actions) { // This covers both duplicate recipe actions withing the rule @@ -1146,6 +1150,26 @@ namespace build2 scope_->rules.insert ( a.meta_operation (), 0, *ttype, rp.rule_name, rp.fallback_rule_); + + // We also register for the dist meta-operation in order to + // inject additional prerequisites which may "pull" additional + // sources into the distribution. Unless there is an explicit + // recipe for dist. + // + if (a.meta_operation () == perform_id) + { + action da (dist_id, a.operation ()); + + for (shared_ptr<adhoc_rule>& pr: rp.rules) + for (action a: pr->actions) + if (da == a) + goto skip; + + scope_->rules.insert (da, *ttype, rp.rule_name, r); + + skip: + ; + } } } } diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx index 3eb7775..364e3ff 100644 --- a/libbuild2/rule.hxx +++ b/libbuild2/rule.hxx @@ -149,6 +149,11 @@ namespace build2 // auxiliary data storage until the pattern's apply_*() calls have been // made. // + // Note also that when used as part of a pattern, the rule is also register + // for the dist meta-operation (unless there is an explicit recipe for dist) + // in order to inject additional pattern prerequisites which may "pull" + // additional sources into the distribution. + // // Note: not exported. // class adhoc_rule_pattern; |