summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-05-30 13:11:34 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2006-05-30 13:11:34 -0400
commit0337db3388db335ea23f02f3aa00bca9d483ef1c (patch)
tree8293d1d4e9520acabde7e37bd0a065467147ba87 /SConstruct
parentd308055afc1ace1f321b76e8a85a9a45165da2ce (diff)
downloadgem5-0337db3388db335ea23f02f3aa00bca9d483ef1c.tar.xz
Link in Python interpreter.
Use embedded zip archive to carry Python code instead of homegrown embedded string/file mechanism. Do argument parsing in Python instead of C++. SConstruct: Add Python interpreter include path & library. Define two new simple builders which copy & concatenate files, respectively, for use by the Python embedded zipfile code. src/SConscript: Encapsulate environment creation in a function. Add code to append Python zip archive to final executable. Eliminate references to obsolete files. src/python/SConscript: Rewrite to generate embedded zip archive of Python code (replacing old "embedded string" mechanism). src/python/m5/__init__.py: Move main arg-parsing loop here (out of C++ main()). src/python/m5/config.py: Minor fix (version incompatibility?). src/sim/main.cc: Invoke embedded Python interpreter to parse args and generate config.ini, replacing C++ arg parsing code. --HG-- extra : convert_revision : 72d21236b2bee139ff39ba4cf031a4a1f8560029
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct34
1 files changed, 33 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index cbbcb07a6..2e4f48180 100644
--- a/SConstruct
+++ b/SConstruct
@@ -169,7 +169,13 @@ if sys.platform == 'cygwin':
env.Append(CCFLAGS=Split("-Wno-uninitialized"))
env.Append(CPPPATH=[Dir('ext/dnet')])
-# Default libraries
+# Environment args for linking in Python interpreter.
+# Should really have an option for setting the version instead of
+# having 2.4 hardwired in here...
+env.Append(CPPPATH='/usr/include/python2.4')
+env.Append(LIBS='python2.4')
+
+# Other default libraries
env.Append(LIBS=['z'])
# Platform-specific configuration. Note again that we assume that all
@@ -310,6 +316,32 @@ config_builder = Builder(emitter = config_emitter, action = config_action)
env.Append(BUILDERS = { 'ConfigFile' : config_builder })
+###################################################
+#
+# Define a SCons builder for copying files. This is used by the
+# Python zipfile code in src/python/SConscript, but is placed up here
+# since it's potentially more generally applicable.
+#
+###################################################
+
+copy_builder = Builder(action = Copy("$TARGET", "$SOURCE"))
+
+env.Append(BUILDERS = { 'CopyFile' : copy_builder })
+
+###################################################
+#
+# Define a simple SCons builder to concatenate files.
+#
+# Used to append the Python zip archive to the executable.
+#
+###################################################
+
+concat_builder = Builder(action = Action(['cat $SOURCES > $TARGET',
+ 'chmod +x $TARGET']))
+
+env.Append(BUILDERS = { 'Concat' : concat_builder })
+
+
# base help text
help_text = '''
Usage: scons [scons options] [build options] [target(s)]