aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/algorithm3
-rw-r--r--build/algorithm.cxx23
-rw-r--r--build/cxx/rule.cxx5
3 files changed, 7 insertions, 24 deletions
diff --git a/build/algorithm b/build/algorithm
index 2dc7164..bc756c2 100644
--- a/build/algorithm
+++ b/build/algorithm
@@ -70,7 +70,8 @@ namespace build
// Inject dependency on the parent directory's fsdir{}, unless it is
// the project's out_root (or is outside of any project; say, for
- // example, an install directory).
+ // example, an install directory). Normally this function is called
+ // from the rule's apply() function.
//
void
inject_parent_fsdir (action, target&);
diff --git a/build/algorithm.cxx b/build/algorithm.cxx
index 2529e13..abae023 100644
--- a/build/algorithm.cxx
+++ b/build/algorithm.cxx
@@ -206,26 +206,11 @@ namespace build
if (!d.sub (out_root) || d == out_root)
return;
- prerequisite& p (
- s.prerequisites.insert (
- fsdir::static_type,
- d,
- string (),
- nullptr,
- s,
- trace).first);
-
- // This function is normally called from match() which means
- // it can be called several times if we are performing several
- // operations (e.g., clean update). Since it is a fairly common
- // pattern to add this prerequisite at the end, do a quick check
- // if the last prerequisite is already what we are about to add.
- //
- if (!t.prerequisites.empty () && &t.prerequisites.back ().get () == &p)
- return;
+ level5 ([&]{trace << "for " << t;});
- level5 ([&]{trace << "injecting prerequisite for " << t;});
- t.prerequisites.emplace_back (p);
+ fsdir& dt (search<fsdir> (d, string (), nullptr, &s));
+ match (a, dt);
+ t.prerequisite_targets.emplace_back (&dt);
}
target_state
diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx
index 72c4e35..9564638 100644
--- a/build/cxx/rule.cxx
+++ b/build/cxx/rule.cxx
@@ -610,10 +610,7 @@ namespace build
// Process prerequisites: do rule chaining for C and C++ source
// files as well as search and match.
//
- group_prerequisites gp (t);
- t.prerequisite_targets.reserve (gp.size ());
-
- for (prerequisite_ref& pr: gp)
+ for (prerequisite_ref& pr: group_prerequisites (t))
{
bool group (!pr.belongs (t)); // Target group's prerequisite.