/TODO
/dist/
/lcov.info
+/build/
+/lcov-build/
--- /dev/null
+Import('env')
+
+env['ALLOBJECTS'] = []
+
+SConscript('senf/SConscript')
+
+#### libsenf.a
+libsenf = env.Library("$LOCALLIBDIR/${LIBSENF}${LIBADDSUFFIX}", env['ALLOBJECTS'])
+env.Default(libsenf)
+env.Install('$LIBINSTALLDIR', libsenf)
+
+conf = env.CreateFile("${LOCALLIBDIR}/${LIBSENF}${LIBADDSUFFIX}.conf",
+ env.Value(env.subst("$_CPPDEFFLAGS")))
+env.Default(conf)
+env.Install('$CONFINSTALLDIR', conf)
# -*- python -*-
-import sys, glob, os.path, fnmatch
+import sys, os.path, fnmatch
import SENFSCons, senfutil
###########################################################################
env.Tool('CombinedObject')
env.Tool('PhonyTarget')
env.Tool('InstallDir')
+env.Tool('CreateFile')
env.Help("""
Additional top-level build targets:
ENV = { 'PATH' : os.environ.get('PATH'), 'HOME' : os.environ.get('HOME') },
CLEAN_PATTERNS = [ '*~', '#*#', '*.pyc', 'semantic.cache', '.sconsign*' ],
- CPPPATH = [ '#' ],
- LOCALLIBDIR = '#',
+ BUILDDIR = '#',
+ CPPPATH = [ '$BUILDDIR', '#' ],
+ LOCALLIBDIR = '$BUILDDIR',
LIBPATH = [ '$LOCALLIBDIR' ],
LIBS = [ '$LIBSENF$LIBADDSUFFIX', 'rt', '$BOOSTREGEXLIB',
'$BOOSTIOSTREAMSLIB', '$BOOSTSIGNALSLIB', '$BOOSTFSLIB' ],
if not env.GetOption('clean') and not os.path.exists(".prepare-stamp") \
and not os.environ.get("SCONS") and COMMAND_LINE_TARGETS != [ 'prepare' ]:
- env.Execute([ "$(SCONS) prepare" ])
+ env.Execute([ "$SCONS prepare" ])
# Load SConscripts
SConscript("debian/SConscript")
SConscriptChdir(1)
if os.path.exists('SConscript.local') : SConscript('SConscript.local')
-SConscript("senf/SConscript")
+if env['BUILDDIR'] == '#':
+ SConscript("SConscript")
+else:
+ SConscript("SConscript", variant_dir=env['BUILDDIR'], src_dir='#', duplicate=False)
SConscript("Examples/SConscript")
SConscript("HowTos/SConscript")
SConscript("doclib/SConscript")
###########################################################################
# Define build targets
-#### libsenf.a
-libsenf = env.Library("$LOCALLIBDIR/${LIBSENF}${LIBADDSUFFIX}", env['ALLOBJECTS'])
-env.Default(libsenf)
-env.Install('$LIBINSTALLDIR', libsenf)
-
-def create(target, source, env):
- file(str(target[0]), 'w').write(source[0].get_contents()+"\n")
-env['BUILDERS']['CreateFile'] = Builder(action = create)
-
-conf = env.CreateFile("${LOCALLIBDIR}/${LIBSENF}${LIBADDSUFFIX}.conf",
- env.Value(env.subst("$_CPPDEFFLAGS")))
-env.Default(conf)
-env.Install('$CONFINSTALLDIR', conf)
-
#### install_all, default, all_tests, all
env.Install('${SCONSINSTALLDIR}', [ 'site_scons/__init__.py',
'site_scons/senfutil.py',
### lcov
env.PhonyTarget('lcov', [], [
- '$SCONS debug=1 CCFLAGS+="-fprofile-arcs -ftest-coverage" LIBS+="gcov" all_tests',
- '$LCOV --follow --directory $TOPDIR/senf --capture --output-file /tmp/senf_lcov.info --base-directory $TOPDIR',
+ '$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',
'$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' ])
if env.GetOption('clean'):
- env.Depends('lcov', 'all_tests')
env.Clean('lcov', [ os.path.join(path,f)
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') ])
+ [ 'lcov.info', env.Dir('doc/lcov'), env.Dir('lcov-build') ])
#### clean
env.Clean('all', ('.prepare-stamp', env.Dir('dist')))
#ifndef HH_SENF_PPI_PPI_
#define HH_SENF_PPI_PPI_ 1
-#include "all_includes.hh"
+#include <senf/PPI/all_includes.hh>
#endif
###########################################################################
+env['PACKET_BUNDLES'] = []
+
SENFSCons.AutoRules(env, doc_extra_sources = [
env.Dia2Png("structure.dia"),
env.Dia2Png("80221Bundle/TLV.dia"),
# -*- python -*-
Import('env')
-import SENFSCons, glob, os
+import SENFSCons, os
###########################################################################
# Ext/SConscript is last so it can depend on env vars set by any other script
# (e.g. $PACKET_BUNDLES)
-SConscript(list(set(glob.glob("*/SConscript")) - set(("Ext/SConscript",))))
+SConscript(sorted(list(set(env.Glob("*/SConscript", strings=True)) - set(("Ext/SConscript",)))))
SConscript("Ext/SConscript")
-env.InstallSubdir(target = '$INCLUDEINSTALLDIR', source = [ glob.glob("*.hh") ])
+env.InstallSubdir(target = '$INCLUDEINSTALLDIR',
+ source = sorted(env.Glob("*.hh", strings=True)))
#ifndef HH_SENF_Socket_Protocols_DVB_DVB_
#define HH_SENF_Socket_Protocols_DVB_DVB_ 1
-#include "all_includes.hh"
+#include <senf/Socket/Protocols/DVB/all_includes.hh>
#endif
#ifndef HH_SENF_Socket_Protocols_INet_INet_
#define HH_SENF_Socket_Protocols_INet_INet_ 1
-#include "all_includes.hh"
+#include <senf/Socket/Protocols/INet/all_includes.hh>
#endif
#ifndef HH_SENF_Socket_Protocols_Raw_Raw_
#define HH_SENF_Socket_Protocols_Raw_Raw_ 1
-#include "all_includes.hh"
+#include <senf/Socket/Protocols/Raw/all_includes.hh>
#endif
#ifndef HH_SENF_Socket_Protocols_UN_UN_
#define HH_SENF_Socket_Protocols_UN_UN_ 1
-#include "all_includes.hh"
+#include <senf/Socket/Protocols/UN/all_includes.hh>
#endif
#ifndef HH_SENF_Socket_Socket_
#define HH_SENF_Socket_Socket_ 1
-#include "all_includes.hh"
+#include <senf/Socket/all_includes.hh>
#endif
#ifndef HH_SENF_Utils_Logger_Logger_
#define HH_SENF_Utils_Logger_Logger_ 1
-#include "all_includes.hh"
+#include <senf/Utils/Logger/all_includes.hh>
#endif
from SCons.Script import *
def Glob(env, exclude=[], subdirs=[]):
- testSources = glob.glob("*.test.cc")
- sources = [ x for x in glob.glob("*.cc") if x not in testSources and x not in exclude ]
+ testSources = env.Glob("*.test.cc",strings=True)
+ sources = [ x
+ for x in env.Glob("*.cc",strings=True)
+ if x not in testSources and x not in exclude ]
for subdir in subdirs:
- testSources += glob.glob(os.path.join(subdir,"*.test.cc"))
- sources += [ x for x in glob.glob(os.path.join(subdir,"*.cc"))
+ testSources += env.Glob(os.path.join(subdir,"*.test.cc"),strings=True)
+ sources += [ x
+ for x in env.Glob(os.path.join(subdir,"*.cc"),strings=True)
if x not in testSources and x not in exclude ]
includes = []
- for d in [ '.' ] + subdirs:
- for f in os.listdir(d):
- ext = '.' + f.split('.',1)[-1]
- p = os.path.join(d,f)
+ for d in [ '' ] + [ x+'/' for x in subdirs ]:
+ for p in env.Glob("%s*" % d, strings=True) + env.Glob("%s*" % d, strings=True, ondisk=False):
+ ext = '.' + p.split('.',1)[-1]
if ext in env['CPP_INCLUDE_EXTENSIONS'] \
and ext not in env['CPP_EXCLUDE_EXTENSIONS'] \
and p not in exclude:
includes.append(p)
+ includes = list(set(includes))
+ sources.sort()
+ testSources.sort()
+ includes.sort()
return ( sources, testSources, includes )
def Doxygen(env, doxyfile = "Doxyfile", extra_sources = [], output_directory = "doc"):
return doc
def AllIncludesHH(env, exclude=[]):
- exclude = exclude[:] + ['all_includes.hh'] # Make a copy !!
- headers = [ f for f in glob.glob("*.hh")
- if f not in exclude and not f.endswith('.test.hh') ]
- headers.sort()
+ exclude = exclude + ['all_includes.hh']
+ headers = [ f for f in env.Glob("*.hh", source=True)
+ if f.name not in exclude and not f.name.endswith('.test.hh') ]
+ headers.sort(key=lambda x:x.name)
target = env.File("all_includes.hh")
- file(target.abspath,"w").write("".join([ '#include "%s"\n' % f
- for f in headers ]))
- env.Clean(env.Alias('all'), target)
-
+ env.Default(env.CreateFile(target,
+ env.Value("".join([ '#include <%s>\n' % f.srcnode().get_path(env.Dir('#'))
+ for f in headers ]))))
INDEXPAGE="""
/** \mainpage ${TITLE}
def IndexPage(env, name, title, text=""):
SUBPAGES = []
- for dox in sorted(glob.glob("*/Mainpage.dox")):
+ for dox in sorted(env.Glob("*/Mainpage.dox",strings=True)):
subtitle = ([None] + [ line.split('\\mainpage',1)[-1].strip() for line in file(dox)
if '\\mainpage' in line ])[-1]
if subtitle:
import SENFSCons
sources, tests, includes = SENFSCons.Glob(env, exclude=((exclude)), subdirs=((subdirs)) )
- subscripts = env.Glob("*/SConscript")
+ subscripts = sorted(env.Glob("*/SConscript", strings=True))
doxyfile = env.Glob("Doxyfile")
+ objects = []
if sources : env.Append(ALLOBJECTS = env.Object(sources))
if tests : env.BoostUnitTest('test', tests)
import SENFSCons
sources, tests, includes = SENFSCons.Glob(env, exclude=((exclude)), subdirs=((subdirs)) )
- subscripts = env.Glob("*/SConscript")
+ subscripts = sorted(env.Glob("*/SConscript", strings=True))
doxyfile = env.Glob("Doxyfile")
objects = env.Object(sources)
)
def Glob(env, exclude=[], subdirs=[]):
- testSources = glob.glob("*.test.cc")
- sources = [ x for x in glob.glob("*.cc") if x not in testSources and x not in exclude ]
+ testSources = env.Glob("*.test.cc", strings=True)
+ sources = [ x
+ for x in env.Glob("*.cc", strings=True)
+ if x not in testSources and x not in exclude ]
for subdir in subdirs:
testSources += glob.glob(os.path.join(subdir,"*.test.cc"))
- sources += [ x for x in glob.glob(os.path.join(subdir,"*.cc"))
+ sources += [ x
+ for x in env.Glob(os.path.join(subdir,"*.cc"))
if x not in testSources and x not in exclude ]
+ sources.sort()
+ testSources.sort()
return (sources, testSources)
tagfiles = None
--- /dev/null
+import SCons.Builder
+
+def create(target, source, env):
+ file(str(target[0]), 'w').write(source[0].get_contents()+"\n")
+
+def generate(env):
+ env['BUILDERS']['CreateFile'] = SCons.Builder.Builder(action = create)
+
+def exists(env):
+ return True
ENVVAR_RE = re.compile(r"\$\(([0-9A-Za-z_-]+)\)")
- def __init__(self, path, env, include_path=None, items = None):
+ def __init__(self, node, env, include_path=None, items = None):
+ self._node = node
self._env = env
self._include_path = include_path or []
- self._lexer = DoxyfileLexer(file(path))
- self._dir = os.path.split(path)[0]
+ self._lexer = DoxyfileLexer(file(node.srcnode().get_path()))
+ self._dir = node.dir
self._items = items or {}
def parse(self):
p = os.path.join(d,value[0])
if os.path.exists(p):
self._items.setdefault('@INCLUDE',[]).append(p)
- parser = DoxyfileParser(p, self._env, self._include_path, self._items)
+ parser = DoxyfileParser(self._node.File(p), self._env, self._include_path, self._items)
parser.parse()
return
def items(self):
return self._items
-def DoxyfileParse(env,file):
+def DoxyfileParse(env,node):
# We don't parse source files which do not contain the word 'doxyfile'. SCons will
# pass other dependencies to DoxyfileParse which are not doxyfiles ... grmpf ...
- if not 'doxyfile' in file.lower():
- return {}
ENV = {}
ENV.update(env.get("ENV",{}))
ENV.update(env.get("DOXYENV", {}))
- parser = DoxyfileParser(file,ENV)
+ parser = DoxyfileParser(node,ENV)
try:
parser.parse()
except ValueError, v:
sources = []
basedir = node.dir.abspath
- data = DoxyfileParse(env, node.abspath)
+ data = DoxyfileParse(env, node)
recursive = data.get("RECURSIVE", "NO").upper()=="YES"
file_patterns = data.get("FILE_PATTERNS", default_file_patterns)
exclude_patterns = data.get("EXCLUDE_PATTERNS", default_exclude_patterns)
def DoxySourceScanCheck(node, env):
"""Check if we should scan this file"""
- return os.path.isfile(node.path)
+ return os.path.isfile(node.path) and 'doxyfile' in node.name.lower()
def DoxyEmitter(source, target, env):
"""Doxygen Doxyfile emitter"""
"XML" : ("NO", "xml"),
}
- data = DoxyfileParse(env, source[0].abspath)
+ data = DoxyfileParse(env, source[0])
targets = []
if data.get("OUTPUT_DIRECTORY",""):
def doxyNodeHtmlDir(env,node):
if not node.sources : return None
- data = DoxyfileParse(env, node.sources[0].abspath)
+ data = DoxyfileParse(env, node.sources[0])
if data.get("GENERATE_HTML",'YES').upper() != 'YES' : return None
return os.path.normpath(os.path.join( node.sources[0].dir.abspath,
data.get("OUTPUT_DIRECTORY","."),
-name doc -prune -o \
-name debian -prune -o \
-name dist -prune -o \
+ -name build -prune -o \
-name "*.a" -o \
-name "*.o" -o \
-name "*~" -o \