diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-19 16:10:03 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-19 16:10:03 +0200 |
commit | 8bd89cfca333e58f6990d7d168649dfc79878f31 (patch) | |
tree | 730bb9eec4fc5ddd086ed8465c4d7c0030db0d6b /build/rule.cxx | |
parent | b0524a0b18eec9d5e5c3f6ce30b6cecdd02a6306 (diff) |
Add support for sourcing/including buildfiles, print, dir{} alias
Diffstat (limited to 'build/rule.cxx')
-rw-r--r-- | build/rule.cxx | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/build/rule.cxx b/build/rule.cxx index d40eebf..e145ea8 100644 --- a/build/rule.cxx +++ b/build/rule.cxx @@ -14,9 +14,9 @@ namespace build { rule_map rules; - // default_path_rule + // path_rule // - void* default_path_rule:: + void* path_rule:: match (target& t, const string&) const { // @@ TODO: @@ -51,13 +51,13 @@ namespace build return pt.mtime () != timestamp_nonexistent ? &t : nullptr; } - recipe default_path_rule:: + recipe path_rule:: select (target&, void*) const { return &update; } - target_state default_path_rule:: + target_state path_rule:: update (target& t) { // Make sure the target is not older than any of its prerequisites. @@ -99,4 +99,32 @@ namespace build return target_state::uptodate; } + + // dir_rule + // + void* dir_rule:: + match (target& t, const string&) const + { + return &t; + } + + recipe dir_rule:: + select (target&, void*) const + { + return &update; + } + + target_state dir_rule:: + update (target& t) + { + for (const prerequisite& p: t.prerequisites) + { + auto ts (p.target->state ()); + + if (ts != target_state::uptodate) + return ts; // updated or failed + } + + return target_state::uptodate; + } } |