diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2007-10-31 01:21:54 -0400 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2007-10-31 01:21:54 -0400 |
commit | 538fae951b3a594814dff6bb6d038c32caadb25c (patch) | |
tree | a74245aab941fe20309c108d2e837e68ea5e4582 /src/SConscript | |
parent | 8ce31ea471eebb06efa590fb060804aa1fb5266b (diff) | |
download | gem5-538fae951b3a594814dff6bb6d038c32caadb25c.tar.xz |
Traceflags: Add SCons function to created a traceflag instead of having one file with them all.
--HG--
extra : convert_revision : 427f6bd8f050861ace3bc0d354a1afa5fc8319e6
Diffstat (limited to 'src/SConscript')
-rw-r--r-- | src/SConscript | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/SConscript b/src/SConscript index a2df88c06..e66a725d3 100644 --- a/src/SConscript +++ b/src/SConscript @@ -135,6 +135,38 @@ Export('SwigSource') ######################################################################## # +# Trace Flags +# +all_flags = {} +trace_flags = [] +def TraceFlag(name, desc=''): + if name in all_flags: + raise AttributeError, "Flag %s already specified" % name + flag = (name, (), desc) + trace_flags.append(flag) + all_flags[name] = () + +def CompoundFlag(name, flags, desc=''): + if name in all_flags: + raise AttributeError, "Flag %s already specified" % name + + compound = tuple(flags) + for flag in compound: + if flag not in all_flags: + raise AttributeError, "Trace flag %s not found" % flag + if all_flags[flag]: + raise AttributeError, \ + "Compound flag can't point to another compound flag" + + flag = (name, compound, desc) + trace_flags.append(flag) + all_flags[name] = compound + +Export('TraceFlag') +Export('CompoundFlag') + +######################################################################## +# # Set some compiler variables # @@ -307,6 +339,15 @@ for source,package in swig_sources: env.Command('swig/init.cc', swig_modules, generate.makeSwigInit) Source('swig/init.cc') +# Generate traceflags.py +flags = [ Value(f) for f in trace_flags ] +env.Command('base/traceflags.py', flags, generate.traceFlagsPy) +PySource('m5', 'base/traceflags.py') + +env.Command('base/traceflags.hh', flags, generate.traceFlagsHH) +env.Command('base/traceflags.cc', flags, generate.traceFlagsCC) +Source('base/traceflags.cc') + # Build the zip file py_compiled = [] py_zip_depends = [] |