From 8f8ab1e8f6d85748547c0d0e9987eed4f3c3e17b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 Apr 2015 15:08:05 +0200 Subject: Add support for target groups, use to handle obj/obja/objso object targets --- build/algorithm.txx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'build/algorithm.txx') 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 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 (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 (&pt)) + if (auto mpt = dynamic_cast (pt)) { timestamp mp (mpt->mtime ()); @@ -50,11 +50,10 @@ namespace build } } - if (r == nullptr) - r = dynamic_cast (&pt); + if (T* tmp = dynamic_cast (pt)) + r = tmp; } - assert (r != nullptr); - return e ? r : nullptr; + return r; } } -- cgit v1.1