scons: fix building in non-standard locations

It's apparently not widely known that our scons scripts allow you to
put the build directory wherever you want; not only does it not have
to be immediately under the root of your repo, it doesn't even have
to be underneath the root at all.  (For example, sometimes it's useful
to build on a local disk if your repo is on a slow NFS mount.)

I point this out because this functionality has been broken for close
to two years but no one seems to have noticed yet.  This patch fixes
an assumption that crept in in changeset be0e1724eb39 (May 09 2014)
that the build dir would be immediately under the top level of the
repo, preventing builds anywhere else.
This commit is contained in:
Steve Reinhardt 2016-03-13 17:47:33 -07:00
parent 807e2705b4
commit b8c1e370fa

View file

@ -1251,7 +1251,6 @@ needed_envs = [identifyTarget(target) for target in BUILD_TARGETS]
if 'all' in needed_envs:
needed_envs += target_types
gem5_root = Dir('.').up().up().abspath
def makeEnvirons(target, source, env):
# cause any later Source() calls to be fatal, as a diagnostic.
Source.done()
@ -1300,7 +1299,7 @@ def makeEnvirons(target, source, env):
# Set up the regression tests for each build.
for e in envList:
SConscript(os.path.join(gem5_root, 'tests', 'SConscript'),
SConscript(os.path.join(env.root.abspath, 'tests', 'SConscript'),
variant_dir = variantd('tests', e.Label),
exports = { 'env' : e }, duplicate = False)