diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-09 09:45:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-09 09:45:25 +0200 |
commit | fa6f9986dd73627643469c238b32dd92607f5214 (patch) | |
tree | de7ee1f4253ab815767b45c9ec0b03d802d01704 /build/parser.cxx | |
parent | 2e98d3ec3aa57c7b1776d3bf5e7e219a9a3cb3af (diff) |
Add support for skipping already loaded/included buildfiles at top level
The idea is that a buildfile shall be included/loaded only once for any
given out_root.
Diffstat (limited to 'build/parser.cxx')
-rw-r--r-- | build/parser.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/build/parser.cxx b/build/parser.cxx index 2c629d6..343f5e1 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -37,18 +37,19 @@ namespace build typedef token_type type; void parser:: - parse_buildfile (istream& is, const path& p, scope& s) + parse_buildfile (istream& is, const path& p, scope& base, scope& root) { string rw (diag_relative_work (p)); path_ = &rw; lexer l (is, rw); lexer_ = &l; - scope_ = &s; + scope_ = &base; + root_ = &root; default_target_ = nullptr; - out_root_ = &s["out_root"].as<const path&> (); - src_root_ = &s["src_root"].as<const path&> (); + out_root_ = &root["out_root"].as<const path&> (); + src_root_ = &root["src_root"].as<const path&> (); token t (type::eos, false, 0, 0); type tt; @@ -477,7 +478,7 @@ namespace build p.normalize (); } - if (!include_.insert (p).second) + if (!root_->buildfiles.insert (p).second) { level4 ([&]{trace (l) << "skipping already included " << p;}); continue; @@ -955,7 +956,7 @@ namespace build lexer l (is, name); lexer_ = &l; - scope_ = root_scope; + scope_ = root_ = root_scope; // Turn on pairs recognition (e.g., src_root/=out_root/exe{foo bar}). // |