aboutsummaryrefslogtreecommitdiff
path: root/build/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-15 11:59:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-15 11:59:58 +0200
commitad720fabd468974e3909f62a0f4e4e3cf0d03aef (patch)
tree8c6b7d851e42a42118b28488a9a3def8e86cd849 /build/target.cxx
parentace1743f7f78bb13f99553d6e97ad1beecf1ba99 (diff)
Initial library support
Diffstat (limited to 'build/target.cxx')
-rw-r--r--build/target.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/build/target.cxx b/build/target.cxx
index db02979..fbba1ed 100644
--- a/build/target.cxx
+++ b/build/target.cxx
@@ -51,6 +51,16 @@ namespace build
return scopes.find (dir).root_scope ();
}
+ value_proxy target::
+ operator[] (const variable& var)
+ {
+ auto i (variables.find (var));
+
+ return i != variables.end ()
+ ? value_proxy (&i->second, nullptr)
+ : base_scope ()[var];
+ }
+
ostream&
operator<< (ostream& os, const target& t)
{
@@ -232,6 +242,33 @@ namespace build
// path_target
//
+ path path_target::
+ derived_path (const char* de, const char* np)
+ {
+ string n;
+
+ if (np != nullptr)
+ n += np;
+
+ n += name;
+
+ if (ext != nullptr)
+ {
+ if (!ext->empty ())
+ {
+ n += '.';
+ n += *ext;
+ }
+ }
+ else if (de != nullptr)
+ {
+ n += '.';
+ n += de;
+ }
+
+ return dir / path_type (move (n));
+ }
+
timestamp path_target::
load_mtime () const
{