diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-07 09:18:22 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-07 09:18:22 +0200 |
commit | 49d5628e35593a5300d39596286c768d7aa435b6 (patch) | |
tree | 43f20983a381c54aac7536e78e4f9543d8761aac /build/config | |
parent | 16c19b739a58845af7f807c3dee8021a1c421006 (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/config')
-rw-r--r-- | build/config/module | 5 | ||||
-rw-r--r-- | build/config/module.cxx | 19 | ||||
-rw-r--r-- | build/config/operation.cxx | 3 | ||||
-rw-r--r-- | build/config/utility | 6 |
4 files changed, 21 insertions, 12 deletions
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<module>&, 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<module>&, + 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 <butl/filesystem> -#include <build/scope> #include <build/file> +#include <build/scope> +#include <build/target> #include <build/context> #include <build/diagnostics> 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. // |