aboutsummaryrefslogtreecommitdiff
path: root/build/config
diff options
context:
space:
mode:
Diffstat (limited to 'build/config')
-rw-r--r--build/config/module5
-rw-r--r--build/config/module.cxx19
-rw-r--r--build/config/operation.cxx3
-rw-r--r--build/config/utility6
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.
//