Deleted Added
sdiff udiff text old ( 7739:f97a5f4d0879 ) new ( 7756:846fb3ffe0dc )
full compact
1# -*- mode:python -*-
2
3# Copyright (c) 2009 The Hewlett-Packard Development Company
4# Copyright (c) 2004-2005 The Regents of The University of Michigan
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are

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

267 Exit(1)
268 variant_path = joinpath('/',*path_dirs[:build_top+2])
269 if variant_path not in variant_paths:
270 variant_paths.append(variant_path)
271
272# Make sure build_root exists (might not if this is the first build there)
273if not isdir(build_root):
274 mkdir(build_root)
275
276Export('main')
277
278main.SConsignFile(joinpath(build_root, "sconsign"))
279
280# Default duplicate option is to use hard links, but this messes up
281# when you use emacs to edit a file in the target dir, as emacs moves
282# file to file~ then copies to file, breaking the link. Symbolic

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

301 paths = val.split(':')
302 for path in paths:
303 if not isdir(path):
304 raise SCons.Errors.UserError("Path does not exist: '%s'" % path)
305
306global_sticky_vars_file = joinpath(build_root, 'variables.global')
307
308global_sticky_vars = Variables(global_sticky_vars_file, args=ARGUMENTS)
309
310global_sticky_vars.AddVariables(
311 ('CC', 'C compiler', environ.get('CC', main['CC'])),
312 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
313 ('BATCH', 'Use batch pool for build and tests', False),
314 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
315 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
316 ('EXTRAS', 'Add Extra directories to the compilation', '',
317 PathListAllExist, PathListMakeAbsolute),
318 )
319
320# base help text
321help_text = '''
322Usage: scons [scons options] [build options] [target(s)]
323
324Global sticky options:
325'''
326
327# Update main environment with values from ARGUMENTS & global_sticky_vars_file
328global_sticky_vars.Update(main)
329
330help_text += global_sticky_vars.GenerateHelpText(main)
331
332# Save sticky variable settings back to current variables file
333global_sticky_vars.Save(global_sticky_vars_file, main)
334
335# Parse EXTRAS variable to build list of all directories where we're
336# look for sources etc. This list is exported as base_dir_list.
337base_dir = main.srcdir.abspath
338if main['EXTRAS']:
339 extras_dir_list = main['EXTRAS'].split(':')
340else:
341 extras_dir_list = []
342
343Export('base_dir')
344Export('extras_dir_list')
345
346# the ext directory should be on the #includes path
347main.Append(CPPPATH=[Dir('ext')])
348
349CXX_version = readCommand([main['CXX'],'--version'], exception=False)
350CXX_V = readCommand([main['CXX'],'-V'], exception=False)
351
352main['GCC'] = CXX_version and CXX_version.find('g++') >= 0
353main['SUNCC'] = CXX_V and CXX_V.find('Sun C++') >= 0
354main['ICC'] = CXX_V and CXX_V.find('Intel') >= 0
355if main['GCC'] + main['SUNCC'] + main['ICC'] > 1:
356 print 'Error: How can we have two at the same time?'

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

661# value becomes sticky).
662sticky_vars = Variables(args=ARGUMENTS)
663Export('sticky_vars')
664
665# Sticky variables that should be exported
666export_vars = []
667Export('export_vars')
668
669# Non-sticky variables only apply to the current build.
670nonsticky_vars = Variables(args=ARGUMENTS)
671Export('nonsticky_vars')
672
673# Walk the tree and execute all SConsopts scripts that wil add to the
674# above variables
675for bdir in [ base_dir ] + extras_dir_list:
676 for root, dirs, files in os.walk(bdir):
677 if 'SConsopts' in files:
678 print "Reading", joinpath(root, 'SConsopts')
679 SConscript(joinpath(root, 'SConsopts'))
680

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

701 False),
702 BoolVariable('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
703 BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
704 BoolVariable('USE_CHECKER', 'Use checker for detailed CPU models', False),
705 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False),
706 BoolVariable('RUBY', 'Build with Ruby', False),
707 )
708
709nonsticky_vars.AddVariables(
710 BoolVariable('update_ref', 'Update test reference outputs', False)
711 )
712
713# These variables get exported to #defines in config/*.hh (see src/SConscript).
714export_vars += ['FULL_SYSTEM', 'USE_FENV', 'USE_MYSQL',
715 'NO_FAST_ALLOC', 'FAST_ALLOC_DEBUG', 'FAST_ALLOC_STATS',
716 'SS_COMPATIBLE_FP', 'USE_CHECKER', 'TARGET_ISA', 'CP_ANNOTATE']
717
718###################################################
719#
720# Define a SCons builder for configuration flag headers.

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

782 # list of ISAs from env['ALL_ISA_LIST'].
783 def gen_switch_hdr(target, source, env):
784 fname = str(target[0])
785 f = open(fname, 'w')
786 isa = env['TARGET_ISA'].lower()
787 print >>f, '#include "%s/%s/%s"' % (dname, isa, basename(fname))
788 f.close()
789
790 # String to print when generating header
791 def gen_switch_hdr_string(target, source, env):
792 return "Generating switch header " + str(target[0])
793
794 # Build SCons Action object. 'varlist' specifies env vars that this
795 # action depends on; when env['ALL_ISA_LIST'] changes these actions
796 # should get re-executed.
797 switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
798 varlist=['ALL_ISA_LIST'])
799
800 # Instantiate actions for each header
801 for hdr in switch_headers:
802 env.Command(hdr, [], switch_hdr_action)
803Export('make_switching_dir')
804
805###################################################
806#

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

847 % (current_vars_file, default_vars_file)
848 else:
849 print "Error: cannot find variables file %s or %s" \
850 % (current_vars_file, default_vars_file)
851 Exit(1)
852
853 # Apply current variable settings to env
854 sticky_vars.Update(env)
855 nonsticky_vars.Update(env)
856
857 help_text += "\nSticky variables for %s:\n" % variant_dir \
858 + sticky_vars.GenerateHelpText(env) \
859 + "\nNon-sticky variables for %s:\n" % variant_dir \
860 + nonsticky_vars.GenerateHelpText(env)
861
862 # Process variable settings.
863
864 if not have_fenv and env['USE_FENV']:
865 print "Warning: <fenv.h> not available; " \
866 "forcing USE_FENV to False in", variant_dir + "."
867 env['USE_FENV'] = False
868

--- 36 unchanged lines hidden ---