aboutsummaryrefslogtreecommitdiff
path: root/build/bin
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-24 09:51:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-24 14:52:43 +0200
commit68f96f9213e849d0d7c4cedf3edeaec99743ee27 (patch)
tree271913d74c906971cac555319f5e14d0c66e0c16 /build/bin
parent0d5234f4aefd3cc5b5948cc1b9dd009e50046f5e (diff)
New variable architecture
Diffstat (limited to 'build/bin')
-rw-r--r--build/bin/module.cxx37
-rw-r--r--build/bin/rule.cxx4
2 files changed, 28 insertions, 13 deletions
diff --git a/build/bin/module.cxx b/build/bin/module.cxx
index e03c658..4c5cca5 100644
--- a/build/bin/module.cxx
+++ b/build/bin/module.cxx
@@ -25,16 +25,16 @@ namespace build
// Default config.bin.*.lib values.
//
- static const list_value exe_lib (names {name ("shared"), name ("static")});
- static const list_value liba_lib ("static");
- static const list_value libso_lib ("shared");
+ static const strings exe_lib {"shared", "static"};
+ static const strings liba_lib {"static"};
+ static const strings libso_lib {"shared"};
extern "C" void
bin_init (scope& r,
scope& b,
const location&,
std::unique_ptr<module>&,
- bool)
+ bool first)
{
tracer trace ("bin::init");
level4 ([&]{trace << "for " << b.path ();});
@@ -75,6 +75,21 @@ namespace build
rs.insert<lib> (install_id, "bin.lib", lib_);
}
+ // Enter module variables.
+ //
+ if (first)
+ {
+ variable_pool.find ("config.bin.lib", string_type);
+ variable_pool.find ("config.bin.exe.lib", strings_type);
+ variable_pool.find ("config.bin.liba.lib", strings_type);
+ variable_pool.find ("config.bin.libso.lib", strings_type);
+
+ variable_pool.find ("bin.lib", string_type);
+ variable_pool.find ("bin.exe.lib", strings_type);
+ variable_pool.find ("bin.liba.lib", strings_type);
+ variable_pool.find ("bin.libso.lib", strings_type);
+ }
+
// Configure.
//
using config::required;
@@ -92,7 +107,7 @@ namespace build
// config.bin.lib
//
{
- auto v (b.assign ("bin.lib"));
+ value& v (b.assign ("bin.lib"));
if (!v)
v = required (r, "config.bin.lib", "both").first;
}
@@ -100,7 +115,7 @@ namespace build
// config.bin.exe.lib
//
{
- auto v (b.assign ("bin.exe.lib"));
+ value& v (b.assign ("bin.exe.lib"));
if (!v)
v = required (r, "config.bin.exe.lib", exe_lib).first;
}
@@ -108,7 +123,7 @@ namespace build
// config.bin.liba.lib
//
{
- auto v (b.assign ("bin.liba.lib"));
+ value& v (b.assign ("bin.liba.lib"));
if (!v)
v = required (r, "config.bin.liba.lib", liba_lib).first;
}
@@ -116,14 +131,14 @@ namespace build
// config.bin.libso.lib
//
{
- auto v (b.assign ("bin.libso.lib"));
+ value& v (b.assign ("bin.libso.lib"));
if (!v)
v = required (r, "config.bin.libso.lib", libso_lib).first;
}
// Configure "installability" of our target types.
//
- install::path<exe> (b, "bin"); // Install into install.bin.
+ install::path<exe> (b, dir_path ("bin")); // Install into install.bin.
// Should shared libraries have executable bit? That depends on
// who you ask. In Debian, for example, it should not unless, it
@@ -143,9 +158,9 @@ namespace build
//
// Everyone is happy then?
//
- install::path<libso> (b, "lib"); // Install into install.lib.
+ install::path<libso> (b, dir_path ("lib")); // Install into install.lib.
- install::path<liba> (b, "lib"); // Install into install.lib.
+ install::path<liba> (b, dir_path ("lib")); // Install into install.lib.
install::mode<liba> (b, "644");
}
}
diff --git a/build/bin/rule.cxx b/build/bin/rule.cxx
index a09bffd..21db183 100644
--- a/build/bin/rule.cxx
+++ b/build/bin/rule.cxx
@@ -46,7 +46,7 @@ namespace build
// Get the library type to build. If not set for a target, this
// should be configured at the project scope by init_lib().
//
- const string& type (t["bin.lib"].as<const string&> ());
+ const string& type (as<string> (*t["bin.lib"]));
bool ar (type == "static" || type == "both");
bool so (type == "shared" || type == "both");
@@ -121,7 +121,7 @@ namespace build
// prerequisite vs prerequisite_target.
//
//
- const string& type (t["bin.lib"].as<const string&> ());
+ const string& type (as<string> (*t["bin.lib"]));
bool ar (type == "static" || type == "both");
bool so (type == "shared" || type == "both");