From 538fae951b3a594814dff6bb6d038c32caadb25c Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Wed, 31 Oct 2007 01:21:54 -0400 Subject: Traceflags: Add SCons function to created a traceflag instead of having one file with them all. --HG-- extra : convert_revision : 427f6bd8f050861ace3bc0d354a1afa5fc8319e6 --- src/SConscript | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/SConscript') diff --git a/src/SConscript b/src/SConscript index a2df88c06..e66a725d3 100644 --- a/src/SConscript +++ b/src/SConscript @@ -133,6 +133,38 @@ Export('PySource') Export('SimObject') 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 = [] -- cgit v1.2.3