summaryrefslogtreecommitdiff
path: root/doc/examples/index.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/index.py')
-rwxr-xr-xdoc/examples/index.py92
1 files changed, 38 insertions, 54 deletions
diff --git a/doc/examples/index.py b/doc/examples/index.py
index 7e0efaa..11df6f0 100755
--- a/doc/examples/index.py
+++ b/doc/examples/index.py
@@ -13,7 +13,7 @@ sys.path.insert(0, "..")
from apibuild import CParser, escape
examples = []
-extras = ['examples.xsl', 'index.html', 'index.py']
+extras = ['examples.xsl', '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(" </uses>\n")
output.write(" </example>\n")
-
+
return idx
def dump_symbols(output):
@@ -220,59 +220,43 @@ def dump_Makefile():
extras.append(file)
for file in glob.glob('*.res'):
extras.append(file)
- 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)
+ 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@
-CLEANFILES = *.tmp
-
-if REBUILD_DOCS
rebuild: examples.xml index.html
-.PHONY: rebuild
-examples.xml: index.py $(noinst_PROGRAMS:=.c)
- cd $(srcdir) && $(PYTHON) index.py
- $(MAKE) Makefile
+examples.xml: index.py *.c
+ -@($(srcdir)/index.py)
index.html: examples.xml examples.xsl
- cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
- -cd $(srcdir) && xmllint --valid --noout index.html
-endif
+ -@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html)
install-data-local:
- $(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
+ $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
+ -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
"""
- examples.sort()
- extras.sort()
- tests.sort()
EXTRA_DIST=""
for extra in extras:
- EXTRA_DIST = EXTRA_DIST + " \\\n\t" + extra
- Makefile = Makefile + "EXTRA_DIST =%s\n\n" % (EXTRA_DIST)
+ EXTRA_DIST = EXTRA_DIST + extra + " "
+ Makefile = Makefile + "EXTRA_DIST=%s\n\n" % (EXTRA_DIST)
noinst_PROGRAMS=""
for example in examples:
- noinst_PROGRAMS = noinst_PROGRAMS + " \\\n\t" + example
- Makefile = Makefile + "noinst_PROGRAMS =%s\n\n" % (noinst_PROGRAMS)
+ noinst_PROGRAMS = noinst_PROGRAMS + example + " "
+ Makefile = Makefile + "noinst_PROGRAMS=%s\n\n" % (noinst_PROGRAMS)
for example in examples:
- Makefile = Makefile + "%s_SOURCES = %s.c\n\n" % (example, example)
+ 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 + "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 + "\t@($(CHECKER) %s)\n" % (test)
+ Makefile = Makefile + '\t@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)\n'
+ Makefile = Makefile + "\n\n"
try:
old = open("Makefile.am", "r").read()
if old != Makefile:
@@ -280,23 +264,23 @@ clean-local:
print "Updated Makefile.am"
except:
print "Failed to read or save Makefile.am"
-# #
-# # 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"
-
+ #
+ # 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"
+
if __name__ == "__main__":
load_api()
output = open("examples.xml", "w")