X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=site_scons%2Fsenfutil.py;h=1a2d4a16d1d54dc863a38a74b0758812d9ac37b4;hb=322b64a27007c166bfe66b3489a29c3a11801708;hp=331b3a896fc68ec026f38269413d37346b1b0c96;hpb=c1704e837e8bcf6b50da633326213f65cd5a8c46;p=senf.git diff --git a/site_scons/senfutil.py b/site_scons/senfutil.py index 331b3a8..1a2d4a1 100644 --- a/site_scons/senfutil.py +++ b/site_scons/senfutil.py @@ -1,4 +1,5 @@ import os, os.path, site_tools.Yaptu, types, re, fnmatch +import SCons.Util from SCons.Script import * senfutildir = os.path.dirname(__file__) @@ -26,7 +27,8 @@ def parseArguments(env, *defs): env.Help(""" Any construction environment variable may be set from the scons command line (see SConstruct file and SCons documentation for a list -of variables) using +of variables) usin +g VARNAME=value Assign new value VARNAME+=value Append value at end @@ -37,7 +39,8 @@ Special command line parameters: try : unknv = vars.UnknownVariables() except AttributeError: unknv = vars.UnknownOptions() env.SetDefault(ARGUMENT_VARIABLES = {}) - for k,v in unknv.iteritems(): + for k,v in ARGLIST: + if not unknv.has_key(k) : continue if k.endswith('+'): env.Append(**{k[:-1]: v}) env.Append(ARGUMENT_VARIABLES = {k[:-1]:v}) @@ -202,15 +205,17 @@ 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 env.Append( - CXXFLAGS = [ '-Wall', '-Woverloaded-virtual' ], + CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', "${profile and '-pg' or None}" ], CXXFLAGS_final = [ '-O3' ], CXXFLAGS_normal = [ '-O2', '-g' ], CXXFLAGS_debug = [ '-O0', '-g' ], + LINKFLAGS = [ "${profile and '-pg' or None}" ], LINKFLAGS_normal = [ '-Wl,-S' ], LINKFLAGS_debug = [ '-g' ], ) @@ -232,6 +237,18 @@ def Glob(env, exclude=[], subdirs=[]): testSources.sort() return (sources, testSources) +def CleanGlob(env, targets, patterns): + if env.GetOption('clean'): + targets = SCons.Util.flatten(targets) + for target in targets: + if target in BUILD_TARGETS: + patterns = map(str,SCons.Util.flatten(env.subst_list(patterns))) + files = [ os.path.join(path,f) + for path, subdirs, files in os.walk('.') + for pattern in patterns + for f in fnmatch.filter(files,pattern) ] + return env.Clean(target, files) + tagfiles = None def Doxygen(env, doxyheader=None, doxyfooter=None, doxycss=None, mydoxyfile=False, senfdoc_path=[],