Deleted Added
sdiff udiff text old ( 8100:cf1afc88070f ) new ( 8120:e4257cde2d79 )
full compact
1# -*- mode:python -*-
2
3# Copyright (c) 2011 Advanced Micro Devices, Inc.
4# Copyright (c) 2009 The Hewlett-Packard Development Company
5# Copyright (c) 2004-2005 The Regents of The University of Michigan
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without

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

116 Dir('src/python').srcnode().abspath, # M5 includes
117 Dir('ext/ply').srcnode().abspath, # ply is used by several files
118 ]
119
120sys.path[1:1] = extra_python_paths
121
122from m5.util import compareVersions, readCommand
123
124AddOption('--colors', dest='use_colors', action='store_true')
125AddOption('--no-colors', dest='use_colors', action='store_false')
126use_colors = GetOption('use_colors')
127
128if use_colors:
129 from m5.util.terminal import termcap
130elif use_colors is None:
131 # option unspecified; default behavior is to use colors iff isatty
132 from m5.util.terminal import tty_termcap as termcap
133else:
134 from m5.util.terminal import no_termcap as termcap
135

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

201 try:
202 hg_info = readCommand(cmd, cwd=main.root.abspath).strip()
203 except OSError:
204 print mercurial_bin_not_found
205
206 # 2) Ensure that the style hook is in place.
207 try:
208 ui = None
209 if ARGUMENTS.get('IGNORE_STYLE') != 'True':
210 from mercurial import ui
211 ui = ui.ui()
212 except ImportError:
213 print mercurial_lib_not_found
214
215 if ui is not None:
216 ui.readconfig(hgdir.File('hgrc').abspath)
217 style_hook = ui.config('hooks', 'pretxncommit.style', None)

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

313def PathListAllExist(key, val, env):
314 if not val:
315 return
316 paths = val.split(':')
317 for path in paths:
318 if not isdir(path):
319 raise SCons.Errors.UserError("Path does not exist: '%s'" % path)
320
321global_sticky_vars_file = joinpath(build_root, 'variables.global')
322
323global_sticky_vars = Variables(global_sticky_vars_file, args=ARGUMENTS)
324global_nonsticky_vars = Variables(args=ARGUMENTS)
325
326global_sticky_vars.AddVariables(
327 ('CC', 'C compiler', environ.get('CC', main['CC'])),
328 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
329 ('BATCH', 'Use batch pool for build and tests', False),
330 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
331 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
332 ('EXTRAS', 'Add Extra directories to the compilation', '',
333 PathListAllExist, PathListMakeAbsolute),
334 )
335
336global_nonsticky_vars.AddVariables(
337 ('VERBOSE', 'Print full tool command lines', False),
338 ('update_ref', 'Update test reference outputs', False)
339 )
340
341# Update main environment with values from ARGUMENTS & global_sticky_vars_file
342global_sticky_vars.Update(main)
343global_nonsticky_vars.Update(main)
344global_help_texts = {
345 "global_sticky" : global_sticky_vars.GenerateHelpText(main),
346 "global_nonsticky" : global_nonsticky_vars.GenerateHelpText(main)
347}
348
349# base help text
350help_text = '''
351Usage: scons [scons options] [build options] [target(s)]
352
353Global sticky options:
354%(global_sticky)s
355Global nonsticky options:
356%(global_nonsticky)s
357''' % global_help_texts
358
359# Save sticky variable settings back to current variables file
360global_sticky_vars.Save(global_sticky_vars_file, main)
361
362# Parse EXTRAS variable to build list of all directories where we're
363# look for sources etc. This list is exported as base_dir_list.
364base_dir = main.srcdir.abspath
365if main['EXTRAS']:
366 extras_dir_list = main['EXTRAS'].split(':')
367else:
368 extras_dir_list = []

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

450 def fmt(files):
451 f = map(lambda s: s[com_pfx_len:], files)
452 return ', '.join(f)
453 return self.format % (com_pfx, fmt(srcs), fmt(tgts))
454
455Export('Transform')
456
457
458if main['VERBOSE']:
459 def MakeAction(action, string, *args, **kwargs):
460 return Action(action, *args, **kwargs)
461else:
462 MakeAction = Action
463 main['CCCOMSTR'] = Transform("CC")
464 main['CXXCOMSTR'] = Transform("CXX")
465 main['ASCOMSTR'] = Transform("AS")
466 main['SWIGCOMSTR'] = Transform("SWIG")

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

960 # Make sure the directory is there so we can create it later
961 opt_dir = dirname(current_vars_file)
962 if not isdir(opt_dir):
963 mkdir(opt_dir)
964
965 # Get default build variables from source tree. Variables are
966 # normally determined by name of $VARIANT_DIR, but can be
967 # overriden by 'default=' arg on command line.
968 default_vars_file = joinpath('build_opts',
969 ARGUMENTS.get('default', variant_dir))
970 if isfile(default_vars_file):
971 sticky_vars.files.append(default_vars_file)
972 print "Variables file %s not found,\n using defaults in %s" \
973 % (current_vars_file, default_vars_file)
974 else:
975 print "Error: cannot find variables file %s or %s" \
976 % (current_vars_file, default_vars_file)
977 Exit(1)
978
979 # Apply current variable settings to env
980 sticky_vars.Update(env)
981
982 help_text += "\nSticky variables for %s:\n" % variant_dir \
983 + sticky_vars.GenerateHelpText(env)
984
985 # Process variable settings.
986
987 if not have_fenv and env['USE_FENV']:
988 print "Warning: <fenv.h> not available; " \
989 "forcing USE_FENV to False in", variant_dir + "."
990 env['USE_FENV'] = False

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

1019 exports = 'env')
1020
1021 # Set up the regression tests for each build.
1022 for e in envList:
1023 SConscript('tests/SConscript',
1024 variant_dir = joinpath(variant_path, 'tests', e.Label),
1025 exports = { 'env' : e }, duplicate = False)
1026
1027Help(help_text)