summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-11-07 05:33:21 -0500
committerGabe Black <gblack@eecs.umich.edu>2006-11-07 05:33:21 -0500
commiteb4ef3ad763cf95a6437f9a88b1ab38255f5dcc3 (patch)
tree420388e84c50ee4ce6ce87af521b598057a54c80 /SConstruct
parent58f7ed2416fd0bb0823225d5feaff5fc5cf1f9c1 (diff)
downloadgem5-eb4ef3ad763cf95a6437f9a88b1ab38255f5dcc3.tar.xz
Made kern a switching header file directory.
SConstruct: Put the code to make a switching header directory into a function so they are easy to make. src/arch/SConscript: Replace switching header code with the new function call. src/kern/SConscript: Created a new switching header directory in kern, and moved the declaration of some source files here. --HG-- rename : src/kern/kernel_stats.cc => src/kern/base_kernel_stats.cc rename : src/kern/kernel_stats.hh => src/kern/base_kernel_stats.hh extra : convert_revision : 98f5320a5ade567c3e4f67fef123dfb0c5122545
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct41
1 files changed, 41 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 59d40d5cc..d047f99d3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -461,6 +461,46 @@ env.SConscript('ext/libelf/SConscript',
###################################################
#
+# This function is used to set up a directory with switching headers
+#
+###################################################
+
+def make_switching_dir(dirname, switch_headers, env):
+ # Generate the header. target[0] is the full path of the output
+ # header to generate. 'source' is a dummy variable, since we get the
+ # list of ISAs from env['ALL_ISA_LIST'].
+ def gen_switch_hdr(target, source, env):
+ fname = str(target[0])
+ basename = os.path.basename(fname)
+ f = open(fname, 'w')
+ f.write('#include "arch/isa_specific.hh"\n')
+ cond = '#if'
+ for isa in env['ALL_ISA_LIST']:
+ f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
+ % (cond, isa.upper(), dirname, isa, basename))
+ cond = '#elif'
+ f.write('#else\n#error "THE_ISA not set"\n#endif\n')
+ f.close()
+ return 0
+
+ # String to print when generating header
+ def gen_switch_hdr_string(target, source, env):
+ return "Generating switch header " + str(target[0])
+
+ # Build SCons Action object. 'varlist' specifies env vars that this
+ # action depends on; when env['ALL_ISA_LIST'] changes these actions
+ # should get re-executed.
+ switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
+ varlist=['ALL_ISA_LIST'])
+
+ # Instantiate actions for each header
+ for hdr in switch_headers:
+ env.Command(hdr, [], switch_hdr_action)
+
+env.make_switching_dir = make_switching_dir
+
+###################################################
+#
# Define build environments for selected configurations.
#
###################################################
@@ -566,6 +606,7 @@ for build_path in build_paths:
Help(help_text)
+
###################################################
#
# Let SCons do its thing. At this point SCons will use the defined