changeset 042d509574c1 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=042d509574c1
description:
        build scripts: Made minor modifications to reduce build overhead time.

        1. --implicit-cache behavior is default.
        2. makeEnv in src/SConscript is conditionally called.
        3. decider set to MD5-timestamp
        4. NO_HTML build option changed to SLICC_HTML (defaults to False)

diffstat:

 SConstruct                  |   2 +
 src/SConscript              |  54 ++++++++++++++++++++++++++++++++++----------
 src/mem/protocol/SConscript |   4 +-
 src/mem/protocol/SConsopts  |   2 +-
 4 files changed, 46 insertions(+), 16 deletions(-)

diffs (112 lines):

diff -r b5d80698c948 -r 042d509574c1 SConstruct
--- a/SConstruct        Tue Mar 06 11:14:54 2012 -0500
+++ b/SConstruct        Tue Mar 06 19:07:41 2012 -0800
@@ -192,6 +192,8 @@
         use_env[key] = val
 
 main = Environment(ENV=use_env)
+main.Decider('MD5-timestamp')
+main.SetOption('implicit_cache', 1)
 main.root = Dir(".")         # The current directory (where this file lives).
 main.srcdir = Dir("src")     # The source directory
 
diff -r b5d80698c948 -r 042d509574c1 src/SConscript
--- a/src/SConscript    Tue Mar 06 11:14:54 2012 -0500
+++ b/src/SConscript    Tue Mar 06 19:07:41 2012 -0800
@@ -953,24 +953,52 @@
     print 'Unknown compiler, please fix compiler options'
     Exit(1)
 
-makeEnv('debug', '.do',
-        CCFLAGS = Split(ccflags['debug']),
-        CPPDEFINES = ['DEBUG', 'TRACING_ON=1'])
+
+# To speed things up, we only instantiate the build environments we
+# need.  We try to identify the needed environment for each target; if
+# we can't, we fall back on instantiating all the environments just to
+# be safe.
+target_types = ['debug', 'opt', 'fast', 'prof']
+obj2target = {'do': 'debug', 'o': 'opt', 'fo': 'fast', 'po': 'prof'}
+
+def identifyTarget(t):
+    ext = t.split('.')[-1]
+    if ext in target_types:
+        return ext
+    if obj2target.has_key(ext):
+        return obj2target[ext]
+    match = re.search(r'/tests/([^/]+)/', t)
+    if match and match.group(1) in target_types:
+        return match.group(1)
+    return 'all'
+
+needed_envs = [identifyTarget(target) for target in BUILD_TARGETS]
+if 'all' in needed_envs:
+    needed_envs += target_types
+
+# Debug binary
+if 'debug' in needed_envs:
+    makeEnv('debug', '.do',
+            CCFLAGS = Split(ccflags['debug']),
+            CPPDEFINES = ['DEBUG', 'TRACING_ON=1'])
 
 # Optimized binary
-makeEnv('opt', '.o',
-        CCFLAGS = Split(ccflags['opt']),
-        CPPDEFINES = ['TRACING_ON=1'])
+if 'opt' in needed_envs:
+    makeEnv('opt', '.o',
+            CCFLAGS = Split(ccflags['opt']),
+            CPPDEFINES = ['TRACING_ON=1'])
 
 # "Fast" binary
-makeEnv('fast', '.fo', strip = True,
-        CCFLAGS = Split(ccflags['fast']),
-        CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'])
+if 'fast' in needed_envs:
+    makeEnv('fast', '.fo', strip = True,
+            CCFLAGS = Split(ccflags['fast']),
+            CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'])
 
 # Profiled binary
-makeEnv('prof', '.po',
-        CCFLAGS = Split(ccflags['prof']),
-        CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
-        LINKFLAGS = '-pg')
+if 'prof' in needed_envs:
+    makeEnv('prof', '.po',
+            CCFLAGS = Split(ccflags['prof']),
+            CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+            LINKFLAGS = '-pg')
 
 Return('envList')
diff -r b5d80698c948 -r 042d509574c1 src/mem/protocol/SConscript
--- a/src/mem/protocol/SConscript       Tue Mar 06 11:14:54 2012 -0500
+++ b/src/mem/protocol/SConscript       Tue Mar 06 19:07:41 2012 -0800
@@ -69,7 +69,7 @@
     slicc = SLICC(filepath, verbose=False)
     slicc.process()
     slicc.writeCodeFiles(protocol_dir.abspath)
-    if not env['NO_HTML']:
+    if env['SLICC_HTML']:
         slicc.writeHTMLFiles(html_dir.abspath)
 
     target.extend([protocol_dir.File(f) for f in sorted(slicc.files())])
@@ -82,7 +82,7 @@
     slicc = SLICC(filepath, verbose=True)
     slicc.process()
     slicc.writeCodeFiles(protocol_dir.abspath)
-    if not env['NO_HTML']:
+    if env['SLICC_HTML']:
         slicc.writeHTMLFiles(html_dir.abspath)
 
 slicc_builder = Builder(action=MakeAction(slicc_action, Transform("SLICC")),
diff -r b5d80698c948 -r 042d509574c1 src/mem/protocol/SConsopts
--- a/src/mem/protocol/SConsopts        Tue Mar 06 11:14:54 2012 -0500
+++ b/src/mem/protocol/SConsopts        Tue Mar 06 19:07:41 2012 -0800
@@ -48,5 +48,5 @@
 sticky_vars.AddVariables(opt)
 export_vars += ['PROTOCOL']
 
-opt = BoolVariable('NO_HTML', 'Do not create HTML files', False)
+opt = BoolVariable('SLICC_HTML', 'Create HTML files', False)
 sticky_vars.AddVariables(opt)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to