SConstruct (4775:6e09e9894365) SConstruct (4781:59a75bd0ddf4)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 72 unchanged lines hidden (view full) ---

81# 3-element version number.
82min_scons_version = (0,96,91)
83try:
84 EnsureSConsVersion(*min_scons_version)
85except:
86 print "Error checking current SCons version."
87 print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
88 Exit(2)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 72 unchanged lines hidden (view full) ---

81# 3-element version number.
82min_scons_version = (0,96,91)
83try:
84 EnsureSConsVersion(*min_scons_version)
85except:
86 print "Error checking current SCons version."
87 print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
88 Exit(2)
89
90
89
90
91# The absolute path to the current directory (where this file lives).
92ROOT = Dir('.').abspath
93
94# Path to the M5 source tree.
95SRCDIR = joinpath(ROOT, 'src')
96
97# tell python where to find m5 python code
98sys.path.append(joinpath(ROOT, 'src/python'))

--- 107 unchanged lines hidden (view full) ---

206# and modified according to each selected configuration.
207#
208###################################################
209
210env = Environment(ENV = os.environ, # inherit user's environment vars
211 ROOT = ROOT,
212 SRCDIR = SRCDIR)
213
91# The absolute path to the current directory (where this file lives).
92ROOT = Dir('.').abspath
93
94# Path to the M5 source tree.
95SRCDIR = joinpath(ROOT, 'src')
96
97# tell python where to find m5 python code
98sys.path.append(joinpath(ROOT, 'src/python'))

--- 107 unchanged lines hidden (view full) ---

206# and modified according to each selected configuration.
207#
208###################################################
209
210env = Environment(ENV = os.environ, # inherit user's environment vars
211 ROOT = ROOT,
212 SRCDIR = SRCDIR)
213
214#Parse CC/CXX early so that we use the correct compiler for
214#Parse CC/CXX early so that we use the correct compiler for
215# to test for dependencies/versions/libraries/includes
216if ARGUMENTS.get('CC', None):
217 env['CC'] = ARGUMENTS.get('CC')
218
219if ARGUMENTS.get('CXX', None):
220 env['CXX'] = ARGUMENTS.get('CXX')
221
222Export('env')

--- 12 unchanged lines hidden (view full) ---

235if False:
236 env.TargetSignatures('content')
237
238# M5_PLY is used by isa_parser.py to find the PLY package.
239env.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
240env['GCC'] = False
241env['SUNCC'] = False
242env['ICC'] = False
215# to test for dependencies/versions/libraries/includes
216if ARGUMENTS.get('CC', None):
217 env['CC'] = ARGUMENTS.get('CC')
218
219if ARGUMENTS.get('CXX', None):
220 env['CXX'] = ARGUMENTS.get('CXX')
221
222Export('env')

--- 12 unchanged lines hidden (view full) ---

235if False:
236 env.TargetSignatures('content')
237
238# M5_PLY is used by isa_parser.py to find the PLY package.
239env.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
240env['GCC'] = False
241env['SUNCC'] = False
242env['ICC'] = False
243env['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True,
244 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
243env['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True,
244 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
245 close_fds=True).communicate()[0].find('GCC') >= 0
245 close_fds=True).communicate()[0].find('GCC') >= 0
246env['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
247 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
246env['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
247 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
248 close_fds=True).communicate()[0].find('Sun C++') >= 0
248 close_fds=True).communicate()[0].find('Sun C++') >= 0
249env['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
250 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
249env['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
250 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
251 close_fds=True).communicate()[0].find('Intel') >= 0
252if env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
253 print 'Error: How can we have two at the same time?'
254 Exit(1)
255
256
257# Set up default C++ compiler flags
258if env['GCC']:

--- 45 unchanged lines hidden (view full) ---

304
305# filter out all existing swig scanners, they mess up the dependency
306# stuff for some reason
307scanners = []
308for scanner in env['SCANNERS']:
309 skeys = scanner.skeys
310 if skeys == '.i':
311 continue
251 close_fds=True).communicate()[0].find('Intel') >= 0
252if env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
253 print 'Error: How can we have two at the same time?'
254 Exit(1)
255
256
257# Set up default C++ compiler flags
258if env['GCC']:

--- 45 unchanged lines hidden (view full) ---

304
305# filter out all existing swig scanners, they mess up the dependency
306# stuff for some reason
307scanners = []
308for scanner in env['SCANNERS']:
309 skeys = scanner.skeys
310 if skeys == '.i':
311 continue
312
312
313 if isinstance(skeys, (list, tuple)) and '.i' in skeys:
314 continue
315
316 scanners.append(scanner)
317
318# add the new swig scanner that we like better
319from SCons.Scanner import ClassicCPP as CPPScanner
320swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'

--- 202 unchanged lines hidden (view full) ---

523 # True target is config header file
524 target = joinpath('config', option.lower() + '.hh')
525 val = env[option]
526 if isinstance(val, bool):
527 # Force value to 0/1
528 val = int(val)
529 elif isinstance(val, str):
530 val = '"' + val + '"'
313 if isinstance(skeys, (list, tuple)) and '.i' in skeys:
314 continue
315
316 scanners.append(scanner)
317
318# add the new swig scanner that we like better
319from SCons.Scanner import ClassicCPP as CPPScanner
320swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'

--- 202 unchanged lines hidden (view full) ---

523 # True target is config header file
524 target = joinpath('config', option.lower() + '.hh')
525 val = env[option]
526 if isinstance(val, bool):
527 # Force value to 0/1
528 val = int(val)
529 elif isinstance(val, str):
530 val = '"' + val + '"'
531
531
532 # Sources are option name & value (packaged in SCons Value nodes)
533 return ([target], [Value(option), Value(val)])
534
535config_builder = Builder(emitter = config_emitter, action = config_action)
536
537env.Append(BUILDERS = { 'ConfigFile' : config_builder })
538
539###################################################

--- 40 unchanged lines hidden (view full) ---

580###################################################
581
582env['ALL_ISA_LIST'] = all_isa_list
583def make_switching_dir(dirname, switch_headers, env):
584 # Generate the header. target[0] is the full path of the output
585 # header to generate. 'source' is a dummy variable, since we get the
586 # list of ISAs from env['ALL_ISA_LIST'].
587 def gen_switch_hdr(target, source, env):
532 # Sources are option name & value (packaged in SCons Value nodes)
533 return ([target], [Value(option), Value(val)])
534
535config_builder = Builder(emitter = config_emitter, action = config_action)
536
537env.Append(BUILDERS = { 'ConfigFile' : config_builder })
538
539###################################################

--- 40 unchanged lines hidden (view full) ---

580###################################################
581
582env['ALL_ISA_LIST'] = all_isa_list
583def make_switching_dir(dirname, switch_headers, env):
584 # Generate the header. target[0] is the full path of the output
585 # header to generate. 'source' is a dummy variable, since we get the
586 # list of ISAs from env['ALL_ISA_LIST'].
587 def gen_switch_hdr(target, source, env):
588 fname = str(target[0])
589 basename = os.path.basename(fname)
590 f = open(fname, 'w')
591 f.write('#include "arch/isa_specific.hh"\n')
592 cond = '#if'
593 for isa in all_isa_list:
594 f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
595 % (cond, isa.upper(), dirname, isa, basename))
596 cond = '#elif'
597 f.write('#else\n#error "THE_ISA not set"\n#endif\n')
598 f.close()
599 return 0
588 fname = str(target[0])
589 basename = os.path.basename(fname)
590 f = open(fname, 'w')
591 f.write('#include "arch/isa_specific.hh"\n')
592 cond = '#if'
593 for isa in all_isa_list:
594 f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
595 % (cond, isa.upper(), dirname, isa, basename))
596 cond = '#elif'
597 f.write('#else\n#error "THE_ISA not set"\n#endif\n')
598 f.close()
599 return 0
600
601 # String to print when generating header
602 def gen_switch_hdr_string(target, source, env):
600
601 # String to print when generating header
602 def gen_switch_hdr_string(target, source, env):
603 return "Generating switch header " + str(target[0])
603 return "Generating switch header " + str(target[0])
604
605 # Build SCons Action object. 'varlist' specifies env vars that this
606 # action depends on; when env['ALL_ISA_LIST'] changes these actions
607 # should get re-executed.
608 switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
609 varlist=['ALL_ISA_LIST'])
610
611 # Instantiate actions for each header

--- 121 unchanged lines hidden ---
604
605 # Build SCons Action object. 'varlist' specifies env vars that this
606 # action depends on; when env['ALL_ISA_LIST'] changes these actions
607 # should get re-executed.
608 switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
609 varlist=['ALL_ISA_LIST'])
610
611 # Instantiate actions for each header

--- 121 unchanged lines hidden ---