108,109c108,109
< # Generate a list of the unique configs that the collected targets
< # reference.
---
> # Generate a list of the unique build roots and configs that the
> # collected targets reference.
110a111
> build_roots = []
118,120c119,124
< config_dir = os.path.join('/',*path_dirs[:build_top+2])
< if config_dir not in build_paths:
< build_paths.append(config_dir)
---
> build_root = os.path.join('/',*path_dirs[:build_top+1])
> if build_root not in build_roots:
> build_roots.append(build_root)
> build_path = os.path.join('/',*path_dirs[:build_top+2])
> if build_path not in build_paths:
> build_paths.append(build_path)
249,253d252
< # libelf build is described in its own SConscript file.
< # SConscript-global is the build in build/libelf shared among all
< # configs.
< env.SConscript('src/libelf/SConscript-global', exports = 'env')
<
294a294,299
> # base help text
> help_text = '''
> Usage: scons [scons options] [build options] [target(s)]
>
> '''
>
304,305c309,318
< help_text = '''
< Usage: scons [scons options] [build options] [target(s)]
---
> # Spme things (just libelf currently) are shared across all configs in
> # a "build root". Need to define how to build these just once for
> # each referenced root.
> build_root_env = {}
> for build_root in build_roots:
> env = base_env.Copy()
> env.SConscript('ext/libelf/SConscript',
> build_dir = os.path.join(build_root, 'libelf'),
> exports = 'env')
> build_root_env[build_root] = env
307,308d319
< '''
<
314,315c325,326
< # Make a copy of the default environment to use for this config.
< env = base_env.Copy()
---
> # Make a copy of the build-root environment to use for this config.
> env = build_root_env[build_root].Copy()