aboutsummaryrefslogtreecommitdiff
path: root/build/rule.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/rule.cxx')
-rw-r--r--build/rule.cxx36
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;
+ }
}