--- embedaddon/libxml2/doc/examples/index.py 2012/02/21 23:37:59 1.1.1.1 +++ embedaddon/libxml2/doc/examples/index.py 2014/06/15 19:53:36 1.1.1.2 @@ -13,7 +13,7 @@ sys.path.insert(0, "..") from apibuild import CParser, escape examples = [] -extras = ['examples.xsl', 'index.py'] +extras = ['examples.xsl', 'index.html', 'index.py'] tests = [] sections = {} symbols = {} @@ -177,10 +177,10 @@ def parse(filename, output): type = id.get_type() output.write(" <%s line='%d' name='%s'/>\n" % (type, line, name)) - + output.write(" \n") output.write(" \n") - + return idx def dump_symbols(output): @@ -220,43 +220,59 @@ def dump_Makefile(): extras.append(file) for file in glob.glob('*.res'): extras.append(file) - Makefile="""# Beware this is autogenerated by index.py -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@ -DEPS = $(top_builddir)/libxml2.la -LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@ + Makefile="""## +## This file is auto-generated by index.py +## DO NOT EDIT !!! +## +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include +AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) +LDADD = $(RDL_LIBS) $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm $(WIN32_EXTRA_LIBADD) + +CLEANFILES = *.tmp + +if REBUILD_DOCS rebuild: examples.xml index.html +.PHONY: rebuild -examples.xml: index.py *.c - -@($(srcdir)/index.py) +examples.xml: index.py $(noinst_PROGRAMS:=.c) + cd $(srcdir) && $(PYTHON) index.py + $(MAKE) Makefile index.html: examples.xml examples.xsl - -@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html) + cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page" + -cd $(srcdir) && xmllint --valid --noout index.html +endif install-data-local: - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR) - -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR) + $(MKDIR_P) $(DESTDIR)$(HTML_DIR) + -$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR) +clean-local: + test -f Makefile.am || rm -f test?.xml + """ + examples.sort() + extras.sort() + tests.sort() EXTRA_DIST="" for extra in extras: - EXTRA_DIST = EXTRA_DIST + extra + " " - Makefile = Makefile + "EXTRA_DIST=%s\n\n" % (EXTRA_DIST) + EXTRA_DIST = EXTRA_DIST + " \\\n\t" + extra + Makefile = Makefile + "EXTRA_DIST =%s\n\n" % (EXTRA_DIST) noinst_PROGRAMS="" for example in examples: - noinst_PROGRAMS = noinst_PROGRAMS + example + " " - Makefile = Makefile + "noinst_PROGRAMS=%s\n\n" % (noinst_PROGRAMS) + noinst_PROGRAMS = noinst_PROGRAMS + " \\\n\t" + example + Makefile = Makefile + "noinst_PROGRAMS =%s\n\n" % (noinst_PROGRAMS) for example in examples: - Makefile = Makefile + "%s_SOURCES=%s.c\n%s_LDFLAGS=\n%s_DEPENDENCIES= $(DEPS)\n%s_LDADD= @RDL_LIBS@ $(LDADDS)\n\n" % (example, example, example, - example, example) + Makefile = Makefile + "%s_SOURCES = %s.c\n\n" % (example, example) Makefile = Makefile + "valgrind: \n\t$(MAKE) CHECKER='valgrind' tests\n\n" Makefile = Makefile + "tests: $(noinst_PROGRAMS)\n" + Makefile = Makefile + "\ttest -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .\n" Makefile = Makefile + "\t@(echo '## examples regression tests')\n" Makefile = Makefile + "\t@(echo > .memdump)\n" for test in tests: - Makefile = Makefile + "\t@($(CHECKER) %s)\n" % (test) - Makefile = Makefile + '\t@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)\n' - Makefile = Makefile + "\n\n" + Makefile = Makefile + "\t$(CHECKER) %s\n" % (test) + Makefile = Makefile + '\t@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0\n' try: old = open("Makefile.am", "r").read() if old != Makefile: @@ -264,23 +280,23 @@ install-data-local: print "Updated Makefile.am" except: print "Failed to read or save Makefile.am" - # - # Autogenerate the .cvsignore too ... - # - ignore = """.memdump -Makefile.in -Makefile -""" - for example in examples: - ignore = ignore + "%s\n" % (example) - try: - old = open(".cvsignore", "r").read() - if old != ignore: - n = open(".cvsignore", "w").write(ignore) - print "Updated .cvsignore" - except: - print "Failed to read or save .cvsignore" - +# # +# # Autogenerate the .cvsignore too ... DEPRECATED +# # +# ignore = """.memdump +#Makefile.in +#Makefile +#""" +# for example in examples: +# ignore = ignore + "%s\n" % (example) +# try: +# old = open(".cvsignore", "r").read() +# if old != ignore: +# n = open(".cvsignore", "w").write(ignore) +# print "Updated .cvsignore" +# except: +# print "Failed to read or save .cvsignore" + if __name__ == "__main__": load_api() output = open("examples.xml", "w")