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
124help_texts = {
125 "options" : "",
126 "global_vars" : "",
127 "local_vars" : ""
128}
129
130Export("help_texts")
131
132def AddM5Option(*args, **kwargs):
133 col_width = 30
134
135 help = " " + ", ".join(args)
136 if "help" in kwargs:
137 length = len(help)
138 if length >= col_width:
139 help += "\n" + " " * col_width
140 else:
141 help += " " * (col_width - length)
142 help += kwargs["help"]
143 help_texts["options"] += help + "\n"
144
145 AddOption(*args, **kwargs)
146
147AddM5Option('--colors', dest='use_colors', action='store_true',
148 help="Add color to abbreviated scons output")
149AddM5Option('--no-colors', dest='use_colors', action='store_false',
150 help="Don't add color to abbreviated scons output")
151AddM5Option('--default', dest='default', type='string', action='store',
152 help='Override which build_opts file to use for defaults')
153AddM5Option('--ignore-style', dest='ignore_style', action='store_true',
154 help='Disable style checking hooks')
155AddM5Option('--update-ref', dest='update_ref', action='store_true',
156 help='Update test reference outputs')
157AddM5Option('--verbose', dest='verbose', action='store_true',
158 help='Print full tool command lines')
159
160use_colors = GetOption('use_colors')
161if use_colors:
162 from m5.util.terminal import termcap
163elif use_colors is None:
164 # option unspecified; default behavior is to use colors iff isatty
165 from m5.util.terminal import tty_termcap as termcap
166else:
167 from m5.util.terminal import no_termcap as termcap
168

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

234 try:
235 hg_info = readCommand(cmd, cwd=main.root.abspath).strip()
236 except OSError:
237 print mercurial_bin_not_found
238
239 # 2) Ensure that the style hook is in place.
240 try:
241 ui = None
242 if GetOption('ignore_style'):
243 from mercurial import ui
244 ui = ui.ui()
245 except ImportError:
246 print mercurial_lib_not_found
247
248 if ui is not None:
249 ui.readconfig(hgdir.File('hgrc').abspath)
250 style_hook = ui.config('hooks', 'pretxncommit.style', None)

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

346def PathListAllExist(key, val, env):
347 if not val:
348 return
349 paths = val.split(':')
350 for path in paths:
351 if not isdir(path):
352 raise SCons.Errors.UserError("Path does not exist: '%s'" % path)
353
354global_vars_file = joinpath(build_root, 'variables.global')
355
356global_vars = Variables(global_vars_file, args=ARGUMENTS)
357
358global_vars.AddVariables(
359 ('CC', 'C compiler', environ.get('CC', main['CC'])),
360 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
361 ('BATCH', 'Use batch pool for build and tests', False),
362 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
363 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
364 ('EXTRAS', 'Add Extra directories to the compilation', '',
365 PathListAllExist, PathListMakeAbsolute),
366 )
367
368# Update main environment with values from ARGUMENTS & global_vars_file
369global_vars.Update(main)
370help_texts["global_vars"] += global_vars.GenerateHelpText(main)
371
372# Save sticky variable settings back to current variables file
373global_vars.Save(global_vars_file, main)
374
375# Parse EXTRAS variable to build list of all directories where we're
376# look for sources etc. This list is exported as base_dir_list.
377base_dir = main.srcdir.abspath
378if main['EXTRAS']:
379 extras_dir_list = main['EXTRAS'].split(':')
380else:
381 extras_dir_list = []

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

463 def fmt(files):
464 f = map(lambda s: s[com_pfx_len:], files)
465 return ', '.join(f)
466 return self.format % (com_pfx, fmt(srcs), fmt(tgts))
467
468Export('Transform')
469
470
471if GetOption('verbose'):
472 def MakeAction(action, string, *args, **kwargs):
473 return Action(action, *args, **kwargs)
474else:
475 MakeAction = Action
476 main['CCCOMSTR'] = Transform("CC")
477 main['CXXCOMSTR'] = Transform("CXX")
478 main['ASCOMSTR'] = Transform("AS")
479 main['SWIGCOMSTR'] = Transform("SWIG")

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

973 # Make sure the directory is there so we can create it later
974 opt_dir = dirname(current_vars_file)
975 if not isdir(opt_dir):
976 mkdir(opt_dir)
977
978 # Get default build variables from source tree. Variables are
979 # normally determined by name of $VARIANT_DIR, but can be
980 # overriden by 'default=' arg on command line.
981 default = GetOption('default')
982 if not default:
983 default = variant_dir
984 default_vars_file = joinpath('build_opts', default)
985 if isfile(default_vars_file):
986 sticky_vars.files.append(default_vars_file)
987 print "Variables file %s not found,\n using defaults in %s" \
988 % (current_vars_file, default_vars_file)
989 else:
990 print "Error: cannot find variables file %s or %s" \
991 % (current_vars_file, default_vars_file)
992 Exit(1)
993
994 # Apply current variable settings to env
995 sticky_vars.Update(env)
996
997 help_texts["local_vars"] += \
998 "Build variables for %s:\n" % variant_dir \
999 + sticky_vars.GenerateHelpText(env)
1000
1001 # Process variable settings.
1002
1003 if not have_fenv and env['USE_FENV']:
1004 print "Warning: <fenv.h> not available; " \
1005 "forcing USE_FENV to False in", variant_dir + "."
1006 env['USE_FENV'] = False

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

1035 exports = 'env')
1036
1037 # Set up the regression tests for each build.
1038 for e in envList:
1039 SConscript('tests/SConscript',
1040 variant_dir = joinpath(variant_path, 'tests', e.Label),
1041 exports = { 'env' : e }, duplicate = False)
1042
1043# base help text
1044Help('''
1045Usage: scons [scons options] [build variables] [target(s)]
1046
1047Extra scons options:
1048%(options)s
1049
1050Global build variables:
1051%(global_vars)s
1052
1053%(local_vars)s
1054''' % help_texts)