151a152,159
> @staticmethod
> def done():
> def disabled(cls, name, *ignored):
> raise RuntimeError("Additional SourceFile '%s'" % name,\
> "declared, but targets deps are already fixed.")
> SourceFile.__init__ = disabled
>
>
880,881d887
< envList = []
<
883a890,897
> # 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)+'/'
>
888c902
< def makeEnv(label, objsfx, strip = False, **kwargs):
---
> def makeEnv(env, label, objsfx, strip = False, **kwargs):
891,893c905,907
< libname = 'gem5_' + label
< exename = 'gem5.' + label
< secondary_exename = 'm5.' + label
---
> libname = variant('gem5_' + label)
> exename = variant('gem5.' + label)
> secondary_exename = variant('m5.' + label)
981,982c995,996
< testname = "unittest/%s.%s" % (test.target, label)
< new_env.Program(testname, test_objs + static_objs)
---
> path = variant('unittest/%s.%s' % (test.target, label))
> new_env.Program(path, test_objs + static_objs)
1002c1016
< envList.append(new_env)
---
> return new_env
1068,1073c1082,1085
< # Debug binary
< if 'debug' in needed_envs:
< makeEnv('debug', '.do',
< CCFLAGS = Split(ccflags['debug']),
< CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
< LINKFLAGS = Split(ldflags['debug']))
---
> gem5_root = Dir('.').up().up().abspath
> def makeEnvirons(target, source, env):
> # cause any later Source() calls to be fatal, as a diagnostic.
> Source.done()
1075,1080c1087
< # Optimized binary
< if 'opt' in needed_envs:
< makeEnv('opt', '.o',
< CCFLAGS = Split(ccflags['opt']),
< CPPDEFINES = ['TRACING_ON=1'],
< LINKFLAGS = Split(ldflags['opt']))
---
> envList = []
1082,1087c1089,1095
< # "Fast" binary
< if 'fast' in needed_envs:
< makeEnv('fast', '.fo', strip = True,
< CCFLAGS = Split(ccflags['fast']),
< CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
< LINKFLAGS = Split(ldflags['fast']))
---
> # Debug binary
> if 'debug' in needed_envs:
> envList.append(
> makeEnv(env, 'debug', '.do',
> CCFLAGS = Split(ccflags['debug']),
> CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
> LINKFLAGS = Split(ldflags['debug'])))
1089,1094c1097,1103
< # Profiled binary using gprof
< if 'prof' in needed_envs:
< makeEnv('prof', '.po',
< CCFLAGS = Split(ccflags['prof']),
< CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
< LINKFLAGS = Split(ldflags['prof']))
---
> # Optimized binary
> if 'opt' in needed_envs:
> envList.append(
> makeEnv(env, 'opt', '.o',
> CCFLAGS = Split(ccflags['opt']),
> CPPDEFINES = ['TRACING_ON=1'],
> LINKFLAGS = Split(ldflags['opt'])))
1096,1101c1105,1111
< # Profiled binary using google-pprof
< if 'perf' in needed_envs:
< makeEnv('perf', '.gpo',
< CCFLAGS = Split(ccflags['perf']),
< CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
< LINKFLAGS = Split(ldflags['perf']))
---
> # "Fast" binary
> if 'fast' in needed_envs:
> envList.append(
> makeEnv(env, 'fast', '.fo', strip = True,
> CCFLAGS = Split(ccflags['fast']),
> CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
> LINKFLAGS = Split(ldflags['fast'])))
1103c1113,1155
< Return('envList')
---
> # Profiled binary using gprof
> if 'prof' in needed_envs:
> envList.append(
> 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:
> envList.append(
> makeEnv(env, 'perf', '.gpo',
> CCFLAGS = Split(ccflags['perf']),
> CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
> LINKFLAGS = Split(ldflags['perf'])))
>
> # Set up the regression tests for each build.
> for e in envList:
> SConscript(os.path.join(gem5_root, 'tests', 'SConscript'),
> variant_dir = variantd('tests', e.Label),
> exports = { 'env' : e }, duplicate = False)
>
> # 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 = env['PHONY_BASE'] + '-deps'
> environs = env['PHONY_BASE'] + '-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')