# Python library imports
import sys
import os
+import subprocess
from os.path import join as joinpath
# Check for recent-enough Python and SCons versions. If your system's
# Find default configuration & binary.
Default(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
-# Ask SCons which directory it was invoked from.
-launch_dir = GetLaunchDir()
-
-# Make targets relative to invocation directory
-abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))),
- BUILD_TARGETS)
-
# helper function: find last occurrence of element in list
def rfind(l, elt, offs = -1):
for i in range(len(l)+offs, 0, -1):
# recognize that ALPHA_SE specifies the configuration because it
# follow 'build' in the bulid path.
+# Generate absolute paths to targets so we can see where the build dir is
+if COMMAND_LINE_TARGETS:
+ # Ask SCons which directory it was invoked from
+ launch_dir = GetLaunchDir()
+ # Make targets relative to invocation directory
+ abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))),
+ COMMAND_LINE_TARGETS)
+else:
+ # Default targets are relative to root of tree
+ abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))),
+ DEFAULT_TARGETS)
+
+
# Generate a list of the unique build roots and configs that the
# collected targets reference.
build_paths = []
# M5_PLY is used by isa_parser.py to find the PLY package.
env.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
+env['GCC'] = False
+env['SUNCC'] = False
+env['ICC'] = False
+env['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True).communicate()[0].find('GCC') >= 0
+env['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True).communicate()[0].find('Sun C++') >= 0
+env['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True).communicate()[0].find('Intel') >= 0
+if env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
+ print 'Error: How can we have two at the same time?'
+ Exit(1)
+
# Set up default C++ compiler flags
-env.Append(CCFLAGS='-pipe')
-env.Append(CCFLAGS='-fno-strict-aliasing')
-env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
+if env['GCC']:
+ env.Append(CCFLAGS='-pipe')
+ env.Append(CCFLAGS='-fno-strict-aliasing')
+ env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
+elif env['ICC']:
+ pass #Fix me... add warning flags once we clean up icc warnings
+elif env['SUNCC']:
+ env.Append(CCFLAGS='-Qoption ccfe')
+ env.Append(CCFLAGS='-features=gcc')
+ env.Append(CCFLAGS='-features=extensions')
+ env.Append(CCFLAGS='-library=stlport4')
+ env.Append(CCFLAGS='-xar')
+# env.Append(CCFLAGS='-instances=semiexplicit')
+else:
+ print 'Error: Don\'t know what compiler options to use for your compiler.'
+ print ' Please fix SConstruct and src/SConscript and try again.'
+ Exit(1)
+
if sys.platform == 'cygwin':
# cygwin has some header file issues...
env.Append(CCFLAGS=Split("-Wno-uninitialized"))
# Check for zlib. If the check passes, libz will be automatically
# added to the LIBS environment variable.
-if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++'):
+if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
print 'Error: did not find needed zlib compression library '\
'and/or zlib.h header file.'
print ' Please install zlib and try again.'
env = conf.Finish()
# Define the universe of supported ISAs
-env['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips']
+env['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips', 'x86']
# Define the universe of supported CPU models
env['ALL_CPU_LIST'] = ['AtomicSimpleCPU', 'TimingSimpleCPU',