Traceflags: Add SCons function to created a traceflag instead of having one file with them all.

--HG--
extra : convert_revision : 427f6bd8f050861ace3bc0d354a1afa5fc8319e6
This commit is contained in:
Ali Saidi
2007-10-31 01:21:54 -04:00
parent 8ce31ea471
commit 538fae951b
23 changed files with 395 additions and 44 deletions

View File

@@ -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 = []