From: Nathan Binkert Date: Tue, 27 Mar 2007 04:07:32 +0000 (-0700) Subject: Instead of creating a new python process to run traceflags.py, X-Git-Tag: m5_2.0_beta3~69 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d8ca2d3b16d998eaf68bae0235740278aa27c5d5;p=gem5.git Instead of creating a new python process to run traceflags.py, just directly exec the file and generate the flags --HG-- extra : convert_revision : d648ca7348404ded5337db327adafccbd2ae40c8 --- diff --git a/src/base/SConscript b/src/base/SConscript index 788aa3e6f..6fc140145 100644 --- a/src/base/SConscript +++ b/src/base/SConscript @@ -30,10 +30,26 @@ Import('*') -# base/traceflags.{cc,hh} are generated from base/traceflags.py. -# $TARGET.base will expand to "/base/traceflags". -env.Command(['traceflags.hh', 'traceflags.cc'], 'traceflags.py', - 'python $SOURCE $TARGET.base') +def make_cc(target, source, env): + assert(len(source) == 1) + assert(len(target) == 1) + + traceflags = {} + execfile(str(source[0]), traceflags) + func = traceflags['gen_cc'] + func(str(target[0])) + +def make_hh(target, source, env): + assert(len(source) == 1) + assert(len(target) == 1) + + traceflags = {} + execfile(str(source[0]), traceflags) + func = traceflags['gen_hh'] + func(str(target[0])) + +env.Command('traceflags.hh', 'traceflags.py', make_hh) +env.Command('traceflags.cc', 'traceflags.py', make_cc) Source('annotate.cc') Source('bigint.cc') diff --git a/src/base/traceflags.py b/src/base/traceflags.py index e57bfa350..6b241c410 100644 --- a/src/base/traceflags.py +++ b/src/base/traceflags.py @@ -350,16 +350,3 @@ const char *Trace::flagStrings[] = print >>ccfile, '};' ccfile.close() - -if __name__ == '__main__': - # This file generates the header and source files for the flags - # that control the tracing facility. - - import sys - - if len(sys.argv) != 2: - print "%s: Need argument (basename of cc/hh files)" % sys.argv[0] - sys.exit(1) - - gen_hh(sys.argv[1] + '.hh') - gen_cc(sys.argv[1] + '.cc')