From fefe0657f29b8db782f7a722dd46b074b991cf08 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Feb 2015 15:56:03 +0200 Subject: Redo rule match/build logic Now the rule is fully responsible for searching, matching, and building of prerequisites. --- build/algorithm | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'build/algorithm') diff --git a/build/algorithm b/build/algorithm index a3b0db9..82913ad 100644 --- a/build/algorithm +++ b/build/algorithm @@ -5,16 +5,58 @@ #ifndef BUILD_ALGORITHM #define BUILD_ALGORITHM +#include +#include + namespace build { - class target; class prerequisite; + // The default prerequsite search implementation. It first calls the + // target-type-specific search function. If that doesn't yeld anything, + // it creates a new target. + // target& search (prerequisite&); - bool + // Match a rule to the target with ambiguity detection. + // + void match (target&); + + // The default prerequisite search and match implementation. It calls + // search() and then match() for each prerequisite in a loop. + // + void + search_and_match (target&); + + target_state + update (target&); + + // The default prerequisite update implementation. It calls update() + // for each prerequisite in a loop. Returns target_state::updated + // if any of them were updated and target_state::uptodate otherwise. + // + target_state + update_prerequisites (target&); + + // A version of the above that also determines whether the target + // needs updating based on the passed timestamp. + // + bool + update_prerequisites (target&, const timestamp&); + + // Another version of the above that does two extra things for the + // caller: it determines whether the target needs updating based + // on the passed timestamp and, if so, finds a prerequisite of the + // specified type. + // + template + T* + update_prerequisites (target&, const timestamp&); } +#include +#include + #endif // BUILD_ALGORITHM -- cgit v1.1