Completely rework documentation build
[senf.git] / senfscons / SENFSCons.py
1 ## \file
2 # \brief SENFSCons package
3
4 ## \package senfscons.SENFSCons
5 # \brief Build helpers and utilities
6 #
7 # The SENFSCons package contains a number of build helpers and
8 # utilities which are used to simplify commmon tasks.
9 #
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>
13 #
14 # <dt>\ref target</dt><dd>simplify building common targest and include
15 # enhanced functionality like unit-testing.</dd></dl>
16 #
17 # Additionally for external use are
18 # <dl><dt>MakeEnvironment()</dt><dd>Build construction
19 # environment</dd>
20 #
21 # <dt>GlobSources()</dt><dd>Utility to find source files</dd></dl>
22 #
23 # All other functions are for internal use only.
24
25 import os.path, glob
26 import SCons.Options, SCons.Environment, SCons.Script.SConscript, SCons.Node.FS
27 import SCons.Defaults, SCons.Action
28 from SCons.Script import *
29
30 ## \defgroup use Predefined Framework Configurators
31 #
32 # The following framework configurators are used in the top level \c
33 # SConstruct file to simplify more complex configurations.
34 #
35 # Each of the framework configurators introduces additional
36 # configuration parameters to \ref sconfig
37
38 ## \defgroup target Target Helpers
39 #
40 # To specify standard targets, the following helpers can be used. They
41 # automatically integrate several modules (like documentation,
42 # unit-testing etc).
43
44 ## \defgroup builder Builders
45 #
46 # The SENFSCons framework includes a series of builders. Each builder
47 # is defined in it's own package.
48
49 # Tools to load in MakeEnvironment
50 SCONS_TOOLS = [
51     "Doxygen",
52     "Dia2Png",
53     "PkgDraw",
54     "CopyToDir",
55     "ProgramNoScan",
56     "CompileCheck",
57 ]
58
59 opts = None
60 finalizers = []
61
62 # This is the directory SENFSCons.py resides
63 basedir = os.path.abspath(os.path.split(__file__)[0])
64
65 ## \brief Initialize configuration options
66 # \internal
67 def InitOpts():
68     global opts
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',
87              [ '.test.hh' ])
88
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
92 # stlport).
93
94 ## \brief Register finalizer
95 # \internal
96 def Finalizer(f):
97     global finalizers
98     finalizers.append(f)
99
100 ## \brief Initialize the use of the <a href="http://www.boost.org/">Boost</a> library
101 #
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
106 # (debug or final).
107 #
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>
116 #     </table>
117 #
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
123 # runtimes.
124 #
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,
128 # refer to the <a
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 ...).
132 #
133 # \ingroup use
134 def UseBoost():
135     global opts
136     InitOpts()
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)
146
147 ## \brief Finalize Boost environment
148 # \internal
149 def FinalizeBoost(env):
150     env.Tool('BoostUnitTests', [basedir])
151
152     if env['BOOST_TOOLSET']:
153         runtime = ""
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
159
160     if env['BOOST_VARIANT'] and env['BOOST_VERSION']:
161         env['BOOST_VARIANT'] = env['BOOST_VARIANT'] + '-%s' % env['BOOST_VERSION'].replace('.','_')
162
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']
168
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'],
172                                              'include/boost-%s'
173                                                  % env['BOOST_VERSION'].replace('.','_'))
174
175     env.Append(LIBPATH = [ '$BOOST_LIBDIR' ],
176                CPPPATH = [ '$BOOST_INCLUDES' ])
177
178     if env['BOOST_LIBDIR']:
179         env.Append(ENV = { 'LD_LIBRARY_PATH': env['BOOST_LIBDIR'] })
180
181 ## \brief Use STLPort as STL replacement if available
182 #
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.
189 #
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>
196 #     </table>
197 #
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.
201 #
202 # \ingroup use
203 def UseSTLPort():
204     global opts
205     InitOpts()
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)
211
212 # \}
213
214 ## \brief Finalize STLPort environment
215 # \internal
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' ])
222         if env['final']:
223             env.Append(LIBS = [ '$STLPORT_LIB' ])
224         else:
225             env.Append(LIBS = [ '$STLPORT_DEBUGLIB' ],
226                        CPPDEFINES = [ '_STLP_DEBUG' ])
227
228 ## \brief Build a configured construction environment
229 #
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 ...)
234 #
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
240     InitOpts()
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'):
247     #    env['final'] = 1
248     env.Help("\nSupported build variables (either in SConfig or on the command line:\n")
249     env.Help(opts.GenerateHelpText(env))
250
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'] } )
256
257     for finalizer in finalizers:
258         finalizer(env)
259
260     for tool in SCONS_TOOLS:
261         env.Tool(tool, [basedir])
262
263     # These are the default compilation parameters. We should probably
264     # make these configurable
265     env.Append(LOCALLIBDIR = [ '#' ],
266                LIBPATH = [ '$LOCALLIBDIR' ])
267
268     if env['final']:
269         env.Append(CXXFLAGS = [ '-O3' ])
270         if env['profile']:
271             env.Append(CXXFLAGS = [ '-g', '-pg' ],
272                        LINKFLAGS = [ '-g', '-pg' ])
273     else:
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': ''})
278         if env['profile']:
279             env.Append(CXXFLAGS = [ '-pg' ],
280                        LINKFLAGS = [ '-pg' ])
281         if env['debug'] or env['profile']:
282             env.Append(LINKFLAGS = [ '-g', '-rdynamic' ])
283         else:
284             env.Append(LINKFLAGS = [ '-Wl,-S', '-rdynamic' ])
285
286     env.Append(CPPDEFINES = [ '$EXTRA_DEFINES' ],
287                LIBS = [ '$EXTRA_LIBS' ],
288                CXXFLAGS = [ '$EXTRA_CCFLAGS' ],
289                ALLOBJECTS = [])
290
291     return env
292
293 ## \brief Find normal and test C++ sources
294 #
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)
308
309 def GlobIncludes(env, exclude=[], subdirs=[]):
310     includes = []
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:
318                 includes.append(p)
319     return includes
320
321 def Glob(env, exclude=[], subdirs=[]):
322     return ( GlobSources(env, exclude, subdirs),
323              GlobIncludes(env, exclude, subdirs) )
324
325 ## \brief Add generic standard targets for every module
326 #
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>
332 #
333 # \ingroup target
334 def StandardTargets(env):
335     env.Clean(env.Alias('all'), [ '.sconsign', '.sconf_temp', 'config.log' ])
336
337 ## \brief Add generic global targets
338 #
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.
342 #
343 # \ingroup target
344 def GlobalTargets(env):
345     env.Alias('all', [ 'default', 'all_tests', 'all_docs' ])
346
347 ## \brief Return path of a built library within $LOCALLIBDIR
348 # \internal
349 def LibPath(lib): return '${LOCALLIBDIR}/${LIBPREFIX}%s${LIBADDSUFFIX}${LIBSUFFIX}' % lib
350
351 ## \brief Add explicit test
352 #
353 # This target helper will add an explicit test. This is like a unit test but is
354 # built directly against the completed library
355 #
356 # \ingroup target
357 def Test(env, sources, LIBS = [], OBJECTS = []):
358     test = [ env.BoostUnitTests(
359         target = 'test',
360         objects = [],
361         test_sources = sources,
362         LIBS = [ '$LIBSENF$LIBADDSUFFIX' ],
363         OBJECTS = OBJECTS,
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)
372     
373
374 ## \brief Build object files
375 #
376 # This target helper will build object files from the given
377 # sources.
378 #
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
385 # given.
386 #
387 # If \a sources is a 2-tuple as returned by GlobSources(), it will
388 # provide both \a sources and \a testSources.
389 #
390 # \ingroup target
391 def Objects(env, sources, testSources = None, OBJECTS = []):
392     if type(sources) == type(()):
393         testSources = sources[1]
394         sources = sources[0]
395     if type(sources) is not type([]):
396         sources = [ sources ]
397
398     objects = None
399     if sources:
400         obsources = [ source
401                       for source in sources
402                       if type(source) is type('') and not source.endswith('.o') ]
403         objects = [ source
404                     for source in sources
405                     if type(source) is not type('') or source.endswith('.o') ]
406         if obsources:
407             objects += env.Object(obsources)
408
409     if testSources:
410         test = [ env.BoostUnitTests(
411             target = 'test',
412             objects = objects,
413             test_sources = testSources,
414             LIBS = [ '$LIBSENF$LIBADDSUFFIX' ],
415             OBJECTS = OBJECTS,
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)
427
428     return objects
429
430 def InstallIncludeFiles(env, files):
431     # Hrmpf ... why do I need this in 0.97??
432     if env.GetOption('clean'):
433         return
434     target = env.Dir(env['INCLUDEINSTALLDIR'])
435     base = env.Dir('#')
436     for f in files:
437         src = env.File(f)
438         env.Alias('install_all', env.Install(target.Dir(src.dir.get_path(base)), src))
439
440 ## \brief Build documentation with doxygen
441 #
442 # \ingroup target
443 def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []):
444     # There is one small problem we need to solve with this builder: The Doxygen builder reads
445     # the Doxyfile and thus depends on the environment variables set by doclib/doxygen.sh. We
446     # thus have to provide all necessary definitions here manually via DOXYENV !
447
448     if type(doxyfile) is type(""):
449         doxyfile = env.File(doxyfile)
450
451     # Module name is derived from the doxyfile path
452     # Utils/Console/Doxyfile -> Utils_Console
453     module = doxyfile.dir.abspath[len(env.Dir('#').abspath)+1:].replace('/','_')
454     if not module : module = "Main"
455
456     # Rule to generate tagfile
457     # (need to exclude the 'clean' case, otherwise we'll have duplicate nodes)
458     if not env.GetOption('clean'):
459         env.Append(ALL_TAGFILES =
460                    env.Doxygen(doxyfile,
461                                DOXYOPTS = [ '--tagfile-name', '"${MODULE}.tag"',
462                                             '--tagfile' ],
463                                DOXYENV  = { 'TOPDIR'          : env.Dir('#').abspath,
464                                             'output_dir'      : 'doc',
465                                             'html_dir'        : 'html',
466                                             'html'            : 'NO',
467                                             'generate_tagfile': 'doc/${MODULE}.tag' },
468                                MODULE   = module )[0].abspath)
469
470     # Rule to generate HTML documentation
471     doc = env.Doxygen(doxyfile,
472                       DOXYOPTS = [ '--tagfiles', '"$ALL_TAGFILES"',
473                                    '--tagfile-name', '"${MODULE}.tag"',
474                                    '--html' ],
475                       MODULE   = module,
476                       DOXYENV  = { 'TOPDIR'          : env.Dir('#').abspath,
477                                    'tagfiles'        : '${ALL_TAGFILES}',
478                                    'output_dir'      : 'doc',
479                                    'html_dir'        : 'html',
480                                    'html'            : 'YES' } )
481
482     # Copy the extra_sources (the images) into the documentation directory
483     # (need to exclude the 'clean' case otherwise there are multiple ways to clean the copies)
484     if not env.GetOption('clean'):
485         if extra_sources:
486             env.Depends(doc,
487                         [ env.CopyToDir( source=source, target=doc[0].dir )
488                           for source in extra_sources ])
489
490     # Install documentation into DOCINSTALLDIR
491     l = len(env.Dir('#').abspath)
492     env.Alias('install_all',
493               env.Command('$DOCINSTALLDIR' + doc[0].dir.abspath[l:], doc[0].dir,
494                           [ SCons.Defaults.Copy('$TARGET','$SOURCE') ]))
495
496     # Useful aliases
497     env.Alias('all_docs', doc)
498     env.Clean('all_docs', doc)
499     env.Clean('all', doc)
500
501     return doc
502
503 ## \brief Build library
504 #
505 # This target helper will build the given library. The library will be
506 # called lib<i>library</i>.a as is customary on UNIX systems. \a
507 # sources, \a testSources and \a LIBS are directly forwarded to the
508 # Objects build helper.
509 #
510 # The library is added to the list of default targets.
511 #
512 #\ingroup target
513 def Lib(env, sources, testSources = None, OBJECTS = []):
514     objects = Objects(env,sources,testSources,OBJECTS=OBJECTS)
515     if objects:
516         env.Append(ALLOBJECTS = objects)
517     return objects
518
519 ## \brief Build Object from multiple sources
520 def Object(env, target, sources, testSources = None, OBJECTS = []):
521     objects = Objects(env,sources,testSources,OBJECTS=OBJECTS)
522     ob = None
523     if objects:
524         ob = env.Command(target+"${OBJADDSUFFIX}${OBJSUFFIX}", objects, "ld -r -o $TARGET $SOURCES")
525         env.Default(ob)
526         env.Alias('default', ob)
527         env.Alias('install_all', env.Install("$OBJINSTALLDIR", ob))
528     return ob
529
530 ## \brief Build executable
531 #
532 # This target helper will build the given binary.  The \a sources, \a
533 # testSources and \a LIBS arguments are forwarded to the Objects
534 # builder. The final program will be linked against all the library
535 # modules specified in \a LIBS (those are libraries which are built as
536 # part of the same proejct). To specify non-module libraries, use the
537 # construction environment parameters or the framework helpers.
538 #
539 # \ingroup target
540 def Binary(env, binary, sources, testSources = None, OBJECTS = []):
541     objects = Objects(env,sources,testSources,OBJECTS=OBJECTS)
542     program = None
543     if objects:
544         progEnv = env.Clone()
545         progEnv.Prepend(LIBS = [ '$LIBSENF$LIBADDSUFFIX' ])
546         program = progEnv.ProgramNoScan(target=binary,source=objects+OBJECTS)
547         env.Default(program)
548         env.Depends(program, [ env.File(LibPath(env['LIBSENF'])) ])
549         env.Alias('default', program)
550         env.Alias('install_all', env.Install('$BININSTALLDIR', program))
551     return program
552
553 def AllIncludesHH(env, headers):
554     headers.sort()
555     target = env.File("all_includes.hh")
556     file(target.abspath,"w").write("".join([ '#include "%s"\n' % f
557                                              for f in headers ]))
558     env.Clean('all', target)