2 # \brief SENFSCons package
4 ## \package senfscons.SENFSCons
5 # \brief Build helpers and utilities
7 # The SENFSCons package contains a number of build helpers and
8 # utilities which are used to simplify commmon tasks.
10 # The utitlities of this package are grouped into:
11 # <dl><dt>\ref use</dt><dd>help using complex environments and
12 # configure the construction environmen correspondingly</dd>
14 # <dt>\ref target</dt><dd>simplify building common targest and include
15 # enhanced functionality like unit-testing.</dd></dl>
17 # Additionally for external use are
18 # <dl><dt>MakeEnvironment()</dt><dd>Build construction
21 # <dt>GlobSources()</dt><dd>Utility to find source files</dd></dl>
23 # All other functions are for internal use only.
26 import SCons.Options, SCons.Environment, SCons.Script.SConscript, SCons.Node.FS
27 import SCons.Defaults, SCons.Action
28 from SCons.Script import *
30 ## \defgroup use Predefined Framework Configurators
32 # The following framework configurators are used in the top level \c
33 # SConstruct file to simplify more complex configurations.
35 # Each of the framework configurators introduces additional
36 # configuration parameters to \ref sconfig
38 ## \defgroup target Target Helpers
40 # To specify standard targets, the following helpers can be used. They
41 # automatically integrate several modules (like documentation,
44 ## \defgroup builder Builders
46 # The SENFSCons framework includes a series of builders. Each builder
47 # is defined in it's own package.
49 # Tools to load in MakeEnvironment
62 # This is the directory SENFSCons.py resides
63 basedir = os.path.abspath(os.path.split(__file__)[0])
65 ## \brief Initialize configuration options
69 if opts is not None: return
70 opts = SCons.Options.Options('SConfig')
71 opts.Add('CXX', 'C++ compiler to use', 'g++')
72 opts.Add('EXTRA_DEFINES', 'Additional preprocessor defines', '')
73 opts.Add('EXTRA_LIBS', 'Additional libraries to link against', '')
74 opts.Add('EXTRA_CCFLAGS', 'Additional compilation parameters', '')
75 opts.Add(SCons.Options.BoolOption('final','Enable optimization',0))
76 opts.Add(SCons.Options.BoolOption('debug','Enable debug symbols in binaries',0))
77 opts.Add(SCons.Options.BoolOption('profile','Enable profiling',0))
78 opts.Add('PREFIX', 'Installation prefix', '/usr/local')
79 opts.Add('LIBINSTALLDIR', 'Library install dir', '$PREFIX/lib')
80 opts.Add('BININSTALLDIR', 'Executable install dir', '$PREFIX/bin')
81 opts.Add('INCLUDEINSTALLDIR', 'Include-file install dir', '$PREFIX/include')
82 opts.Add('OBJINSTALLDIR', 'Static object file install dir', '$LIBINSTALLDIR')
83 opts.Add('DOCINSTALLDIR', 'Documentation install dir', '$PREFIX/doc')
84 opts.Add('CPP_INCLUDE_EXTENSIONS', 'File extensions to include in source install',
85 [ '.h', '.hh', '.ih', '.mpp', '.cci', '.ct', '.cti', '.mpp' ])
86 opts.Add('CPP_EXCLUDE_EXTENSIONS', 'File extensions to exclude from source install',
89 # A finalizer is any callable object. All finalizers will be called
90 # in MakeEnvironment. We use them so every finalizer has knowledge of
91 # all frameworks in use (e.g.: the boost runtime depends on the use of
94 ## \brief Register finalizer
100 ## \brief Initialize the use of the <a href="http://www.boost.org/">Boost</a> library
102 # Configure the use of the <a href="http://www.boost.org">Boost</a>
103 # libraries. Most of these libraries are header-only, some however
104 # depend on a built library. The library selection is somewhat
105 # involved and depends on the threading model and the type of build
108 # \par Configuration Parameters:
109 # <table class="senf">
110 # <tr><td>\c BOOST_INCLUDES</td><td>Include directory.</td></tr>
111 # <tr><td>\c BOOST_LIBDIR</td><td>Library directory</td></tr>
112 # <tr><td>\c BOOST_VARIANT</td><td>Complete variant specification</td></tr>
113 # <tr><td>\c BOOST_TOOLSET</td><td>Toolset to use</td></tr>
114 # <tr><td>\c BOOST_RUNTIME</td><td>Runtime to use</td></tr>
115 # <tr><td>\c BOOST_DEBUG_RUNTIME</td><td>Explicit debug runtime</td></tr>
118 # You can either specify \c BOOST_VARIANT explicitly or specify \c
119 # BOOST_TOOLSET and \c BOOST_RUNTIME. If you give \c BOOST_TOOLSET, \c
120 # BOOST_RUNTIME defaults to empty and \c BOOST_DEBUG_RUNTIME defaults
121 # to \c gd, If \c BOOST_TOOLSET is specified and you have included
122 # STLPort support (UseSTLPort()), then \c p is appended to both
125 # The Boost configuration can get realtively complex. If the boost
126 # libraries are provided by the distribution, you probably don't need
127 # to specify any parameters. If your configuration is more complex,
129 # href="http://www.boost.org/tools/build/v2/index.html">Boost.Build</a>
130 # documentation for a definition of the terms used above (toolset,
131 # variant, runtime ...).
137 opts.Add('BOOST_INCLUDES', 'Boost include directory', '')
138 opts.Add('BOOST_VARIANT', 'The boost variant to use', '')
139 opts.Add('BOOST_TOOLSET', 'The boost toolset to use', '')
140 opts.Add('BOOST_RUNTIME', 'The boost runtime to use', '')
141 opts.Add('BOOST_DEBUG_RUNTIME', 'The boost debug runtime to use', '')
142 opts.Add('BOOST_LIBDIR', 'The directory of the boost libraries', '')
143 opts.Add('BOOST_PREFIX', 'The prefix into which boost is installed', '')
144 opts.Add('BOOST_VERSION', 'The version of boost to use', '')
145 Finalizer(FinalizeBoost)
147 ## \brief Finalize Boost environment
149 def FinalizeBoost(env):
150 env.Tool('BoostUnitTests', [basedir])
152 if env['BOOST_TOOLSET']:
154 if env['final'] : runtime += env.get('BOOST_RUNTIME','')
155 else : runtime += env.get('BOOST_DEBUG_RUNTIME','gd')
156 if env['STLPORT_LIB'] : runtime += "p"
157 if runtime: runtime = "-" + runtime
158 env['BOOST_VARIANT'] = "-" + env['BOOST_TOOLSET'] + runtime
160 if env['BOOST_VARIANT'] and env['BOOST_VERSION']:
161 env['BOOST_VARIANT'] = env['BOOST_VARIANT'] + '-%s' % env['BOOST_VERSION'].replace('.','_')
163 env['BOOSTTESTLIB'] = 'boost_unit_test_framework' + env['BOOST_VARIANT']
164 env['BOOSTREGEXLIB'] = 'boost_regex' + env['BOOST_VARIANT']
165 env['BOOSTFSLIB'] = 'boost_filesystem' + env['BOOST_VARIANT']
166 env['BOOSTIOSTREAMSLIB'] = 'boost_iostreams' + env['BOOST_VARIANT']
167 env['BOOSTSIGNALSLIB'] = 'boost_signals' + env['BOOST_VARIANT']
169 if env['BOOST_PREFIX']:
170 env['BOOST_LIBDIR'] = os.path.join(env['BOOST_PREFIX'], 'lib')
171 env['BOOST_INCLUDES'] = os.path.join(env['BOOST_PREFIX'],
173 % env['BOOST_VERSION'].replace('.','_'))
175 env.Append(LIBPATH = [ '$BOOST_LIBDIR' ],
176 CPPPATH = [ '$BOOST_INCLUDES' ])
178 if env['BOOST_LIBDIR']:
179 env.Append(ENV = { 'LD_LIBRARY_PATH': env['BOOST_LIBDIR'] })
181 ## \brief Use STLPort as STL replacement if available
183 # Use <a href="http://www.stlport.org">STLPort</a> as a replacement
184 # for the system STL. STLPort has the added feature of providing fully
185 # checked containers and iterators. This can greatly simplify
186 # debugging. However, STLPort and Boost interact in a non-trivial way
187 # so the configuration is relatively complex. This command does not
188 # enforce the use of STLPort, it is only used if available.
190 # \par Configuration Parameters:
191 # <table class="senf">
192 # <tr><td>\c STLPORT_INCLUDES</td><td>Include directory.</td></tr>
193 # <tr><td>\c STLPORT_LIBDIR</td><td>Library directory</td></tr>
194 # <tr><td>\c STLPORT_LIB</td><td>Name of STLPort library</td></tr>
195 # <tr><td>\c STLPORT_DEBUGLIB</td><td>Name of STLPort debug library</td></tr>
198 # If \c STLPORT_LIB is specified, \c STLPORT_DEBUGLIB defaults to \c
199 # STLPORT_LIB with \c _stldebug appended. The STLPort library will
200 # only be used, if \c STLPORT_LIB is set in \c SConfig.
206 opts.Add('STLPORT_INCLUDES', 'STLport include directory', '')
207 opts.Add('STLPORT_LIB', 'Name of the stlport library or empty to not use stlport', '')
208 opts.Add('STLPORT_DEBUGLIB', 'Name of the stlport debug library','')
209 opts.Add('STLPORT_LIBDIR', 'The directory of the stlport libraries','')
210 Finalizer(FinalizeSTLPort)
214 ## \brief Finalize STLPort environment
216 def FinalizeSTLPort(env):
217 if env['STLPORT_LIB']:
218 if not env['STLPORT_DEBUGLIB']:
219 env['STLPORT_DEBUGLIB'] = env['STLPORT_LIB'] + '_stldebug'
220 env.Append(LIBPATH = [ '$STLPORT_LIBDIR' ],
221 CPPPATH = [ '$STLPORT_INCLUDES' ])
223 env.Append(LIBS = [ '$STLPORT_LIB' ])
225 env.Append(LIBS = [ '$STLPORT_DEBUGLIB' ],
226 CPPDEFINES = [ '_STLP_DEBUG' ])
228 ## \brief Build a configured construction environment
230 # This function is called after all frameworks are specified to build
231 # a tailored construction environment. You can then use this
232 # construction environment just like an ordinary SCons construction
233 # environment (which it is ...)
235 # This call will set some default compilation parameters depending on
236 # the \c final command line option: specifying <tt>final=1</tt> will
237 # built a release version of the code.
238 def MakeEnvironment():
239 global opts, finalizers
241 env = SCons.Environment.Environment(options=opts)
242 env.Replace(**SCons.Script.SConscript.Arguments)
243 #for opt in opts.options:
244 # if SCons.Script.SConscript.Arguments.get(opt.key):
245 # env[opt.key] = SCons.Script.SConscript.Arguments.get(opt.key)
246 #if SCons.Script.SConscript.Arguments.get('final'):
248 env.Help("\nSupported build variables (either in SConfig or on the command line:\n")
249 env.Help(opts.GenerateHelpText(env))
251 # We want to pass the SSH_AUTH_SOCK system env-var so we can ssh
252 # into other hosts from within SCons rules. I have used rules like
253 # this e.g. to automatically install stuff on a remote system ...
254 if os.environ.has_key('SSH_AUTH_SOCK'):
255 env.Append( ENV = { 'SSH_AUTH_SOCK': os.environ['SSH_AUTH_SOCK'] } )
257 for finalizer in finalizers:
260 for tool in SCONS_TOOLS:
261 env.Tool(tool, [basedir])
263 # These are the default compilation parameters. We should probably
264 # make these configurable
265 env.Append(LOCALLIBDIR = [ '#' ],
266 LIBPATH = [ '$LOCALLIBDIR' ])
269 env.Append(CXXFLAGS = [ '-O3' ])
271 env.Append(CXXFLAGS = [ '-g', '-pg' ],
272 LINKFLAGS = [ '-g', '-pg' ])
274 # The boost-regex library is not compiled with _GLIBCXX_DEBUG so this fails:
275 # CPPDEFINES = [ '_GLIBCXX_DEBUG' ],
276 env.Append(CXXFLAGS = [ '-O0', '-g' ],
277 CPPDEFINES = { 'SENF_DEBUG': ''})
279 env.Append(CXXFLAGS = [ '-pg' ],
280 LINKFLAGS = [ '-pg' ])
281 if env['debug'] or env['profile']:
282 env.Append(LINKFLAGS = [ '-g', '-rdynamic' ])
284 env.Append(LINKFLAGS = [ '-Wl,-S', '-rdynamic' ])
286 env.Append(CPPDEFINES = [ '$EXTRA_DEFINES' ],
287 LIBS = [ '$EXTRA_LIBS' ],
288 CXXFLAGS = [ '$EXTRA_CCFLAGS' ],
293 ## \brief Find normal and test C++ sources
295 # GlobSources() will return a list of all C++ source files (named
296 # "*.cc") as well as a list of all unit-test files (named "*.test.cc")
297 # in the current directory. The sources will be returned as a tuple of
298 # sources, test-sources. The target helpers all accept such a tuple as
299 # their source argument.
300 def GlobSources(env, exclude=[], subdirs=[]):
301 testSources = glob.glob("*.test.cc")
302 sources = [ x for x in glob.glob("*.cc") if x not in testSources and x not in exclude ]
303 for subdir in subdirs:
304 testSources += glob.glob(os.path.join(subdir,"*.test.cc"))
305 sources += [ x for x in glob.glob(os.path.join(subdir,"*.cc"))
306 if x not in testSources and x not in exclude ]
307 return (sources, testSources)
309 def GlobIncludes(env, exclude=[], subdirs=[]):
311 for d in [ '.' ] + subdirs:
312 for f in os.listdir(d):
313 ext = '.' + f.split('.',1)[-1]
314 p = os.path.join(d,f)
315 if ext in env['CPP_INCLUDE_EXTENSIONS'] \
316 and ext not in env['CPP_EXCLUDE_EXTENSIONS'] \
317 and p not in exclude:
321 def Glob(env, exclude=[], subdirs=[]):
322 return ( GlobSources(env, exclude, subdirs),
323 GlobIncludes(env, exclude, subdirs) )
325 ## \brief Add generic standard targets for every module
327 # This target helper should be called in the top-level \c SConstruct file
328 # as well as in every module \c SConscipt file. It adds general
329 # targets. Right now, these are
330 # \li clean up \c .sconsign, \c .sconf_temp and \c config.log on
331 # <tt>scons -c all</tt>
334 def StandardTargets(env):
335 env.Clean(env.Alias('all'), [ '.sconsign', '.sconf_temp', 'config.log' ])
337 ## \brief Add generic global targets
339 # This target helper should be called in the top-level \c SConstruct
340 # file. It adds general global targets. Right now theese are
341 # \li Make <tt>scons all</tt> build all targets.
344 def GlobalTargets(env):
345 env.Alias('all', [ 'default', 'all_tests', 'all_docs' ])
347 ## \brief Return path of a built library within $LOCALLIBDIR
349 def LibPath(lib): return '${LOCALLIBDIR}/${LIBPREFIX}%s${LIBADDSUFFIX}${LIBSUFFIX}' % lib
351 ## \brief Add explicit test
353 # This target helper will add an explicit test. This is like a unit test but is
354 # built directly against the completed library
357 def Test(env, sources, LIBS = [], OBJECTS = []):
358 test = [ env.BoostUnitTests(
361 test_sources = sources,
362 LIBS = [ '$LIBSENF$LIBADDSUFFIX' ],
364 DEPENDS = [ env.File(LibPath(env['LIBSENF'])) ]) ]
365 compileTestSources = [ src for src in sources
366 if 'COMPILE_CHECK' in file(src).read() ]
367 if compileTestSources:
368 test.extend(env.CompileCheck(source = compileTestSources))
369 env.Alias('all_tests', test)
370 env.Command(env.File('test'), test, [ 'true' ])
371 #env.Alias(env.File('test'), test)
374 ## \brief Build object files
376 # This target helper will build object files from the given
379 # If \a testSources are given, a unit test will be built using the <a
380 # href="http://www.boost.org/libs/test/doc/index.html">Boost.Test</a>
381 # library. \a LIBS may specify any additional library modules <em>from
382 # the same project</em> on which the test depends. Those libraries
383 # will be linked into the final test executable. The test will
384 # automatically be run if the \c test or \c all_tests targets are
387 # If \a sources is a 2-tuple as returned by GlobSources(), it will
388 # provide both \a sources and \a testSources.
391 def Objects(env, sources, testSources = None, OBJECTS = []):
392 if type(sources) == type(()):
393 testSources = sources[1]
395 if type(sources) is not type([]):
396 sources = [ sources ]
401 for source in sources
402 if type(source) is type('') and not source.endswith('.o') ]
404 for source in sources
405 if type(source) is not type('') or source.endswith('.o') ]
407 objects += env.Object(obsources)
410 test = [ env.BoostUnitTests(
413 test_sources = testSources,
414 LIBS = [ '$LIBSENF$LIBADDSUFFIX' ],
416 DEPENDS = [ env.File(LibPath(env['LIBSENF'])) ]) ]
417 compileTestSources = [ src for src in testSources
418 if 'COMPILE_CHECK' in file(src).read() ]
419 if compileTestSources:
420 test.extend(env.CompileCheck(source = compileTestSources))
421 env.Alias('all_tests', test)
422 # Hmm ... here I'd like to use an Alias instead of a file
423 # however the alias does not seem to live in the subdirectory
424 # which breaks 'scons -u test'
425 env.Command(env.File('test'), test, [ 'true' ])
426 #env.Alias(env.File('test'), test)
430 def InstallIncludeFiles(env, files):
431 # Hrmpf ... why do I need this in 0.97??
432 if env.GetOption('clean'):
434 target = env.Dir(env['INCLUDEINSTALLDIR'])
438 env.Alias('install_all', env.Install(target.Dir(src.dir.get_path(base)), src))
440 ## \brief Build documentation with doxygen
442 # The doxygen target helper will build software documentation using
443 # the given \a doxyfile (which defaults to \c Doxyfile). The Doxygen
444 # builder used supports automatic dependency generation (dependencies
445 # are automatically generated from the parameters specified in the \a
446 # doxyfile), automatic target emitters (the exact targets created are
447 # found parsing the \a doxyfile) and lots of other features. See the
448 # Doxygen builder documentation
450 # If \a extra_sources are given, the generated documentation will
451 # depend on them. This can be used to build images or other
452 # supplementary files.
454 # The doxygen target helper extends the builder with additional
457 # \li Fix tagfiles by removing namespace entries. These entries only
458 # work for namespaces completely defined in a single module. As
459 # soon as another module (which references the tagfile) has it's
460 # own members in that namespace, the crosslinking will break.
461 # \li If \c DOXY_HTML_XSL is defined as a construction environment
462 # variable, preprocess all generated html files (if html files are
463 # generated) by the given XSLT stylesheet. Since the HTML
464 # generated by doxygen is broken, we first filter the code through
465 # HTML-\c tidy and filter out some error messages.
466 # \li If xml output is generated we create files \c bug.xmli and \c
467 # todo.xmli which contain all bugs and todo items specified in the
468 # sources. The format of these files is much more suited to
469 # postprocessing and is a more database like format as the doxygen
470 # generated files (which are more presentation oriented). if \c
471 # DOXY_XREF_TYPES is given, it will specify the cross reference
472 # types to support (defaults to \c bug and \c todo). See <a
473 # href="http://www.stack.nl/~dimitri/doxygen/commands.html#cmdxrefitem">\xrefitem</a>
474 # in the doxygen documentation.
477 def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []):
478 if not 'all' in BUILD_TARGETS and not 'doc' in BUILD_TARGETS and not 'all_docs' in BUILD_TARGETS:
480 # ARGHHH !!! without the [:] we are changing the target list
481 # ||| WITHIN THE DOXYGEN BUILDER
482 docs = env.Doxygen(doxyfile)[:]
487 if isinstance(doc,SCons.Node.FS.Dir): continue
488 if doc.name == 'xml.stamp' : xmlnode = doc
489 if doc.name == 'html.stamp' : htmlnode = doc
490 if doc.name == 'search.idx' : continue
491 if os.path.splitext(doc.name)[1] == '.stamp' : continue # ignore other file stamps
492 # otherwise it must be the tag file
496 # Postprocess the tag file to remove the (broken) namespace
500 SCons.Action.Action("xsltproc --nonet -o %(target)s.temp %(template)s %(target)s && mv %(target)s.temp %(target)s"
501 % { 'target': tagnode.abspath,
502 'template': os.path.join(basedir,"tagmunge.xsl") }))
504 if htmlnode and env.get('DOXY_HTML_XSL'):
505 xslfile = env.File(env['DOXY_HTML_XSL'])
506 reltopdir = '../' * len(htmlnode.dir.abspath[len(env.Dir('#').abspath)+1:].split('/'))
507 if reltopdir : reltopdir = reltopdir[:-1]
508 else : reltopdir = '.'
511 SCons.Action.Action(("for html in %s/*.html; do " +
513 " mv $${html} $${html}.orig;" +
514 " sed -e 's/id=\"current\"/class=\"current\"/' $${html}.orig" +
515 " | tidy -ascii -q --wrap 0 --show-warnings no --fix-uri no " +
516 " | sed -e 's/name=\"\([^\"]*\)\"\([^>]*\) id=\"\\1\"/name=\"\\1\"\\2/g'" +
517 " | xsltproc --novalid --nonet --html --stringparam topdir %s -o $${html} %s -;"
519 % (htmlnode.dir.abspath, reltopdir, xslfile.abspath)))
521 env.Depends(doc, xslfile)
525 for type in env.get("DOXY_XREF_TYPES",[ "bug", "todo" ]):
526 xref = os.path.join(xmlnode.dir.abspath,type+".xml")
527 xref_pp = env.Command(xref+'i', [ xref, os.path.join(basedir,'xrefxtract.xslt'), xmlnode ],
528 [ "test -s $SOURCE && xsltproc --nonet -o $TARGET" +
529 " --stringparam module $MODULE" +
530 " --stringparam type $TYPE" +
531 " ${SOURCES[1]} $SOURCE || touch $TARGET" ],
532 MODULE = xmlnode.dir.dir.dir.abspath[
533 len(env.Dir('#').abspath)+1:],
535 env.SideEffect(xref, xmlnode)
536 env.AddPreAction(docs, "rm -f %s" % (xref,))
537 env.AddPostAction(docs, "test -r %s || touch %s" % (xref,xref))
538 xrefs.extend(xref_pp)
541 if extra_sources and htmlnode:
543 [ env.CopyToDir( source=source, target=htmlnode.dir )
544 for source in extra_sources ])
546 if extra_sources and xmlnode:
548 [ env.CopyToDir( source=source, target=xmlnode.dir )
549 for source in extra_sources ])
551 if not htmlnode and not xmlnode:
552 env.Depends(docs, extra_sources)
555 env.Alias('all_docs', doc)
556 env.Clean('all_docs', doc)
557 env.Clean('all', doc)
559 l = len(env.Dir('#').abspath)
561 env.Alias('install_all',
562 env.Command('$DOCINSTALLDIR' + htmlnode.dir.abspath[l:], htmlnode.dir,
563 [ SCons.Defaults.Copy('$TARGET','$SOURCE') ]))
565 env.Alias('install_all',
566 env.Install( '$DOCINSTALLDIR' + tagnode.dir.abspath[l:],
571 ## \brief Build combined doxygen cross-reference
573 # This command will build a complete cross-reference of \c xrefitems
574 # accross all modules.
576 # Right now, this command is very project specific. It needs to be
580 def DoxyXRef(env, docs=None,
581 HTML_HEADER = None, HTML_FOOTER = None,
582 TITLE = "Cross-reference of action points"):
584 docs = env.Alias('all_docs')[0].sources
585 xrefs = [ doc for doc in docs if os.path.splitext(doc.name)[1] == ".xmli" ]
586 xref = env.Command("doc/html/xref.xml", xrefs,
587 [ "echo '<?xml version=\"1.0\"?>' > $TARGET",
588 "echo '<xref>' >> $TARGET",
589 "cat $SOURCES >> $TARGET",
590 "echo '</xref>' >>$TARGET" ])
592 # Lastly we create the html file
593 sources = [ xref, "%s/xrefhtml.xslt" % basedir ]
594 if HTML_HEADER : sources.append(HTML_HEADER)
595 if HTML_FOOTER : sources.append(HTML_FOOTER)
599 commands.append("sed" +
600 " -e 's/\\$$title/$TITLE/g'" +
601 " -e 's/\\$$projectname/Overview/g'" +
602 " ${SOURCES[2]} > $TARGET")
603 commands.append("xsltproc" +
604 " --stringparam title '$TITLE'" +
605 " --stringparam types '$DOXY_XREF_TYPES'" +
606 " ${SOURCES[1]} $SOURCE >> $TARGET")
609 "sed -e 's/\\$$title/$TITLE/g' -e 's/\\$$projectname/Overview/g' ${SOURCES[%d]} >> $TARGET"
610 % (HTML_HEADER and 3 or 2))
612 if env.get('DOXY_HTML_XSL'):
613 xslfile = env.File(env['DOXY_HTML_XSL'])
614 reltopdir = '../' * len(xref[0].dir.abspath[len(env.Dir('#').abspath)+1:].split('/'))
615 if reltopdir : reltopdir = reltopdir[:-1]
616 else : reltopdir = '.'
617 commands.append(("xsltproc -o ${TARGET}.tmp" +
619 " --stringparam topdir %s" +
620 " ${SOURCES[-1]} $TARGET 2>/dev/null")
622 commands.append("mv ${TARGET}.tmp ${TARGET}")
623 sources.append(xslfile)
625 xref = env.Command("doc/html/xref.html", sources, commands,
628 env.Alias('all_docs',xref)
632 ## \brief Build library
634 # This target helper will build the given library. The library will be
635 # called lib<i>library</i>.a as is customary on UNIX systems. \a
636 # sources, \a testSources and \a LIBS are directly forwarded to the
637 # Objects build helper.
639 # The library is added to the list of default targets.
642 def Lib(env, sources, testSources = None, OBJECTS = []):
643 objects = Objects(env,sources,testSources,OBJECTS=OBJECTS)
645 env.Append(ALLOBJECTS = objects)
648 ## \brief Build Object from multiple sources
649 def Object(env, target, sources, testSources = None, OBJECTS = []):
650 objects = Objects(env,sources,testSources,OBJECTS=OBJECTS)
653 ob = env.Command(target+"${OBJADDSUFFIX}${OBJSUFFIX}", objects, "ld -r -o $TARGET $SOURCES")
655 env.Alias('default', ob)
656 env.Alias('install_all', env.Install("$OBJINSTALLDIR", ob))
659 ## \brief Build executable
661 # This target helper will build the given binary. The \a sources, \a
662 # testSources and \a LIBS arguments are forwarded to the Objects
663 # builder. The final program will be linked against all the library
664 # modules specified in \a LIBS (those are libraries which are built as
665 # part of the same proejct). To specify non-module libraries, use the
666 # construction environment parameters or the framework helpers.
669 def Binary(env, binary, sources, testSources = None, OBJECTS = []):
670 objects = Objects(env,sources,testSources,OBJECTS=OBJECTS)
673 progEnv = env.Clone()
674 progEnv.Prepend(LIBS = [ '$LIBSENF$LIBADDSUFFIX' ])
675 program = progEnv.ProgramNoScan(target=binary,source=objects+OBJECTS)
677 env.Depends(program, [ env.File(LibPath(env['LIBSENF'])) ])
678 env.Alias('default', program)
679 env.Alias('install_all', env.Install('$BININSTALLDIR', program))
682 def AllIncludesHH(env, headers):
684 target = env.File("all_includes.hh")
685 file(target.abspath,"w").write("".join([ '#include "%s"\n' % f
687 env.Clean('all', target)