aboutsummaryrefslogtreecommitdiff
path: root/build/b.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-09 09:45:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-09 09:45:25 +0200
commitfa6f9986dd73627643469c238b32dd92607f5214 (patch)
treede7ee1f4253ab815767b45c9ec0b03d802d01704 /build/b.cxx
parent2e98d3ec3aa57c7b1776d3bf5e7e219a9a3cb3af (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/b.cxx')
-rw-r--r--build/b.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/build/b.cxx b/build/b.cxx
index 0a1d8d2..ce10b22 100644
--- a/build/b.cxx
+++ b/build/b.cxx
@@ -269,7 +269,7 @@ main (int argc, char* argv[])
if (verb >= 4)
{
- trace << tn;
+ trace << tn << ':';
trace << " out_base: " << out_base.string ();
trace << " src_base: " << src_base.string ();
trace << " out_root: " << out_root.string ();
@@ -293,6 +293,16 @@ main (int argc, char* argv[])
//
path bf (src_base / path ("buildfile"));
+ // Check if this buildfile has already been loaded.
+ //
+ if (!proot_scope.buildfiles.insert (bf).second)
+ {
+ level4 ([&]{trace << "skipping already loaded " << bf;});
+ continue;
+ }
+
+ level4 ([&]{trace << "loading " << bf;});
+
ifstream ifs (bf.string ());
if (!ifs.is_open ())
fail << "unable to open " << bf;
@@ -302,7 +312,7 @@ main (int argc, char* argv[])
try
{
- p.parse_buildfile (ifs, bf, pbase_scope);
+ p.parse_buildfile (ifs, bf, pbase_scope, proot_scope);
}
catch (const std::ios_base::failure&)
{