Scons: added profile build option
[senf.git] / site_scons / senfutil.py
index 2b570d2..7217c84 100644 (file)
@@ -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', '#')