aboutsummaryrefslogtreecommitdiff
path: root/build/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-31 13:45:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-31 13:45:57 +0200
commit5974cab56148a18628bfb423189e016ade2d40f9 (patch)
tree472a7966d0e1c5725f0736c73812cbdeaab827dc /build/context.cxx
parent2a9d673f298b623db061ee85d397563d644c8268 (diff)
Rework scoping logic
Now the src directory is entered into the scope map and points to the same scope as out. This means that targets that are in src, not out (e.g., source files) will "see" rules, variables, etc. This becomes important when we try, for example, to install a source file (say, a header) from src: we need the rule as well as the install.* variables.
Diffstat (limited to 'build/context.cxx')
-rw-r--r--build/context.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/build/context.cxx b/build/context.cxx
index aaeb426..fa1ea8f 100644
--- a/build/context.cxx
+++ b/build/context.cxx
@@ -77,7 +77,8 @@ namespace build
// On POSIX, however, this is a real path. See the comment in
// <build/path-map> for details.
//
- global_scope = &scopes[dir_path ("/")];
+ global_scope = scopes.insert (
+ dir_path ("/"), nullptr, true, false)->second;
global_scope->assign ("work") = work;
global_scope->assign ("home") = home;
@@ -188,14 +189,14 @@ namespace build
src_out (const dir_path& out, scope& s)
{
scope& rs (*s.root_scope ());
- return src_out (out, rs.path (), rs.src_path ());
+ return src_out (out, rs.out_path (), rs.src_path ());
}
dir_path
out_src (const dir_path& src, scope& s)
{
scope& rs (*s.root_scope ());
- return out_src (src, rs.path (), rs.src_path ());
+ return out_src (src, rs.out_path (), rs.src_path ());
}
dir_path