From: tho Date: Mon, 13 Sep 2010 11:16:09 +0000 (+0000) Subject: Scons: added profile build option X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=8db732cfb7203fbad3ffc6bddc43346af7411b46;p=senf.git Scons: added profile build option git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1714 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/SConstruct b/SConstruct index ee0c64e..ebef9b9 100644 --- a/SConstruct +++ b/SConstruct @@ -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) diff --git a/site_scons/senfutil.py b/site_scons/senfutil.py index 2b570d2..7217c84 100644 --- a/site_scons/senfutil.py +++ b/site_scons/senfutil.py @@ -205,6 +205,7 @@ def DefaultOptions(env): 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), ) # Set nice default options @@ -217,6 +218,11 @@ def DefaultOptions(env): LINKFLAGS_normal = [ '-Wl,-S' ], LINKFLAGS_debug = [ '-g' ], ) + if env['profile']: + env.Append( + LINKFLAGS = [ '-pg' ], + CXXFLAGS = [ '-pg' ], + ) env.Alias('all', '#')