From 5974cab56148a18628bfb423189e016ade2d40f9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 31 Aug 2015 13:45:57 +0200 Subject: 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. --- build/context.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'build/context.cxx') 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 // 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 -- cgit v1.1