aboutsummaryrefslogtreecommitdiff
path: root/build/algorithm.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-17 15:08:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-17 15:08:05 +0200
commit8f8ab1e8f6d85748547c0d0e9987eed4f3c3e17b (patch)
tree1ef9a9f271d688f1f6f2eb3fc5a8972574677433 /build/algorithm.txx
parent6535bf6175af32e2514faf75d2742424751a783b (diff)
Add support for target groups, use to handle obj/obja/objso object targets
Diffstat (limited to 'build/algorithm.txx')
-rw-r--r--build/algorithm.txx23
1 files changed, 11 insertions, 12 deletions
diff --git a/build/algorithm.txx b/build/algorithm.txx
index 1e22be1..2592b5e 100644
--- a/build/algorithm.txx
+++ b/build/algorithm.txx
@@ -6,29 +6,29 @@ namespace build
{
template <typename T>
T*
- execute_prerequisites (action a, target& t, const timestamp& mt)
+ execute_prerequisites (action a, target& t, const timestamp& mt, bool& e)
{
//@@ Can factor the bulk of it into a non-template code. Can
// either do a function template that will do dynamic_cast check
// or can scan the target type info myself. I think latter.
//
-
T* r (nullptr);
- bool e (mt == timestamp_nonexistent);
- for (const prerequisite& p: t.prerequisites)
+ if (t.group != nullptr)
+ r = execute_prerequisites<T> (a, *t.group, mt, e);
+
+ for (target* pt: t.prerequisites)
{
- if (p.target == nullptr) // Skip ignored.
+ if (pt == nullptr) // Skip ignored.
continue;
- target& pt (*p.target);
- target_state ts (execute (a, pt));
+ target_state ts (execute (a, *pt));
if (!e)
{
// If this is an mtime-based target, then compare timestamps.
//
- if (auto mpt = dynamic_cast<const mtime_target*> (&pt))
+ if (auto mpt = dynamic_cast<const mtime_target*> (pt))
{
timestamp mp (mpt->mtime ());
@@ -50,11 +50,10 @@ namespace build
}
}
- if (r == nullptr)
- r = dynamic_cast<T*> (&pt);
+ if (T* tmp = dynamic_cast<T*> (pt))
+ r = tmp;
}
- assert (r != nullptr);
- return e ? r : nullptr;
+ return r;
}
}