##
## 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 $(noinst_PROGRAMS:=.c)
	cd $(srcdir) && $(PYTHON) index.py
	$(MAKE) Makefile

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

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

EXTRA_DIST = \
	examples.xml \
	examples.xsl \
	index.html \
	index.py \
	io1.res \
	io2.res \
	reader1.res \
	reader3.res \
	reader4.res \
	test1.xml \
	test2.xml \
	test3.xml \
	tree1.res \
	tree2.res \
	tst.xml \
	writer.xml \
	xpath1.res \
	xpath2.res

noinst_PROGRAMS = \
	io1 \
	io2 \
	parse1 \
	parse2 \
	parse3 \
	parse4 \
	reader1 \
	reader2 \
	reader3 \
	reader4 \
	testWriter \
	tree1 \
	tree2 \
	xpath1 \
	xpath2

io1_SOURCES = io1.c

io2_SOURCES = io2.c

parse1_SOURCES = parse1.c

parse2_SOURCES = parse2.c

parse3_SOURCES = parse3.c

parse4_SOURCES = parse4.c

reader1_SOURCES = reader1.c

reader2_SOURCES = reader2.c

reader3_SOURCES = reader3.c

reader4_SOURCES = reader4.c

testWriter_SOURCES = testWriter.c

tree1_SOURCES = tree1.c

tree2_SOURCES = tree2.c

xpath1_SOURCES = xpath1.c

xpath2_SOURCES = xpath2.c

valgrind: 
	$(MAKE) CHECKER='valgrind' tests

tests: $(noinst_PROGRAMS)
	test -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .
	@(echo '## examples regression tests')
	@(echo > .memdump)
	$(CHECKER) ./io1 > io1.tmp && diff io1.tmp $(srcdir)/io1.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./parse1 test1.xml
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./parse2 test2.xml
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./parse3
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./parse4 test3.xml
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./reader1 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp && diff reader4.tmp $(srcdir)/reader4.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./testWriter && for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./tree1 test2.xml > tree1.tmp && diff tree1.tmp $(srcdir)/tree1.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./tree2 > tree2.tmp && diff tree2.tmp $(srcdir)/tree2.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./xpath1 test3.xml '//child2' > xpath1.tmp && diff xpath1.tmp $(srcdir)/xpath1.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
	$(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
	@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
