Some changes for misc regs which were changed into unofficial integer registers,...
[gem5.git] / SConstruct
index ce5ab4bb8559279a339e7c18a8e6b4672a0b936d..d8851f0916d4bb26b06a6c52e227921ad0d607af 100644 (file)
@@ -175,6 +175,14 @@ env = Environment(ENV = os.environ,  # inherit user's environment vars
                   ROOT = ROOT,
                   SRCDIR = SRCDIR)
 
+#Parse CC/CXX early so that we use the correct compiler for 
+# to test for dependencies/versions/libraries/includes
+if ARGUMENTS.get('CC', None):
+    env['CC'] = ARGUMENTS.get('CC')
+
+if ARGUMENTS.get('CXX', None):
+    env['CXX'] = ARGUMENTS.get('CXX')
+
 env.SConsignFile(os.path.join(build_root,"sconsign"))
 
 # Default duplicate option is to use hard links, but this messes up
@@ -271,8 +279,8 @@ if not conf.CheckLib(py_version_name):
     Exit(1)
 
 # On Solaris you need to use libsocket for socket ops
-if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C', 'accept(0,NULL,NULL);'):
-   if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C', 'accept(0,NULL,NULL);'):
+if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
+   if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'):
        print "Can't find library with socket calls (e.g. accept())"
        Exit(1)
 
@@ -320,8 +328,10 @@ env['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips']
 
 # Define the universe of supported CPU models
 env['ALL_CPU_LIST'] = ['AtomicSimpleCPU', 'TimingSimpleCPU',
-                       'FullCPU', 'O3CPU',
-                       'OzoneCPU']
+                       'O3CPU', 'OzoneCPU']
+
+if os.path.isdir(os.path.join(SRCDIR, 'src/encumbered/cpu/full')):
+    env['ALL_CPU_LIST'] += ['FullCPU']
 
 # Sticky options get saved in the options file so they persist from
 # one invocation to the next (unless overridden, in which case the new
@@ -368,7 +378,7 @@ nonsticky_opts.AddOptions(
 # These options get exported to #defines in config/*.hh (see src/SConscript).
 env.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
                      'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
-                     'USE_CHECKER', 'PYTHONHOME']
+                     'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA']
 
 # Define a handy 'no-op' action
 def no_action(target, source, env):
@@ -459,6 +469,46 @@ env.SConscript('ext/libelf/SConscript',
                build_dir = os.path.join(build_root, 'libelf'),
                exports = 'env')
 
+###################################################
+#
+# 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 +616,7 @@ for build_path in build_paths:
 
 Help(help_text)
 
+
 ###################################################
 #
 # Let SCons do its thing.  At this point SCons will use the defined