summaryrefslogtreecommitdiff
path: root/src/SConscript
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2017-10-14 21:39:21 -0700
committerGabe Black <gabeblack@google.com>2017-10-17 18:57:50 +0000
commitb8efd0e854ae568dae33fe3d24f67054ed016d19 (patch)
treebf9eccdc6f2e89bbff30ba3b1470a6c932e09ccd /src/SConscript
parent1b63b756cc6ca75acceee51397f815df06fb0dff (diff)
downloadgem5-b8efd0e854ae568dae33fe3d24f67054ed016d19.tar.xz
scons: Stop generating inc.d in the isa parser.
Generating dependency/build product information in the isa parser breaks scons idea of how a build is supposed to work. Arm twisting it into working forced a lot of false dependencies which slowed down the build. Change-Id: Iadee8c930fd7c80136d200d69870df7672a6b3ca Reviewed-on: https://gem5-review.googlesource.com/5081 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/SConscript')
-rwxr-xr-xsrc/SConscript120
1 files changed, 43 insertions, 77 deletions
diff --git a/src/SConscript b/src/SConscript
index 519a0a986..911e5a37c 100755
--- a/src/SConscript
+++ b/src/SConscript
@@ -945,14 +945,6 @@ for source in PySource.all:
# List of constructed environments to pass back to SConstruct
date_source = Source('base/date.cc', skip_lib=True)
-# Capture this directory for the closure makeEnv, otherwise when it is
-# called, it won't know what directory it should use.
-variant_dir = Dir('.').path
-def variant(*path):
- return os.path.join(variant_dir, *path)
-def variantd(*path):
- return variant(*path)+'/'
-
# Function to create a new build environment as clone of current
# environment 'env' with modified object suffix and optional stripped
# binary. Additional keyword arguments are appended to corresponding
@@ -960,9 +952,9 @@ def variantd(*path):
def makeEnv(env, label, objsfx, strip=False, disable_partial=False, **kwargs):
# SCons doesn't know to append a library suffix when there is a '.' in the
# name. Use '_' instead.
- libname = variant('gem5_' + label)
- exename = variant('gem5.' + label)
- secondary_exename = variant('m5.' + label)
+ libname = 'gem5_' + label
+ exename = 'gem5.' + label
+ secondary_exename = 'm5.' + label
new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
new_env.Label = label
@@ -1101,7 +1093,7 @@ def makeEnv(env, label, objsfx, strip=False, disable_partial=False, **kwargs):
test_objs = [ make_obj(s, static=True) for s in test_sources ]
if test.main:
test_objs += main_objs
- path = variant('unittest/%s.%s' % (test.target, label))
+ path = 'unittest/%s.%s' % (test.target, label)
new_env.Program(path, test_objs + static_objs)
progname = exename
@@ -1125,7 +1117,7 @@ def makeEnv(env, label, objsfx, strip=False, disable_partial=False, **kwargs):
# Set up regression tests.
SConscript(os.path.join(env.root.abspath, 'tests', 'SConscript'),
- variant_dir=variantd('tests', new_env.Label),
+ variant_dir=Dir('tests').Dir(new_env.Label).path,
exports={ 'env' : new_env }, duplicate=False)
# Start out with the compiler flags common to all compilers,
@@ -1192,67 +1184,41 @@ needed_envs = [identifyTarget(target) for target in BUILD_TARGETS]
if 'all' in needed_envs:
needed_envs += target_types
-def makeEnvirons(target, source, env):
- # cause any later Source() calls to be fatal, as a diagnostic.
- Source.done()
-
- # Debug binary
- if 'debug' in needed_envs:
- makeEnv(env, 'debug', '.do',
- CCFLAGS = Split(ccflags['debug']),
- CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
- LINKFLAGS = Split(ldflags['debug']))
-
- # Optimized binary
- if 'opt' in needed_envs:
- makeEnv(env, 'opt', '.o',
- CCFLAGS = Split(ccflags['opt']),
- CPPDEFINES = ['TRACING_ON=1'],
- LINKFLAGS = Split(ldflags['opt']))
-
- # "Fast" binary
- if 'fast' in needed_envs:
- disable_partial = \
- env.get('BROKEN_INCREMENTAL_LTO', False) and \
- GetOption('force_lto')
- makeEnv(env, 'fast', '.fo', strip = True,
- CCFLAGS = Split(ccflags['fast']),
- CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
- LINKFLAGS = Split(ldflags['fast']),
- disable_partial=disable_partial)
-
- # Profiled binary using gprof
- if 'prof' in needed_envs:
- makeEnv(env, 'prof', '.po',
- CCFLAGS = Split(ccflags['prof']),
- CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
- LINKFLAGS = Split(ldflags['prof']))
-
- # Profiled binary using google-pprof
- if 'perf' in needed_envs:
- makeEnv(env, 'perf', '.gpo',
- CCFLAGS = Split(ccflags['perf']),
- CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
- LINKFLAGS = Split(ldflags['perf']))
-
-# The MakeEnvirons Builder defers the full dependency collection until
-# after processing the ISA definition (due to dynamically generated
-# source files). Add this dependency to all targets so they will wait
-# until the environments are completely set up. Otherwise, a second
-# process (e.g. -j2 or higher) will try to compile the requested target,
-# not know how, and fail.
-env.Append(BUILDERS = {'MakeEnvirons' :
- Builder(action=MakeAction(makeEnvirons,
- Transform("ENVIRONS", 1)))})
-
-isa_target = '#${VARIANT_NAME}-deps'
-environs = '#${VARIANT_NAME}-environs'
-env.Depends('#all-deps', isa_target)
-env.Depends('#all-environs', environs)
-env.ScanISA(isa_target, File('arch/%s/generated/inc.d' % env['TARGET_ISA']))
-envSetup = env.MakeEnvirons(environs, isa_target)
-
-# make sure no -deps targets occur before all ISAs are complete
-env.Depends(isa_target, '#all-isas')
-# likewise for -environs targets and all the -deps targets
-env.Depends(environs, '#all-deps')
+# Debug binary
+if 'debug' in needed_envs:
+ makeEnv(env, 'debug', '.do',
+ CCFLAGS = Split(ccflags['debug']),
+ CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
+ LINKFLAGS = Split(ldflags['debug']))
+
+# Optimized binary
+if 'opt' in needed_envs:
+ makeEnv(env, 'opt', '.o',
+ CCFLAGS = Split(ccflags['opt']),
+ CPPDEFINES = ['TRACING_ON=1'],
+ LINKFLAGS = Split(ldflags['opt']))
+
+# "Fast" binary
+if 'fast' in needed_envs:
+ disable_partial = \
+ env.get('BROKEN_INCREMENTAL_LTO', False) and \
+ GetOption('force_lto')
+ makeEnv(env, 'fast', '.fo', strip = True,
+ CCFLAGS = Split(ccflags['fast']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['fast']),
+ disable_partial=disable_partial)
+
+# Profiled binary using gprof
+if 'prof' in needed_envs:
+ makeEnv(env, 'prof', '.po',
+ CCFLAGS = Split(ccflags['prof']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['prof']))
+
+# Profiled binary using google-pprof
+if 'perf' in needed_envs:
+ makeEnv(env, 'perf', '.gpo',
+ CCFLAGS = Split(ccflags['perf']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['perf']))