SConscript (5862:50fb2cb40609) SConscript (5863:f73e06bc8765)
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

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

43# This file defines how to build a particular configuration of M5
44# based on variable settings in the 'env' build environment.
45
46Import('*')
47
48# Children need to see the environment
49Export('env')
50
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

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

43# This file defines how to build a particular configuration of M5
44# based on variable settings in the 'env' build environment.
45
46Import('*')
47
48# Children need to see the environment
49Export('env')
50
51build_env = dict([(opt, env[opt]) for opt in env.ExportOptions])
51build_env = dict([(opt, env[opt]) for opt in env.ExportVariables])
52
53def sort_list(_list):
54 """return a sorted copy of '_list'"""
55 if isinstance(_list, list):
56 _list = _list[:]
57 else:
58 _list = list(_list)
59 _list.sort()

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

237
238for extra_dir in extras_dir_list:
239 prefix_len = len(dirname(extra_dir)) + 1
240 for root, dirs, files in os.walk(extra_dir, topdown=True):
241 if 'SConscript' in files:
242 build_dir = joinpath(env['BUILDDIR'], root[prefix_len:])
243 SConscript(joinpath(root, 'SConscript'), build_dir=build_dir)
244
52
53def sort_list(_list):
54 """return a sorted copy of '_list'"""
55 if isinstance(_list, list):
56 _list = _list[:]
57 else:
58 _list = list(_list)
59 _list.sort()

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

237
238for extra_dir in extras_dir_list:
239 prefix_len = len(dirname(extra_dir)) + 1
240 for root, dirs, files in os.walk(extra_dir, topdown=True):
241 if 'SConscript' in files:
242 build_dir = joinpath(env['BUILDDIR'], root[prefix_len:])
243 SConscript(joinpath(root, 'SConscript'), build_dir=build_dir)
244
245for opt in env.ExportOptions:
245for opt in env.ExportVariables:
246 env.ConfigFile(opt)
247
248########################################################################
249#
250# Prevent any SimObjects from being added after this point, they
251# should all have been added in the SConscripts above
252#
253class DictImporter(object):

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

348module_depends = ["m5", "m5.SimObject", "m5.params"]
349depends = [ File(py_modules[dep]) for dep in module_depends ]
350
351########################################################################
352#
353# Commands for the basic automatically generated python files
354#
355
246 env.ConfigFile(opt)
247
248########################################################################
249#
250# Prevent any SimObjects from being added after this point, they
251# should all have been added in the SConscripts above
252#
253class DictImporter(object):

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

348module_depends = ["m5", "m5.SimObject", "m5.params"]
349depends = [ File(py_modules[dep]) for dep in module_depends ]
350
351########################################################################
352#
353# Commands for the basic automatically generated python files
354#
355
356scons_dir = str(SCons.Node.FS.default_fs.SConstruct_dir)
357
358hg_info = "Unknown"
359hg_demandimport = False
360try:
361 if not exists(scons_dir) or not isdir(scons_dir) or \
362 not exists(joinpath(scons_dir, ".hg")):
363 raise ValueError(".hg directory not found")
364 import subprocess
365 output = subprocess.Popen("hg id -n -i -t -b".split(),
366 stdout=subprocess.PIPE).communicate()[0]
367 hg_info = output.strip()
368except ImportError, e:
369 print "Mercurial not found"
370except ValueError, e:
371 print e
372except Exception, e:
373 print "Other mercurial exception: %s" % e
374
375# Generate Python file containing a dict specifying the current
376# build_env flags.
377def makeDefinesPyFile(target, source, env):
378 f = file(str(target[0]), 'w')
379 build_env, hg_info = [ x.get_contents() for x in source ]
380 print >>f, "buildEnv = %s" % build_env
381 print >>f, "hgRev = '%s'" % hg_info
382 f.close()
383
356# Generate Python file containing a dict specifying the current
357# build_env flags.
358def makeDefinesPyFile(target, source, env):
359 f = file(str(target[0]), 'w')
360 build_env, hg_info = [ x.get_contents() for x in source ]
361 print >>f, "buildEnv = %s" % build_env
362 print >>f, "hgRev = '%s'" % hg_info
363 f.close()
364
384defines_info = [ Value(build_env), Value(hg_info) ]
365defines_info = [ Value(build_env), Value(env['HG_INFO']) ]
385# Generate a file with all of the compile options in it
386env.Command('python/m5/defines.py', defines_info, makeDefinesPyFile)
387PySource('m5', 'python/m5/defines.py')
388
389# Generate python file containing info about the M5 source code
390def makeInfoPyFile(target, source, env):
391 f = file(str(target[0]), 'w')
392 for src in source:

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

965# binary. Additional keyword arguments are appended to corresponding
966# build environment vars.
967def makeEnv(label, objsfx, strip = False, **kwargs):
968 # SCons doesn't know to append a library suffix when there is a '.' in the
969 # name. Use '_' instead.
970 libname = 'm5_' + label
971 exename = 'm5.' + label
972
366# Generate a file with all of the compile options in it
367env.Command('python/m5/defines.py', defines_info, makeDefinesPyFile)
368PySource('m5', 'python/m5/defines.py')
369
370# Generate python file containing info about the M5 source code
371def makeInfoPyFile(target, source, env):
372 f = file(str(target[0]), 'w')
373 for src in source:

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

946# binary. Additional keyword arguments are appended to corresponding
947# build environment vars.
948def makeEnv(label, objsfx, strip = False, **kwargs):
949 # SCons doesn't know to append a library suffix when there is a '.' in the
950 # name. Use '_' instead.
951 libname = 'm5_' + label
952 exename = 'm5.' + label
953
973 new_env = env.Copy(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
954 new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
974 new_env.Label = label
975 new_env.Append(**kwargs)
976
955 new_env.Label = label
956 new_env.Append(**kwargs)
957
977 swig_env = new_env.Copy()
958 swig_env = new_env.Clone()
978 if env['GCC']:
979 swig_env.Append(CCFLAGS='-Wno-uninitialized')
980 swig_env.Append(CCFLAGS='-Wno-sign-compare')
981 swig_env.Append(CCFLAGS='-Wno-parentheses')
982
983 static_objs = make_objs(cc_lib_sources, new_env, static=True)
984 shared_objs = make_objs(cc_lib_sources, new_env, static=False)
985 static_objs += [ swig_env.StaticObject(s) for s in cc_swig_sources ]

--- 72 unchanged lines hidden ---
959 if env['GCC']:
960 swig_env.Append(CCFLAGS='-Wno-uninitialized')
961 swig_env.Append(CCFLAGS='-Wno-sign-compare')
962 swig_env.Append(CCFLAGS='-Wno-parentheses')
963
964 static_objs = make_objs(cc_lib_sources, new_env, static=True)
965 shared_objs = make_objs(cc_lib_sources, new_env, static=False)
966 static_objs += [ swig_env.StaticObject(s) for s in cc_swig_sources ]

--- 72 unchanged lines hidden ---