From 49d5628e35593a5300d39596286c768d7aa435b6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 7 Jul 2015 09:18:22 +0200 Subject: 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. --- build/config/module | 5 +++-- build/config/module.cxx | 19 +++++++++++++------ build/config/operation.cxx | 3 ++- build/config/utility | 6 +++--- 4 files changed, 21 insertions(+), 12 deletions(-) (limited to 'build/config') diff --git a/build/config/module b/build/config/module index 4ab3e7e..58d9814 100644 --- a/build/config/module +++ b/build/config/module @@ -12,8 +12,9 @@ namespace build { namespace config { - void - init (scope&, scope&, const location&); + extern "C" void + config_init ( + scope&, scope&, const location&, std::unique_ptr&, bool); } } diff --git a/build/config/module.cxx b/build/config/module.cxx index 7ac9071..237547c 100644 --- a/build/config/module.cxx +++ b/build/config/module.cxx @@ -23,16 +23,23 @@ namespace build // static const path config_file ("build/config.build"); - void - init (scope& root, scope& base, const location& l) + extern "C" void + config_init (scope& root, + scope& base, + const location& l, + std::unique_ptr&, + bool first) { - //@@ TODO: avoid multiple inits (generally, for modules). - // - tracer trace ("config::init"); if (&root != &base) - fail (l) << "config module must be initialized in project root scope"; + fail (l) << "config module must be initialized in bootstrap.build"; + + if (!first) + { + warn (l) << "multiple config module initializations"; + return; + } const dir_path& out_root (root.path ()); level4 ([&]{trace << "for " << out_root;}); diff --git a/build/config/operation.cxx b/build/config/operation.cxx index ecd805f..78ad9e8 100644 --- a/build/config/operation.cxx +++ b/build/config/operation.cxx @@ -8,8 +8,9 @@ #include -#include #include +#include +#include #include #include diff --git a/build/config/utility b/build/config/utility index 8ab6afe..e1d81a7 100644 --- a/build/config/utility +++ b/build/config/utility @@ -31,9 +31,9 @@ namespace build required (scope& root, const char* name, const char* default_value); // Set, if necessary, an optional config.* variable. In particular, - // an unspecified variable is set to NULL which is used to to - // distinguish between the "configured as unspecified" and "not - // yet configured" cases. + // an unspecified variable is set to NULL which is used to distinguish + // between the "configured as unspecified" and "not yet configured" + // cases. // // Return the pointer to the value, which can be NULL. // -- cgit v1.1