Scons: added profile build option
[senf.git] / SConstruct
index 08056ad..ebef9b9 100644 (file)
@@ -101,7 +101,7 @@ env.Append(
                                '--param','large-function-growth=10000',
                                '--param', 'large-function-insns=10000',
                                '--param','inline-unit-growth=10000' ],
-    INLINE_OPTS_NORMAL     = [ '-finline-limit=5000' ],
+    INLINE_OPTS_NORMAL     = [ '-finline-limit=5000', '--param', 'inline-unit-growth=60' ],
     INLINE_OPTS            = [ '$INLINE_OPTS_NORMAL' ],
     CXXFLAGS               = [ '-Wall', '-Woverloaded-virtual', '-Wno-long-long', '$INLINE_OPTS',
                                '-pipe', '$CXXFLAGS_', '-fno-strict-aliasing' ],
@@ -138,7 +138,7 @@ env.SetDefault(
     VALGRIND               = "valgrind",
     SCONSBIN               = env.File("#/tools/scons"),
     SCONSARGS              = ([ '-Q', '-j$CONCURRENCY_LEVEL' ] +
-                              [ '%s=%s' % (k,v) for k,v in ARGUMENTS.iteritems() ]),
+                              [ '%s=%s' % (k,v) for k,v in ARGLIST ]),
     SCONS                  = "@$SCONSBIN $SCONSARGS",
     CONCURRENCY_LEVEL      = env.GetOption('num_jobs') or 1,
     TOPDIR                 = env.Dir('#').abspath,
@@ -152,10 +152,19 @@ senfutil.parseArguments(
     env,
     BoolVariable('final', 'Build final (optimized) build', False),
     BoolVariable('debug', 'Link in debug symbols', False),
+    BoolVariable('profile', 'compile and link with the profiling enabled option', False),
     BoolVariable('syslayout', 'Install in to system layout directories (lib/, include/ etc)', False),
     BoolVariable('sparse_tests', 'Link tests against object files and not the senf lib', False)
 )
 
+# gprof
+if env['profile']:
+    env.Append(
+        LINKFLAGS          = [ '-pg' ],
+        CXXFLAGS           = [ '-pg' ],
+    )
+
+
 # Add UNIX env vars matching IMPORT_ENV patterns into the execution environment
 senfutil.importProcessEnv(env)
 
@@ -216,7 +225,6 @@ if env['sparse_tests']:
 #### install_all, default, all_tests, all
 env.Install('${SCONSINSTALLDIR}', [ 'site_scons/__init__.py',
                                     'site_scons/senfutil.py',
-                                    'site_scons/senfconf.py',
                                     'site_scons/yaptu.py' ])
 env.InstallDir('${SCONSINSTALLDIR}', [ 'site_scons/site_tools', 'site_scons/lib' ],
                FILTER_SUFFIXES=[ '','.css','.pl','.py','.sh','.sty','.xml','.xsl','.yap' ])
@@ -229,7 +237,7 @@ env.Alias('all_tests', env.FindAllBoostUnitTests())
 env.Alias('test_changes', 'all_tests')
 env.Alias('all', [ 'default', 'all_tests', 'examples', 'all_docs' ])
 
-#### prepare
+#### prepare and -c some
 env.PhonyTarget('prepare', [], [])
 env.PhonyTarget('some', [], [])
 
@@ -305,6 +313,6 @@ for target in COMMAND_LINE_TARGETS:
 env.PhonyTarget('clean', [], [
         lambda **args: sys.stderr.write(
             "=================================================================\n"
-            "'clean' is not a valid target. Instead, use\n"
+            "'clean' is not a valid target, use the '-c' option instead:\n"
             "    $ scons -c all\n"
             "=================================================================\n") ])