X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2FSENFSCons.py;h=34604142a6037a239f66e33daced5c1f3329f2e4;hb=032707d24b1059febe83ce56b11fd79df106c6e2;hp=bed67e0bf7f342438669f0bc469a698e4055cc7b;hpb=9f894848419a22a6a50e6c5ce253f436d164dcd3;p=senf.git diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index bed67e0..3460414 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -1,4 +1,5 @@ -import os.path, SCons.Options, SCons.Environment, SCons.Script.SConscript, glob +import os.path, glob +import SCons.Options, SCons.Environment, SCons.Script.SConscript, SCons.Node.FS, SCons.Defaults SCONS_TOOLS = [ "Doxygen", @@ -113,17 +114,11 @@ def GlobSources(exclude=[]): def StandardTargets(env): all = env.Alias('all') - env.Clean(all, [ '.sconsign', '.sconf_temp', 'config.log', 'ChangeLog.bak', '.clean' - ] + glob.glob("*~")) + env.Clean(all, [ '.sconsign', '.sconf_temp', 'config.log' ]) env.Depends(all, '.') def GlobalTargets(env): - command = "find -name .svn -prune -o \( -name '*.hh' -o -name '*.ih' -o -name '*.cc' -o -name '*.cci' -o -name '*.ct' -o -name '*.cti' -o -name '*.mpp' \) -print " \ - "| xargs -r awk -F '//' '/%s/{print ARGV[ARGIND] \":\" FNR \":\" $2}' > $TARGET" - env.AlwaysBuild(env.Command('TODOS',None,[ command % 'TODO' ])) - env.AlwaysBuild(env.Command('FIXMES',None,[ command % ' FIXME' ])) - env.AlwaysBuild(env.Command('BUGS',None,[ command % 'BUG' ] )) - env.Alias('status',[ 'TODOS', 'FIXMES', 'BUGS' ]) + pass def LibPath(lib): return '$LOCALLIBDIR/lib%s.a' % lib @@ -151,29 +146,90 @@ def Objects(env, sources, testSources = None, LIBS = []): return objects -def DoxyGlob(exclude=[]): - sources = [ f - for ext in ("cci", "ct", "cti", "h", "hh", "ih", "mmc", "dox") - for f in glob.glob("*."+ext) - if f not in exclude ] - return sources - -def Doxygen(env, doxyfile="Doxyfile", extra_sources = []): +def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []): docs = env.Doxygen(doxyfile) - # The last target is the (optional) tagfile - if os.path.basename(str(docs[-1])) != '.stamp': + for doc in docs: + if isinstance(doc,SCons.Node.FS.Dir): continue + if os.path.basename(str(doc)) == '.stamp' : continue # file stamp + # otherwise it must be the tag file + break + else: + doc = None + if doc: # Postprocess the tag file to remove the (broken) namespace # references env.AddPostAction( - docs, - env.Action([ "xsltproc -o ${TARGETS[-1]}.temp %s ${TARGETS[-1]}" + doc, + env.Action([ "xsltproc -o TARGET.temp %s TARGET" % os.path.join(basedir,"tagmunge.xsl"), - "mv ${TARGETS[-1]}.temp ${TARGETS[-1]}" ])) - env.Clean(docs[-1],"$TARGET.temp") + "mv TARGET.temp TARGET" ])) + env.Clean(doc,"$TARGET.temp") env.Depends(docs,extra_sources) - env.Alias('all_docs', *docs) + for doc in docs : + env.Alias('all_docs', doc) + env.Clean('all_docs', doc) + env.Clean('all', doc) return docs +def DoxyXRef(env, + TYPES = ('bug','todo'), + HTML_HEADER = None, HTML_FOOTER = None, + TITLE = "Cross-reference of action points"): + # Hmm .. this looks a bit scary :-) ... + xrefis = [] + + # This iterates over all doc targets. These are all .stamp and .tag files + for node in env.Alias('all_docs')[0].sources: + # We are only interested in the xml targets. This is Doxyfile dependent :-( + if node.abspath.endswith('/xml/.stamp'): + # This is the list of xref categories + for type in TYPES: + # Here we construct the pathname of the xml file for the category + xref = os.path.join(node.dir.abspath,type+'.xml') + # And now apply the xrefxtract.xslt tempalte to it. However, we must + # only call xsltproc if the source xml file is not empty (therefore the + # 'test') + xrefi = env.Command(xref+'i', [ xref, '%s/xrefxtract.xslt' % basedir, node ], + [ "test -s $SOURCE && xsltproc -o $TARGET" + + " --stringparam module $MODULE" + + " --stringparam type $TYPE" + + " ${SOURCES[1]} $SOURCE || touch $TARGET" ], + MODULE = node.dir.dir.dir.name, + TYPE = type) + # If the xref xml file does not exist we create it here as an empty + # file since doxygen will only create it if it is non-empty. + if not env.GetOption('clean') and not os.path.exists(xref): + if not os.path.exists(node.dir.abspath): + env.Execute(SCons.Defaults.Mkdir(node.dir.abspath)) + env.Execute(SCons.Defaults.Touch(xref)) + xrefis.append(xrefi) + + # And here we can now simply combine all the xrefi files + xref = env.Command("doc/html/xref.xml", xrefis, + [ "echo -e '\\n' >$TARGET", + "cat $SOURCES >> $TARGET", + "echo '' >>$TARGET" ]) + + # Lastly we create the html file + sources = [ xref, "%s/xrefhtml.xslt" % basedir ] + if HTML_HEADER : sources.append(HTML_HEADER) + if HTML_FOOTER : sources.append(HTML_FOOTER) + + commands = [] + if HTML_HEADER: + commands.append( + "sed -e 's/\\$$title/$TITLE/g' -e 's/\\$$projectname/Overview/g' ${SOURCES[2]} > $TARGET") + commands.append("xsltproc --stringparam title '$TITLE' ${SOURCES[1]} $SOURCE >> $TARGET") + if HTML_FOOTER: + commands.append( + "sed -e 's/\\$$title/$TITLE/g' -e 's/\\$$projectname/Overview/g' ${SOURCES[%d]} >> $TARGET" + % (HTML_HEADER and 3 or 2)) + + xref = env.Command("doc/html/xref.html", sources, commands) + + env.Alias('all_docs',xref) + return xref + def Lib(env, library, sources, testSources = None, LIBS = []): objects = Objects(env,sources,testSources,LIBS=LIBS) lib = None