SConscript (8333:c1a07ecb6619) SConscript (8334:483e936f44f0)
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

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

36import re
37import sys
38import zlib
39
40from os.path import basename, dirname, exists, isdir, isfile, join as joinpath
41
42import SCons
43
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

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

36import re
37import sys
38import zlib
39
40from os.path import basename, dirname, exists, isdir, isfile, join as joinpath
41
42import SCons
43
44# This file defines how to build a particular configuration of M5
44# This file defines how to build a particular configuration of gem5
45# based on variable settings in the 'env' build environment.
46
47Import('*')
48
49# Children need to see the environment
50Export('env')
51
52build_env = [(opt, env[opt]) for opt in export_vars]
53
54from m5.util import code_formatter
55
56########################################################################
57# Code for adding source files of various types
58#
59# When specifying a source file of some type, a set of guards can be
60# specified for that file. When get() is used to find the files, if
61# get specifies a set of filters, only files that match those filters
62# will be accepted (unspecified filters on files are assumed to be
63# false). Current filters are:
45# based on variable settings in the 'env' build environment.
46
47Import('*')
48
49# Children need to see the environment
50Export('env')
51
52build_env = [(opt, env[opt]) for opt in export_vars]
53
54from m5.util import code_formatter
55
56########################################################################
57# Code for adding source files of various types
58#
59# When specifying a source file of some type, a set of guards can be
60# specified for that file. When get() is used to find the files, if
61# get specifies a set of filters, only files that match those filters
62# will be accepted (unspecified filters on files are assumed to be
63# false). Current filters are:
64# main -- specifies the m5 main() function
65# skip_lib -- do not put this file into the m5 library
64# main -- specifies the gem5 main() function
65# skip_lib -- do not put this file into the gem5 library
66# <unittest> -- unit tests use filters based on the unit test name
67#
68# A parent can now be specified for a source file and default filter
69# values will be retrieved recursively from parents (children override
70# parents).
71#
72class SourceMeta(type):
73 '''Meta class for source files that keeps track of all files of a

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

293# the corresponding build directory to pick up generated include
294# files.
295env.Append(CPPPATH=Dir('.'))
296
297for extra_dir in extras_dir_list:
298 env.Append(CPPPATH=Dir(extra_dir))
299
300# Workaround for bug in SCons version > 0.97d20071212
66# <unittest> -- unit tests use filters based on the unit test name
67#
68# A parent can now be specified for a source file and default filter
69# values will be retrieved recursively from parents (children override
70# parents).
71#
72class SourceMeta(type):
73 '''Meta class for source files that keeps track of all files of a

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

293# the corresponding build directory to pick up generated include
294# files.
295env.Append(CPPPATH=Dir('.'))
296
297for extra_dir in extras_dir_list:
298 env.Append(CPPPATH=Dir(extra_dir))
299
300# Workaround for bug in SCons version > 0.97d20071212
301# Scons bug id: 2006 M5 Bug id: 308
301# Scons bug id: 2006 gem5 Bug id: 308
302for root, dirs, files in os.walk(base_dir, topdown=True):
303 Dir(root[len(base_dir) + 1:])
304
305########################################################################
306#
307# Walk the tree and execute all SConscripts in subdirectories
308#
309

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

861
862# Function to create a new build environment as clone of current
863# environment 'env' with modified object suffix and optional stripped
864# binary. Additional keyword arguments are appended to corresponding
865# build environment vars.
866def makeEnv(label, objsfx, strip = False, **kwargs):
867 # SCons doesn't know to append a library suffix when there is a '.' in the
868 # name. Use '_' instead.
302for root, dirs, files in os.walk(base_dir, topdown=True):
303 Dir(root[len(base_dir) + 1:])
304
305########################################################################
306#
307# Walk the tree and execute all SConscripts in subdirectories
308#
309

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

861
862# Function to create a new build environment as clone of current
863# environment 'env' with modified object suffix and optional stripped
864# binary. Additional keyword arguments are appended to corresponding
865# build environment vars.
866def makeEnv(label, objsfx, strip = False, **kwargs):
867 # SCons doesn't know to append a library suffix when there is a '.' in the
868 # name. Use '_' instead.
869 libname = 'm5_' + label
870 exename = 'm5.' + label
869 libname = 'gem5_' + label
870 exename = 'gem5.' + label
871 secondary_exename = 'm5.' + label
871
872 new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
873 new_env.Label = label
874 new_env.Append(**kwargs)
875
876 swig_env = new_env.Clone()
877 swig_env.Append(CCFLAGS='-Werror')
878 if env['GCC']:

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

938
939 if strip:
940 if sys.platform == 'sunos5':
941 cmd = 'cp $SOURCE $TARGET; strip $TARGET'
942 else:
943 cmd = 'strip $SOURCE -o $TARGET'
944 targets = new_env.Command(exename, progname,
945 MakeAction(cmd, Transform("STRIP")))
872
873 new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
874 new_env.Label = label
875 new_env.Append(**kwargs)
876
877 swig_env = new_env.Clone()
878 swig_env.Append(CCFLAGS='-Werror')
879 if env['GCC']:

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

939
940 if strip:
941 if sys.platform == 'sunos5':
942 cmd = 'cp $SOURCE $TARGET; strip $TARGET'
943 else:
944 cmd = 'strip $SOURCE -o $TARGET'
945 targets = new_env.Command(exename, progname,
946 MakeAction(cmd, Transform("STRIP")))
946
947
948 new_env.Command(secondary_exename, exename,
949 MakeAction('ln $SOURCE $TARGET', Transform("HARDLINK")))
950
947 new_env.M5Binary = targets[0]
948 envList.append(new_env)
949
950# Debug binary
951ccflags = {}
952if env['GCC']:
953 if sys.platform == 'sunos5':
954 ccflags['debug'] = '-gstabs+'

--- 40 unchanged lines hidden ---
951 new_env.M5Binary = targets[0]
952 envList.append(new_env)
953
954# Debug binary
955ccflags = {}
956if env['GCC']:
957 if sys.platform == 'sunos5':
958 ccflags['debug'] = '-gstabs+'

--- 40 unchanged lines hidden ---