X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=SConstruct;h=d8c0510f91c35dcb52da52586a3e6628a27e2611;hb=b6acba899f44ba9422476022c775cef823fc9337;hp=dd029f116fca14b3462e82b8f156e75516a9cd6b;hpb=0878c9c641a857eed4387332b3e24b1ee911e334;p=senf.git diff --git a/SConstruct b/SConstruct index dd029f1..d8c0510 100644 --- a/SConstruct +++ b/SConstruct @@ -12,16 +12,7 @@ env.Decider('MD5-timestamp') env.EnsureSConsVersion(1,2) # Load all the local SCons tools -env.Tool('Doxygen') -env.Tool('Dia2Png') -env.Tool('PkgDraw') -env.Tool('InstallSubdir') -env.Tool('CopyToDir') -env.Tool('Boost') -env.Tool('CombinedObject') -env.Tool('PhonyTarget') -env.Tool('InstallDir') -env.Tool('CreateFile') +senfutil.loadTools(env) env.Help(""" Additional top-level build targets: @@ -40,13 +31,21 @@ linklint Check links of doxygen documentation with 'linklint' fixlinks Fix broken links in doxygen documentation all_valgrinds Run all tests under valgrind/memcheck lcov Generate test coverage output in doc/lcov and lcov.info + +You may execute targets on a remote host (if the directory layout is the same) +by calling + + scons @[@] """) env.Append( - ENV = { 'PATH' : os.environ.get('PATH'), 'HOME' : os.environ.get('HOME') }, + ENV = { 'PATH' : os.environ.get('PATH'), + 'HOME' : os.environ.get('HOME'), + 'SSH_AGENT_PID': os.environ.get('SSH_AGENT_PID'), + 'SSH_AUTH_SOCK': os.environ.get('SSH_AUTH_SOCK') }, CLEAN_PATTERNS = [ '*~', '#*#', '*.pyc', 'semantic.cache', '.sconsign*' ], - BUILDDIR = '#', + BUILDDIR = '${FLAVOR and "#/build/$FLAVOR" or "#"}', CPPPATH = [ '$BUILDDIR', '#' ], LOCALLIBDIR = '$BUILDDIR', LIBPATH = [ '$LOCALLIBDIR' ], @@ -101,9 +100,13 @@ env.SetDefault( LCOV = "lcov", GENHTML = "genhtml", SCONSBIN = env.File("#/tools/scons"), - SCONS = "@$SCONSBIN -Q -j$CONCURRENCY_LEVEL", + SCONSARGS = [ '-Q', '-j$CONCURRENCY_LEVEL', 'debug=$debug', 'final=$final' ], + SCONS = "@$SCONSBIN $SCONSARGS", CONCURRENCY_LEVEL = env.GetOption('num_jobs') or 1, TOPDIR = env.Dir('#').abspath, + LIBADDSUFFIX = '${FLAVOR and "_$FLAVOR" or ""}', + OBJADDSUFFIX = '${LIBADDSUFFIX}', + FLAVOR = '', ) # Set variables from command line @@ -131,10 +134,10 @@ SConscriptChdir(0) SConscript("debian/SConscript") SConscriptChdir(1) if os.path.exists('SConscript.local') : SConscript('SConscript.local') -if env['BUILDDIR'] == '#': +if env.subst('$BUILDDIR') == '#': SConscript("SConscript") else: - SConscript("SConscript", variant_dir=env['BUILDDIR'], src_dir='#', duplicate=False) + SConscript("SConscript", variant_dir=env.subst('$BUILDDIR'), src_dir='#', duplicate=False) SConscript("Examples/SConscript") SConscript("HowTos/SConscript") SConscript("doclib/SConscript") @@ -174,8 +177,8 @@ for test in env.FindAllBoostUnitTests(): ### lcov env.PhonyTarget('lcov', [], [ - '$SCONS debug=1 BUILDDIR="#/lcov-build" CCFLAGS+="-fprofile-arcs -ftest-coverage" LIBS+="gcov" all_tests', - '$LCOV --follow --directory $TOPDIR/lcov-build/senf --capture --output-file /tmp/senf_lcov.info --base-directory $TOPDIR', + '$SCONS debug=1 BUILDDIR="#/build/lcov" CCFLAGS+="-fprofile-arcs -ftest-coverage" LIBS+="gcov" all_tests', + '$LCOV --follow --directory $TOPDIR/build/lcov/senf --capture --output-file /tmp/senf_lcov.info --base-directory $TOPDIR', '$LCOV --output-file lcov.info --remove /tmp/senf_lcov.info "*/include/*" "*/boost/*" "*.test.*" ', '$GENHTML --output-directory doc/lcov --title all_tests lcov.info', 'rm /tmp/senf_lcov.info' ]) @@ -184,20 +187,33 @@ if env.GetOption('clean'): for path, subdirs, files in os.walk('.') for pattern in ('*.gcno', '*.gcda', '*.gcov') for f in fnmatch.filter(files,pattern) ] + - [ 'lcov.info', env.Dir('doc/lcov'), env.Dir('lcov-build') ]) + [ 'lcov.info', env.Dir('doc/lcov'), env.Dir('build/lcov') ]) #### clean -env.Clean('all', ('.prepare-stamp', env.Dir('dist'))) +env.Clean('all', ('.prepare-stamp', env.Dir('dist'), env.Dir('build'))) if env.GetOption('clean') : env.Depends('all', ('lcov', 'all_valgrinds')) -if env.GetOption('clean'): +if env.GetOption('clean') and 'all' in BUILD_TARGETS: env.Clean('all', [ os.path.join(path,f) for path, subdirs, files in os.walk('.') for pattern in env['CLEAN_PATTERNS'] for f in fnmatch.filter(files,pattern) ]) - if 'all' in BUILD_TARGETS: - import SCons.SConsign - SCons.SConsign.write = lambda : None + # Disable writing to the deleted .sconsign file + import SCons.SConsign + SCons.SConsign.write = lambda : None if not env.GetOption('clean') and not os.path.exists(".prepare-stamp"): Execute(Touch(".prepare-stamp")) + +### execute targets on remote hosts +for target in COMMAND_LINE_TARGETS: + if '@' in target: + realtarget, host = target.split('@',1) + cwd=env.GetLaunchDir() + home=os.environ['HOME']+'/' + if cwd.startswith(home) : cwd = cwd[len(home):] + args = [ '$SCONSARGS' ] + if env.GetLaunchDir() != os.getcwd(): + args.append('-u') + env.PhonyTarget(target, [], [ "ssh $HOST scons $SCONSARGS -C $DIR $RTARGET" ], + HOST=host, RTARGET=realtarget, DIR=cwd, SCONSARGS=args)