summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2008-11-10 11:51:18 -0800
committerNathan Binkert <nate@binkert.org>2008-11-10 11:51:18 -0800
commit4d64d7664c9c9c99a2172785829058a0e751e39f (patch)
tree4a2f60d46c718cde8cf698852f40725e7d029afb /src
parenteb5d9ba72b0309e7f98c382e3a80ce0601dbe084 (diff)
downloadgem5-4d64d7664c9c9c99a2172785829058a0e751e39f.tar.xz
SCons: Allow top level directory of EXTRAS able to contain SConscripts.
The current EXTRAS will fail if the top level directory pointed to by EXTRAS has a SConscript file in it. We allow this by including the directory name of the EXTRA in the build directory which prevents a clash between src/SConscript and extra/SConscript. Maintain compatibility with older uses of EXTRAS by adding a -I for each top level extra directory.
Diffstat (limited to 'src')
-rw-r--r--src/SConscript25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/SConscript b/src/SConscript
index 2ea35b778..2da5830a9 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -36,7 +36,7 @@ import re
import sys
import zlib
-from os.path import basename, exists, isdir, isfile, join as joinpath
+from os.path import basename, dirname, exists, isdir, isfile, join as joinpath
import SCons
@@ -214,6 +214,9 @@ Export('CompoundFlag')
# files.
env.Append(CPPPATH=Dir('.'))
+for extra_dir in extras_dir_list:
+ env.Append(CPPPATH=Dir(extra_dir))
+
# Add a flag defining what THE_ISA should be for all compilation
env.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
@@ -222,15 +225,21 @@ env.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
# Walk the tree and execute all SConscripts in subdirectories
#
-for base_dir in base_dir_list:
- here = Dir('.').srcnode().abspath
- for root, dirs, files in os.walk(base_dir, topdown=True):
- if root == here:
- # we don't want to recurse back into this SConscript
- continue
+here = Dir('.').srcnode().abspath
+for root, dirs, files in os.walk(base_dir, topdown=True):
+ if root == here:
+ # we don't want to recurse back into this SConscript
+ continue
+
+ if 'SConscript' in files:
+ build_dir = joinpath(env['BUILDDIR'], root[len(base_dir) + 1:])
+ SConscript(joinpath(root, 'SConscript'), build_dir=build_dir)
+for extra_dir in extras_dir_list:
+ prefix_len = len(dirname(extra_dir)) + 1
+ for root, dirs, files in os.walk(extra_dir, topdown=True):
if 'SConscript' in files:
- build_dir = joinpath(env['BUILDDIR'], root[len(base_dir) + 1:])
+ build_dir = joinpath(env['BUILDDIR'], root[prefix_len:])
SConscript(joinpath(root, 'SConscript'), build_dir=build_dir)
for opt in env.ExportOptions: