X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=site_scons%2Fsenfutil.py;h=da24b19464c73b470af0e82a25e10bfe46849e34;hb=HEAD;hp=3061ab90d391dfa13e6e5cf1a866f8610e5cc04c;hpb=73c33f663ff0f65e4656ea5a5f6f07a43a2e1722;p=senf.git diff --git a/site_scons/senfutil.py b/site_scons/senfutil.py index 3061ab9..da24b19 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 os, os.path, site_tools.Yaptu, types, re, fnmatch, sys +import SCons.Util from SCons.Script import * senfutildir = os.path.dirname(__file__) @@ -11,6 +12,19 @@ except NameError: BoolVariable = BoolOption ########################################################################### +extdir = os.path.join(senfutildir, '../senf/Ext') +sys.path.append(extdir) + +for ext in os.listdir(extdir): + if not os.path.isdir( os.path.join(extdir, ext)): continue + if ext.startswith('.'): continue + try: + setattr( sys.modules[__name__], ext, + __import__('%s.site_scons' % ext, fromlist=['senfutil']).senfutil ) + except ImportError: + pass + +########################################################################### def loadTools(env): global senfutildir @@ -26,8 +40,7 @@ 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) usin -g +of variables) using VARNAME=value Assign new value VARNAME+=value Append value at end @@ -46,6 +59,8 @@ Special command line parameters: else: env.Replace(**{k: v}) env.Append(ARGUMENT_VARIABLES = {k:v}) + if env.get('PARSEFLAGS', None): + env.MergeFlags(env['PARSEFLAGS']) def importProcessEnv(env): env.Append( ENV = dict(( (k,v) @@ -153,8 +168,9 @@ def SetupForSENF(env, senf_path = [], flavor=None): CPPDEFINES = [ '$expandLogOption' ], CXXFLAGS = [ '-Wno-long-long', '-fno-strict-aliasing' ], LINKFLAGS = [ '-rdynamic' ], - LIBS = [ 'senf$LIBADDSUFFIX', 'rt', '$BOOSTREGEXLIB', '$BOOSTIOSTREAMSLIB', - '$BOOSTSIGNALSLIB', '$BOOSTFSLIB' ], + LIBS = [ 'senf$LIBADDSUFFIX', 'rt', '$BOOSTREGEXLIB', + '$BOOSTSIGNALSLIB', '$BOOSTFSLIB', '$BOOSTSYSTEMLIB', + '$BOOSTDATETIMELIB' ], ) try: @@ -204,15 +220,21 @@ 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_final = [ '-O3' ], + CXXFLAGS_CLANG = [ '-Wno-unneeded-internal-declaration' ], # needed for BOOST_PARAMETER_KEYWORD + CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', "${profile and '-pg' or None}", + '${str(CXX).split("/")[-1] == "clang++" and "$CXXFLAGS_CLANG" or None}' ], + CXXFLAGS_final = [ '-O3', '-fno-threadsafe-statics', '-fno-stack-protector', + "${profile and ' ' or '-ffunction-sections'}" ], CXXFLAGS_normal = [ '-O2', '-g' ], CXXFLAGS_debug = [ '-O0', '-g' ], + LINKFLAGS = [ "${profile and '-pg' or None}" ], + LINKFLAGS_final = [ "${profile and ' ' or '-Wl,--gc-sections'}" ], LINKFLAGS_normal = [ '-Wl,-S' ], LINKFLAGS_debug = [ '-g' ], ) @@ -234,6 +256,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=[],