print "Error checking current SCons version."
print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
Exit(2)
-
+
# The absolute path to the current directory (where this file lives).
ROOT = Dir('.').abspath
ROOT = ROOT,
SRCDIR = SRCDIR)
-#Parse CC/CXX early so that we use the correct compiler for
+#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')
env['GCC'] = False
env['SUNCC'] = False
env['ICC'] = False
-env['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+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,
+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,
+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?'
skeys = scanner.skeys
if skeys == '.i':
continue
-
+
if isinstance(skeys, (list, tuple)) and '.i' in skeys:
continue
val = int(val)
elif isinstance(val, str):
val = '"' + val + '"'
-
+
# Sources are option name & value (packaged in SCons Value nodes)
return ([target], [Value(option), Value(val)])
# 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 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
+ 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 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])
+ 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
'-o', cmd_stdout, '-e', cmd_stderr, base_cmd]
else:
cmd = [base_cmd, '>', cmd_stdout, '2>', cmd_stderr]
-
+
env.Command([tgt('stdout'), tgt('stderr'), new_stats],
[env.M5Binary, 'run.py'], ' '.join(cmd))
'tsunami-simple-timing',
'tsunami-simple-atomic-dual',
'tsunami-simple-timing-dual',
- 'twosys-tsunami-simple-atomic']
+ 'twosys-tsunami-simple-atomic']
if env['TARGET_ISA'] == 'sparc':
configs += ['t1000-simple-atomic',
't1000-simple-timing']
's' : "asm",
'S' : "asm",
'isa' : "isa" }
-whitespace_types = ('C', 'C++', 'swig', 'python', 'asm', 'isa')
-format_types = ( 'C', 'C++' )
-
def file_type(filename):
extension = filename.split('.')
extension = len(extension) > 1 and extension[-1]
return lang_types.get(extension, None)
+whitespace_types = ('C', 'C++', 'swig', 'python', 'asm', 'isa')
+def whitespace_file(filename):
+ if file_type(filename) in whitespace_types:
+ return True
+
+ if filename.startswith("SCons"):
+ return True
+
+ return False
+
+format_types = ( 'C', 'C++' )
+def format_file(filename):
+ if file_type(filename) in format_types:
+ return True
+
+ return False
+
def checkwhite_line(line):
match = lead.search(line)
if match and match.group(1).find('\t') != -1:
return True
def checkwhite(filename):
- if file_type(filename) not in whitespace_types:
+ if not whitespace_file(filename)
return
try:
return line.rstrip() + '\n'
def fixwhite(filename, tabsize, fixonly=None):
- if file_type(filename) not in whitespace_types:
+ if not whitespace_file(filename)
return
try:
self.trailwhite or self.badcontrol or self.cret
def validate(filename, stats, verbose, exit_code):
- if file_type(filename) not in format_types:
+ if not format_file(filename):
return
def msg(lineno, line, message):