SConstruct (8809:bb10807da889) SConstruct (8878:ac6eb417e7b4)
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

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

30#
31# Authors: Steve Reinhardt
32# Nathan Binkert
33
34###################################################
35#
36# SCons top-level build description (SConstruct) file.
37#
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

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

30#
31# Authors: Steve Reinhardt
32# Nathan Binkert
33
34###################################################
35#
36# SCons top-level build description (SConstruct) file.
37#
38# While in this directory ('m5'), just type 'scons' to build the default
38# While in this directory ('gem5'), just type 'scons' to build the default
39# configuration (see below), or type 'scons build/<CONFIG>/<binary>'
39# configuration (see below), or type 'scons build/<CONFIG>/<binary>'
40# to build some other configuration (e.g., 'build/ALPHA_FS/m5.opt' for
40# to build some other configuration (e.g., 'build/ALPHA/gem5.opt' for
41# the optimized full-system version).
42#
41# the optimized full-system version).
42#
43# You can build M5 in a different directory as long as there is a
43# You can build gem5 in a different directory as long as there is a
44# 'build/<CONFIG>' somewhere along the target path. The build system
45# expects that all configs under the same build directory are being
46# built for the same host system.
47#
48# Examples:
49#
50# The following two commands are equivalent. The '-u' option tells
51# scons to search up the directory tree for this SConstruct file.
44# 'build/<CONFIG>' somewhere along the target path. The build system
45# expects that all configs under the same build directory are being
46# built for the same host system.
47#
48# Examples:
49#
50# The following two commands are equivalent. The '-u' option tells
51# scons to search up the directory tree for this SConstruct file.
52# % cd <path-to-src>/m5 ; scons build/ALPHA_FS/m5.debug
53# % cd <path-to-src>/m5/build/ALPHA_FS; scons -u m5.debug
52# % cd <path-to-src>/gem5 ; scons build/ALPHA/gem5.debug
53# % cd <path-to-src>/gem5/build/ALPHA; scons -u gem5.debug
54#
55# The following two commands are equivalent and demonstrate building
56# in a directory outside of the source tree. The '-C' option tells
57# scons to chdir to the specified directory to find this SConstruct
58# file.
54#
55# The following two commands are equivalent and demonstrate building
56# in a directory outside of the source tree. The '-C' option tells
57# scons to chdir to the specified directory to find this SConstruct
58# file.
59# % cd <path-to-src>/m5 ; scons /local/foo/build/ALPHA_FS/m5.debug
60# % cd /local/foo/build/ALPHA_FS; scons -C <path-to-src>/m5 m5.debug
59# % cd <path-to-src>/gem5 ; scons /local/foo/build/ALPHA/gem5.debug
60# % cd /local/foo/build/ALPHA; scons -C <path-to-src>/gem5 gem5.debug
61#
62# You can use 'scons -H' to print scons options. If you're in this
61#
62# You can use 'scons -H' to print scons options. If you're in this
63# 'm5' directory (or use -u or -C to tell scons where to find this
64# file), you can use 'scons -h' to print all the M5-specific build
63# 'gem5' directory (or use -u or -C to tell scons where to find this
64# file), you can use 'scons -h' to print all the gem5-specific build
65# options as well.
66#
67###################################################
68
69# Check for recent-enough Python and SCons versions.
70try:
71 # Really old versions of scons only take two options for the
72 # function, so check once without the revision and once with the
73 # revision, the first instance will fail for stuff other than
74 # 0.98, and the second will fail for 0.98.0
75 EnsureSConsVersion(0, 98)
76 EnsureSConsVersion(0, 98, 1)
77except SystemExit, e:
78 print """
79For more details, see:
65# options as well.
66#
67###################################################
68
69# Check for recent-enough Python and SCons versions.
70try:
71 # Really old versions of scons only take two options for the
72 # function, so check once without the revision and once with the
73 # revision, the first instance will fail for stuff other than
74 # 0.98, and the second will fail for 0.98.0
75 EnsureSConsVersion(0, 98)
76 EnsureSConsVersion(0, 98, 1)
77except SystemExit, e:
78 print """
79For more details, see:
80 http://m5sim.org/wiki/index.php/Compiling_M5
80 http://gem5.org/Dependencies
81"""
82 raise
83
84# We ensure the python version early because we have stuff that
85# requires python 2.4
86try:
87 EnsurePythonVersion(2, 4)
88except SystemExit, e:
89 print """
90You can use a non-default installation of the Python interpreter by
91either (1) rearranging your PATH so that scons finds the non-default
92'python' first or (2) explicitly invoking an alternative interpreter
93on the scons script.
94
95For more details, see:
81"""
82 raise
83
84# We ensure the python version early because we have stuff that
85# requires python 2.4
86try:
87 EnsurePythonVersion(2, 4)
88except SystemExit, e:
89 print """
90You can use a non-default installation of the Python interpreter by
91either (1) rearranging your PATH so that scons finds the non-default
92'python' first or (2) explicitly invoking an alternative interpreter
93on the scons script.
94
95For more details, see:
96 http://m5sim.org/wiki/index.php/Using_a_non-default_Python_installation
96 http://gem5.org/wiki/index.php/Using_a_non-default_Python_installation
97"""
98 raise
99
100# Global Python includes
101import os
102import re
103import subprocess
104import sys
105
106from os import mkdir, environ
107from os.path import abspath, basename, dirname, expanduser, normpath
108from os.path import exists, isdir, isfile
109from os.path import join as joinpath, split as splitpath
110
111# SCons includes
112import SCons
113import SCons.Node
114
115extra_python_paths = [
97"""
98 raise
99
100# Global Python includes
101import os
102import re
103import subprocess
104import sys
105
106from os import mkdir, environ
107from os.path import abspath, basename, dirname, expanduser, normpath
108from os.path import exists, isdir, isfile
109from os.path import join as joinpath, split as splitpath
110
111# SCons includes
112import SCons
113import SCons.Node
114
115extra_python_paths = [
116 Dir('src/python').srcnode().abspath, # M5 includes
116 Dir('src/python').srcnode().abspath, # gem5 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 = {

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

186# add useful python code PYTHONPATH so it can be used by subprocesses
187# as well
188main.AppendENVPath('PYTHONPATH', extra_python_paths)
189
190########################################################################
191#
192# Mercurial Stuff.
193#
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 = {

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

186# add useful python code PYTHONPATH so it can be used by subprocesses
187# as well
188main.AppendENVPath('PYTHONPATH', extra_python_paths)
189
190########################################################################
191#
192# Mercurial Stuff.
193#
194# If the M5 directory is a mercurial repository, we should do some
194# If the gem5 directory is a mercurial repository, we should do some
195# extra things.
196#
197########################################################################
198
199hgdir = main.root.Dir(".hg")
200
201mercurial_style_message = """
202You're missing the gem5 style hook, which automatically checks your code

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

259###################################################
260#
261# Figure out which configurations to set up based on the path(s) of
262# the target(s).
263#
264###################################################
265
266# Find default configuration & binary.
195# extra things.
196#
197########################################################################
198
199hgdir = main.root.Dir(".hg")
200
201mercurial_style_message = """
202You're missing the gem5 style hook, which automatically checks your code

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

259###################################################
260#
261# Figure out which configurations to set up based on the path(s) of
262# the target(s).
263#
264###################################################
265
266# Find default configuration & binary.
267Default(environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
267Default(environ.get('M5_DEFAULT_BINARY', 'build/ALPHA/gem5.debug'))
268
269# helper function: find last occurrence of element in list
270def rfind(l, elt, offs = -1):
271 for i in range(len(l)+offs, 0, -1):
272 if l[i] == elt:
273 return i
274 raise ValueError, "element not found"
275

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

813
814sticky_vars.AddVariables(
815 EnumVariable('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
816 ListVariable('CPU_MODELS', 'CPU models',
817 sorted(n for n,m in CpuModel.dict.iteritems() if m.default),
818 sorted(CpuModel.list)),
819 BoolVariable('NO_FAST_ALLOC', 'Disable fast object allocator', False),
820 BoolVariable('FORCE_FAST_ALLOC',
268
269# helper function: find last occurrence of element in list
270def rfind(l, elt, offs = -1):
271 for i in range(len(l)+offs, 0, -1):
272 if l[i] == elt:
273 return i
274 raise ValueError, "element not found"
275

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

813
814sticky_vars.AddVariables(
815 EnumVariable('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
816 ListVariable('CPU_MODELS', 'CPU models',
817 sorted(n for n,m in CpuModel.dict.iteritems() if m.default),
818 sorted(CpuModel.list)),
819 BoolVariable('NO_FAST_ALLOC', 'Disable fast object allocator', False),
820 BoolVariable('FORCE_FAST_ALLOC',
821 'Enable fast object allocator, even for m5.debug', False),
821 'Enable fast object allocator, even for gem5.debug', False),
822 BoolVariable('FAST_ALLOC_STATS', 'Enable fast object allocator statistics',
823 False),
824 BoolVariable('EFENCE', 'Link with Electric Fence malloc debugger',
825 False),
826 BoolVariable('SS_COMPATIBLE_FP',
827 'Make floating-point results compatible with SimpleScalar',
828 False),
829 BoolVariable('USE_SSE2',

--- 198 unchanged lines hidden ---
822 BoolVariable('FAST_ALLOC_STATS', 'Enable fast object allocator statistics',
823 False),
824 BoolVariable('EFENCE', 'Link with Electric Fence malloc debugger',
825 False),
826 BoolVariable('SS_COMPATIBLE_FP',
827 'Make floating-point results compatible with SimpleScalar',
828 False),
829 BoolVariable('USE_SSE2',

--- 198 unchanged lines hidden ---