aboutsummaryrefslogtreecommitdiff
path: root/build/config/module.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/config/module.cxx')
-rw-r--r--build/config/module.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/build/config/module.cxx b/build/config/module.cxx
new file mode 100644
index 0000000..bbaccdc
--- /dev/null
+++ b/build/config/module.cxx
@@ -0,0 +1,43 @@
+// file : build/config/module.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#include <build/config/module>
+
+#include <build/path>
+#include <build/scope>
+#include <build/diagnostics>
+
+using namespace std;
+
+namespace build
+{
+ namespace config
+ {
+ static bool
+ trigger (scope&, const path& p)
+ {
+ tracer trace ("config::trigger");
+
+ level4 ([&]{trace << "intercepted sourcing of " << p;});
+ return false;
+ }
+
+ void
+ load (scope& root, scope& base, const location& l)
+ {
+ tracer trace ("config::load");
+
+ if (&root != &base)
+ fail (l) << "config module must be loaded in project root scope";
+
+ //@@ TODO: avoid multiple loads (generally, for modules).
+ //
+ level4 ([&]{trace << "for " << root.path () << '/';});
+
+ // Register the build/config.build loading trigger.
+ //
+ root.triggers[path ("build/config.build")] = &trigger;
+ }
+ }
+}