aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-22 14:38:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-23 18:14:07 +0200
commit5035f4ef68922ac758b1e4734e67d73c9228010b (patch)
tree271fdd5b1d6e995a058d97aacb3ac90a538d9ff1 /libbuild2/target.txx
parent8793941652d6aa1c3d02b2f87f691e6d06254b7d (diff)
Introduce notion of build context
All non-const global state is now in class context and we can now have multiple independent builds going on at the same time.
Diffstat (limited to 'libbuild2/target.txx')
-rw-r--r--libbuild2/target.txx25
1 files changed, 12 insertions, 13 deletions
diff --git a/libbuild2/target.txx b/libbuild2/target.txx
index b93a403..17c38c8 100644
--- a/libbuild2/target.txx
+++ b/libbuild2/target.txx
@@ -90,12 +90,11 @@ namespace build2
target_extension_var_impl (const target_type& tt,
const string& tn,
const scope& s,
- const char* var,
const char* def)
{
// Include target type/pattern-specific variables.
//
- if (auto l = s.find (var_pool[var], tt, tn))
+ if (auto l = s.find (*s.ctx.var_extension, tt, tn))
{
// Help the user here and strip leading '.' from the extension.
//
@@ -106,17 +105,17 @@ namespace build2
return def != nullptr ? optional<string> (def) : nullopt;
}
- template <const char* var, const char* def>
+ template <const char* def>
optional<string>
target_extension_var (const target_key& tk,
const scope& s,
const char*,
bool)
{
- return target_extension_var_impl (*tk.type, *tk.name, s, var, def);
+ return target_extension_var_impl (*tk.type, *tk.name, s, def);
}
- template <const char* var, const char* def>
+ template <const char* def>
bool
target_pattern_var (const target_type& tt,
const scope& s,
@@ -144,7 +143,7 @@ namespace build2
// Use empty name as a target since we only want target type/pattern-
// specific variables that match any target ('*' but not '*.txt').
//
- if ((e = target_extension_var_impl (tt, string (), s, var, def)))
+ if ((e = target_extension_var_impl (tt, string (), s, def)))
return true;
}
}
@@ -172,13 +171,13 @@ namespace build2
// We behave as if this target was explicitly mentioned in the (implied)
// buildfile. Thus not implied.
//
- target& t (targets.insert (dir::static_type,
- bs.out_path (),
- dir_path (),
- string (),
- nullopt,
- false,
- trace).first);
+ target& t (bs.ctx.targets.insert (dir::static_type,
+ bs.out_path (),
+ dir_path (),
+ string (),
+ nullopt,
+ false,
+ trace).first);
t.prerequisites (move (ps));
return &t;
}