summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct13
-rw-r--r--src/SConscript25
2 files changed, 25 insertions, 13 deletions
diff --git a/SConstruct b/SConstruct
index ce34fa541..d33ed9079 100644
--- a/SConstruct
+++ b/SConstruct
@@ -324,11 +324,14 @@ global_sticky_opts.Save(global_sticky_opts_file, env)
# Parse EXTRAS option to build list of all directories where we're
# look for sources etc. This list is exported as base_dir_list.
-base_dir_list = [joinpath(ROOT, 'src')]
+base_dir = joinpath(ROOT, 'src')
if env['EXTRAS']:
- base_dir_list += env['EXTRAS'].split(':')
+ extras_dir_list = env['EXTRAS'].split(':')
+else:
+ extras_dir_list = []
-Export('base_dir_list')
+Export('base_dir')
+Export('extras_dir_list')
# M5_PLY is used by isa_parser.py to find the PLY package.
env.Append(ENV = { 'M5_PLY' : str(Dir('ext/ply')) })
@@ -594,8 +597,8 @@ Export('nonsticky_opts')
# Walk the tree and execute all SConsopts scripts that wil add to the
# above options
-for base_dir in base_dir_list:
- for root, dirs, files in os.walk(base_dir):
+for bdir in [ base_dir ] + extras_dir_list:
+ for root, dirs, files in os.walk(bdir):
if 'SConsopts' in files:
print "Reading", joinpath(root, 'SConsopts')
SConscript(joinpath(root, 'SConsopts'))
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: