aboutsummaryrefslogtreecommitdiff
path: root/build/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-07 09:18:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-07 09:18:22 +0200
commit49d5628e35593a5300d39596286c768d7aa435b6 (patch)
tree43f20983a381c54aac7536e78e4f9543d8761aac /build/context.cxx
parent16c19b739a58845af7f807c3dee8021a1c421006 (diff)
Rework module architecture
Now the target type and rule maps are in scopes (builtins -- in global scope). We also now have the map of loaded modules in the root scope of each project.
Diffstat (limited to 'build/context.cxx')
-rw-r--r--build/context.cxx38
1 files changed, 37 insertions, 1 deletions
diff --git a/build/context.cxx b/build/context.cxx
index 22b6f53..d62be61 100644
--- a/build/context.cxx
+++ b/build/context.cxx
@@ -9,6 +9,8 @@
#include <system_error>
#include <build/scope>
+#include <build/target>
+#include <build/rule>
#include <build/diagnostics>
using namespace std;
@@ -22,7 +24,12 @@ namespace build
const meta_operation_info* current_mif;
const operation_info* current_oif;
execution_mode current_mode;
- const target_rule_map* current_rules;
+
+ // Builtin rules.
+ //
+ static dir_rule dir_;
+ static fsdir_rule fsdir_;
+ static file_rule file_;
void
reset ()
@@ -43,6 +50,35 @@ namespace build
global_scope->assign ("work") = work;
global_scope->assign ("home") = home;
+
+ // Register builtin target types.
+ //
+ {
+ target_type_map& tts (global_scope->target_types);
+
+ tts.insert<file> ();
+ tts.insert<dir> ();
+ tts.insert<fsdir> ();
+ }
+
+ // Register builtin rules.
+ //
+ {
+ rule_map& rs (global_scope->rules);
+
+ rs.insert<dir> (default_id, "dir", dir_);
+ rs.insert<dir> (update_id, "dir", dir_);
+ rs.insert<dir> (clean_id, "dir", dir_);
+
+ rs.insert<fsdir> (default_id, "fsdir", fsdir_);
+ rs.insert<fsdir> (update_id, "fsdir", fsdir_);
+ rs.insert<fsdir> (clean_id, "fsdir", fsdir_);
+
+ rs.insert<file> (default_id, "file", file_);
+ rs.insert<file> (update_id, "file", file_);
+ rs.insert<file> (clean_id, "file", file_);
+ }
+
}
fs_status<mkdir_status>