# Make sure build_root exists (might not if this is the first build there)
if not isdir(build_root):
mkdir(build_root)
+main['BUILDROOT'] = build_root
Export('main')
global_sticky_vars_file = joinpath(build_root, 'variables.global')
global_sticky_vars = Variables(global_sticky_vars_file, args=ARGUMENTS)
+global_nonsticky_vars = Variables(args=ARGUMENTS)
global_sticky_vars.AddVariables(
('CC', 'C compiler', environ.get('CC', main['CC'])),
PathListAllExist, PathListMakeAbsolute),
)
+global_nonsticky_vars.AddVariables(
+ ('VERBOSE', 'Print full tool command lines', False),
+ ('update_ref', 'Update test reference outputs', False)
+ )
+
+
# base help text
help_text = '''
Usage: scons [scons options] [build options] [target(s)]
# Update main environment with values from ARGUMENTS & global_sticky_vars_file
global_sticky_vars.Update(main)
+global_nonsticky_vars.Update(main)
help_text += global_sticky_vars.GenerateHelpText(main)
+help_text += global_nonsticky_vars.GenerateHelpText(main)
# Save sticky variable settings back to current variables file
global_sticky_vars.Save(global_sticky_vars_file, main)
# the ext directory should be on the #includes path
main.Append(CPPPATH=[Dir('ext')])
+def _STRIP(path, env):
+ path = str(path)
+ variant_base = env['BUILDROOT'] + os.path.sep
+ if path.startswith(variant_base):
+ path = path[len(variant_base):]
+ elif path.startswith('build/'):
+ path = path[6:]
+ return path
+
+def _STRIP_SOURCE(target, source, env, for_signature):
+ return _STRIP(source[0], env)
+main['STRIP_SOURCE'] = _STRIP_SOURCE
+
+def _STRIP_TARGET(target, source, env, for_signature):
+ return _STRIP(target[0], env)
+main['STRIP_TARGET'] = _STRIP_TARGET
+
+if main['VERBOSE']:
+ def MakeAction(action, string, *args, **kwargs):
+ return Action(action, *args, **kwargs)
+else:
+ MakeAction = Action
+ main['CCCOMSTR'] = ' [ CC] $STRIP_SOURCE'
+ main['CXXCOMSTR'] = ' [ CXX] $STRIP_SOURCE'
+ main['ASCOMSTR'] = ' [ AS] $STRIP_SOURCE'
+ main['SWIGCOMSTR'] = ' [ SWIG] $STRIP_SOURCE'
+ main['ARCOMSTR'] = ' [ AR] $STRIP_TARGET'
+ main['LINKCOMSTR'] = ' [ LINK] $STRIP_TARGET'
+ main['RANLIBCOMSTR'] = ' [ RANLIB] $STRIP_TARGET'
+ main['M4COMSTR'] = ' [ M4] $STRIP_TARGET'
+ main['SHCCCOMSTR'] = ' [ SHCC] $STRIP_TARGET'
+ main['SHCXXCOMSTR'] = ' [ SHCXX] $STRIP_TARGET'
+Export('MakeAction')
+
CXX_version = readCommand([main['CXX'],'--version'], exception=False)
CXX_V = readCommand([main['CXX'],'-V'], exception=False)
export_vars = []
Export('export_vars')
-# Non-sticky variables only apply to the current build.
-nonsticky_vars = Variables(args=ARGUMENTS)
-Export('nonsticky_vars')
-
# Walk the tree and execute all SConsopts scripts that wil add to the
# above variables
for bdir in [ base_dir ] + extras_dir_list:
BoolVariable('RUBY', 'Build with Ruby', False),
)
-nonsticky_vars.AddVariables(
- BoolVariable('update_ref', 'Update test reference outputs', False)
- )
-
# These variables get exported to #defines in config/*.hh (see src/SConscript).
export_vars += ['FULL_SYSTEM', 'USE_FENV', 'USE_MYSQL',
'NO_FAST_ALLOC', 'FAST_ALLOC_DEBUG', 'FAST_ALLOC_STATS',
print >>f, '#include "%s/%s/%s"' % (dname, isa, basename(fname))
f.close()
- # String to print when generating header
- def gen_switch_hdr_string(target, source, env):
- return "Generating switch header " + str(target[0])
-
# Build SCons Action object. 'varlist' specifies env vars that this
# action depends on; when env['ALL_ISA_LIST'] changes these actions
# should get re-executed.
- switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
- varlist=['ALL_ISA_LIST'])
+ switch_hdr_action = MakeAction(gen_switch_hdr,
+ " [GENERATE] $STRIP_TARGET", varlist=['ALL_ISA_LIST'])
# Instantiate actions for each header
for hdr in switch_headers:
# Apply current variable settings to env
sticky_vars.Update(env)
- nonsticky_vars.Update(env)
help_text += "\nSticky variables for %s:\n" % variant_dir \
- + sticky_vars.GenerateHelpText(env) \
- + "\nNon-sticky variables for %s:\n" % variant_dir \
- + nonsticky_vars.GenerateHelpText(env)
+ + sticky_vars.GenerateHelpText(env)
# Process variable settings.
code.write(str(target[0]))
-env.Command('config/the_isa.hh', map(Value, all_isa_list), makeTheISA)
+env.Command('config/the_isa.hh', map(Value, all_isa_list),
+ MakeAction(makeTheISA, " [ CFG ISA] $STRIP_TARGET"))
########################################################################
#
defines_info = [ Value(build_env), Value(env['HG_INFO']) ]
# Generate a file with all of the compile options in it
-env.Command('python/m5/defines.py', defines_info, makeDefinesPyFile)
+env.Command('python/m5/defines.py', defines_info,
+ MakeAction(makeDefinesPyFile, " [ DEFINES] $STRIP_TARGET"))
PySource('m5', 'python/m5/defines.py')
# Generate python file containing info about the M5 source code
# Generate a file that wraps the basic top level files
env.Command('python/m5/info.py',
[ '#/AUTHORS', '#/LICENSE', '#/README', '#/RELEASE_NOTES' ],
- makeInfoPyFile)
+ MakeAction(makeInfoPyFile, " [ INFO] $STRIP_TARGET"))
PySource('m5', 'python/m5/info.py')
########################################################################
hh_file = File('params/%s.hh' % name)
params_hh_files.append(hh_file)
- env.Command(hh_file, Value(name), createSimObjectParam)
+ env.Command(hh_file, Value(name),
+ MakeAction(createSimObjectParam, " [SO PARAM] $STRIP_TARGET"))
env.Depends(hh_file, depends + extra_deps)
# Generate any parameter header files needed
for name,param in all_params.iteritems():
i_file = File('python/m5/internal/%s_%s.i' % (param.file_ext, name))
params_i_files.append(i_file)
- env.Command(i_file, Value(name), createSwigParam)
+ env.Command(i_file, Value(name),
+ MakeAction(createSwigParam, " [SW PARAM] $STRIP_TARGET"))
env.Depends(i_file, depends)
SwigSource('m5.internal', i_file)
extra_deps = [ py_source.tnode ]
cc_file = File('enums/%s.cc' % name)
- env.Command(cc_file, Value(name), createEnumStrings)
+ env.Command(cc_file, Value(name),
+ MakeAction(createEnumStrings, " [ENUM STR] $STRIP_TARGET"))
env.Depends(cc_file, depends + extra_deps)
Source(cc_file)
hh_file = File('enums/%s.hh' % name)
- env.Command(hh_file, Value(name), createEnumParam)
+ env.Command(hh_file, Value(name),
+ MakeAction(createEnumParam, " [EN PARAM] $STRIP_TARGET"))
env.Depends(hh_file, depends + extra_deps)
i_file = File('python/m5/internal/enum_%s.i' % name)
- env.Command(i_file, Value(name), createEnumSwig)
+ env.Command(i_file, Value(name),
+ MakeAction(createEnumSwig, " [ENUMSWIG] $STRIP_TARGET"))
env.Depends(i_file, depends + extra_deps)
SwigSource('m5.internal', i_file)
for name in sim_objects.iterkeys():
params_file = File('python/m5/internal/param_%s.i' % name)
- env.Command(params_file, Value(name), buildParam)
+ env.Command(params_file, Value(name),
+ MakeAction(buildParam, " [BLDPARAM] $STRIP_TARGET"))
env.Depends(params_file, depends)
SwigSource('m5.internal', params_file)
# Build all swig modules
for swig in SwigSource.all:
env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode,
- '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
- '-o ${TARGETS[0]} $SOURCES')
+ MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
+ '-o ${TARGETS[0]} $SOURCES', " [ SWIG] $STRIP_TARGET"))
init_file = 'python/swig/init_%s.cc' % swig.module
- env.Command(init_file, Value(swig.module), makeEmbeddedSwigInit)
+ env.Command(init_file, Value(swig.module),
+ MakeAction(makeEmbeddedSwigInit, " [EMBED SW] $STRIP_TARGET"))
Source(init_file)
env.Depends(swig.py_source.tnode, swig.tnode)
env.Depends(swig.cc_source.tnode, swig.tnode)
code.write(str(target[0]))
flags = map(Value, trace_flags.values())
-env.Command('base/traceflags.py', flags, traceFlagsPy)
+env.Command('base/traceflags.py', flags,
+ MakeAction(traceFlagsPy, " [ TRACING] $STRIP_TARGET"))
PySource('m5', 'base/traceflags.py')
-env.Command('base/traceflags.hh', flags, traceFlagsHH)
-env.Command('base/traceflags.cc', flags, traceFlagsCC)
+env.Command('base/traceflags.hh', flags,
+ MakeAction(traceFlagsHH, " [ TRACING] $STRIP_TARGET"))
+env.Command('base/traceflags.cc', flags,
+ MakeAction(traceFlagsCC, " [ TRACING] $STRIP_TARGET"))
Source('base/traceflags.cc')
# Embed python files. All .py files that have been indicated by a
code.write(str(target[0]))
for source in PySource.all:
- env.Command(source.cpp, source.tnode, embedPyFile)
+ env.Command(source.cpp, source.tnode,
+ MakeAction(embedPyFile, " [EMBED PY] $STRIP_TARGET"))
Source(source.cpp)
########################################################################
cmd = 'cp $SOURCE $TARGET; strip $TARGET'
else:
cmd = 'strip $SOURCE -o $TARGET'
- targets = new_env.Command(exename, progname, cmd)
+ targets = new_env.Command(exename, progname,
+ MakeAction(cmd, " [ STRIP] $STRIP_TARGET"))
new_env.M5Binary = targets[0]
envList.append(new_env)