aboutsummaryrefslogtreecommitdiff
path: root/build/rule
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-21 16:21:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-21 16:21:07 +0200
commita1cec9e0df14f3c1a833e2a447b5324ff9c430d3 (patch)
treee61c7e1cb3fa27ba435053761f5a2a3fb670f728 /build/rule
parentbead742dbac51088e89cdd4dd7a55aaa1d8c98d7 (diff)
Test module genesis
Diffstat (limited to 'build/rule')
-rw-r--r--build/rule20
1 files changed, 18 insertions, 2 deletions
diff --git a/build/rule b/build/rule
index 5b0149b..ea0b5ae 100644
--- a/build/rule
+++ b/build/rule
@@ -23,9 +23,19 @@ namespace build
// Can contain neither (both are NULL), one of, or both. If both
// are NULL, then it is a "no match" indicator.
//
- prerequisite_type* prerequisite;
+ // Note that if the "payload" is stored in value instead of
+ // prerequisite, then target must not be NULL.
+ //
+ union
+ {
+ prerequisite_type* prerequisite;
+ bool value;
+ };
+
target_type* target;
+ match_result (target_type& t, bool v): value (v), target (&t) {}
+
match_result (std::nullptr_t v = nullptr): prerequisite (v), target (v) {}
match_result (prerequisite_type& p): prerequisite (&p), target (nullptr) {}
match_result (prerequisite_type* p): prerequisite (p), target (nullptr) {}
@@ -37,7 +47,7 @@ namespace build
explicit
operator bool () const
{
- return prerequisite != nullptr || target != nullptr;
+ return target != nullptr || prerequisite != nullptr;
}
};
@@ -65,6 +75,8 @@ namespace build
static target_state
perform_update (action, target&);
+
+ static file_rule instance;
};
class alias_rule: public rule
@@ -75,6 +87,8 @@ namespace build
virtual recipe
apply (action, target&, const match_result&) const;
+
+ static alias_rule instance;
};
class fsdir_rule: public rule
@@ -91,6 +105,8 @@ namespace build
static target_state
perform_clean (action, target&);
+
+ static fsdir_rule instance;
};
}