X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2FSConscript;h=d02d2a6e7cda502c3e81ae5a5a6fb7cdb623eed6;hb=0b29c2d057d2d6f4f8b9b7853da91bcb283e805c;hp=687709ac136bbcfe78306e31469ece4a3d631b96;hpb=9a8cb7db7e86c25a755f2e2817a0385b13e3ac32;p=gem5.git diff --git a/src/SConscript b/src/SConscript index 687709ac1..d02d2a6e7 100644 --- a/src/SConscript +++ b/src/SConscript @@ -132,15 +132,15 @@ class PySource(SourceFile): modpath = '.'.join(modpath) arcpath = path + [ self.basename ] - debugname = self.snode.abspath - if not exists(debugname): - debugname = self.tnode.abspath + abspath = self.snode.abspath + if not exists(abspath): + abspath = self.tnode.abspath self.package = package self.modname = modname self.modpath = modpath self.arcname = joinpath(*arcpath) - self.debugname = debugname + self.abspath = abspath self.compiled = File(self.filename + 'c') self.assembly = File(self.filename + '.s') self.symname = "PyEMB_" + PySource.invalid_sym_char.sub('_', modpath) @@ -228,9 +228,6 @@ 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())]) - # Workaround for bug in SCons version > 0.97d20071212 # Scons bug id: 2006 M5 Bug id: 308 for root, dirs, files in os.walk(base_dir, topdown=True): @@ -261,6 +258,31 @@ for extra_dir in extras_dir_list: for opt in export_vars: env.ConfigFile(opt) +def makeTheISA(source, target, env): + f = file(str(target[0]), 'w') + + isas = [ src.get_contents() for src in source ] + target = env['TARGET_ISA'] + def define(isa): + return isa.upper() + '_ISA' + + def namespace(isa): + return isa[0].upper() + isa[1:].lower() + 'ISA' + + + print >>f, '#ifndef __CONFIG_THE_ISA_HH__' + print >>f, '#define __CONFIG_THE_ISA_HH__' + print >>f + for i,isa in enumerate(isas): + print >>f, '#define %s %d' % (define(isa), i + 1) + print >>f + print >>f, '#define THE_ISA %s' % (define(target)) + print >>f, '#define TheISA %s' % (namespace(target)) + print >>f + print >>f, '#endif // __CONFIG_THE_ISA_HH__' + +env.Command('config/the_isa.hh', map(Value, all_isa_list), makeTheISA) + ######################################################################## # # Prevent any SimObjects from being added after this point, they @@ -317,9 +339,9 @@ class DictImporter(object): source = self.modules[fullname] if source.modname == '__init__': mod.__path__ = source.modpath - mod.__file__ = source.snode.abspath + mod.__file__ = source.abspath - exec file(source.snode.abspath, 'r') in mod.__dict__ + exec file(source.abspath, 'r') in mod.__dict__ return mod @@ -389,9 +411,12 @@ buildEnv = m5.util.SmartDict($build_env) hgRev = '$hg_info' compileDate = m5.internal.core.compileDate -for k,v in m5.internal.core.__dict__.iteritems(): - if k.startswith('flag_'): - setattr(buildEnv, k[5:], v) +_globals = globals() +for key,val in m5.internal.core.__dict__.iteritems(): + if key.startswith('flag_'): + flag = key[5:] + _globals[flag] = val +del _globals """) code.write(str(target[0])) @@ -489,12 +514,7 @@ for name,simobj in sorted(sim_objects.iteritems()): # Generate any parameter header files needed params_i_files = [] for name,param in all_params.iteritems(): - if isinstance(param, m5.params.VectorParamDesc): - ext = 'vptype' - else: - ext = 'ptype' - - i_file = File('params/%s_%s.i' % (name, ext)) + i_file = File('params/%s_%s.i' % (name, param.file_ext)) params_i_files.append(i_file) env.Command(i_file, Value(name), createSwigParam) env.Depends(i_file, depends) @@ -872,7 +892,7 @@ def objectifyPyFile(target, source, env): dst = file(str(target[0]), 'w') pysource = PySource.tnodes[source[0]] - compiled = compile(src, pysource.debugname, 'exec') + compiled = compile(src, pysource.abspath, 'exec') marshalled = marshal.dumps(compiled) compressed = zlib.compress(marshalled) data = compressed