## Process this file with automake to produce Makefile.in

$(top_builddir)/xsltproc/xsltproc:
	@(cd ../../xsltproc ; $(MAKE) xsltproc)

EXTRA_DIST = \
    bug-1-.out bug-1-.xsl \
    bug-2-.out bug-2-.xsl \
    bug-3-.out bug-3-.xsl \
    bug-4-.out bug-4-.xsl \
    bug-5-.out bug-5-.xsl \
    bug-6-.out bug-6-.xsl \
    bug-7-.out bug-7-.xsl \
    bug-8-.out bug-8-.xsl \
    bug-9-.out bug-9-.xsl \
    bug-10-.out bug-10-.xsl \
    bug-11-.out bug-11-.xsl \
    bug-12-.out bug-12-.xsl \
    bug-13-.out bug-13-.xsl \
    bug-14-.out bug-14-.xsl \
    bug-15-.out bug-15-.xsl \
    bug-16-.out bug-16-.xsl \
    bug-17-.out bug-17-.xsl \
    bug-18-.out bug-18-.xsl \
    bug-19-.out bug-19-.xsl \
    bug-20-.out bug-20-.xsl \
    bug-21-.out bug-21-.xsl \
    bug-22-.out bug-22-.xsl \
    bug-23-.out bug-23-.xsl \
    bug-24-.out bug-24-.xsl \
    bug-25-.out bug-25-.xsl \
    bug-26-.out bug-26-.xsl \
    bug-27-.out bug-27-.xsl \
    bug-28-.out bug-28-.xsl \
    bug-29-.out bug-29-.xsl \
    bug-30-.out bug-30-.xsl \
    bug-31-.out bug-31-.xsl \
    bug-32-.out bug-32-.xsl \
    bug-33-.out bug-33-.xsl \
    bug-35-.out bug-35-.xsl \
    bug-36-.out bug-36-.xsl \
    bug-36-inc.out bug-36-inc.xsl \
    bug-37-.out bug-37-.xsl \
    bug-37-inc.out bug-37-inc.xsl \
    array.out array.xsl \
    bug-38-.out bug-38-.xsl \
    bug-39-.out bug-39-.xsl \
    bug-40-.out bug-40-.xsl \
    bug-41-.out bug-41-.xsl \
    bug-42-.out bug-42-.xsl \
    bug-43-.out bug-43-.xsl \
    bug-44-.out bug-44-.xsl \
    bug-45-.out bug-45-.xsl \
    bug-46-.out bug-46-.xsl \
    bug-47-.out bug-47-.xsl \
    bug-48-.out bug-48-.xsl \
    bug-49-.out bug-49-.xsl \
    bug-50-.out bug-50-.xsl \
    bug-52.out bug-52.xsl \
    bug-53.out bug-53.xsl \
    bug-54.out bug-54.xsl \
    bug-55.out bug-55.xsl \
    bug-56.out bug-56.xsl \
    bug-57.out bug-57.xsl \
    bug-59.out bug-59.xsl \
    bug-60.out bug-60.xsl bug-60.err \
    bug-61.out bug-61.xsl \
    bug-62-inc.out bug-62-inc.xsl \
    bug-62.out bug-62.xsl \
    bug-63.out bug-63.xsl \
    bug-64.out bug-64.xsl \
    bug-65.ent bug-65.out bug-65.xsl \
    bug-66.out bug-66.xsl \
    bug-68.out bug-68.xsl \
    bug-69.out bug-69.xsl \
    bug-70.out bug-70.xsl \
    bug-71.out bug-71.xsl \
    bug-72.out bug-72.xsl \
    bug-73.out bug-73.xsl \
    bug-74.out bug-74.xsl \
    bug-75.out bug-75.xsl \
    bug-76.out bug-76.xsl \
    bug-77.out bug-77.xsl \
    bug-78.out bug-78.xsl \
    bug-79.out bug-79.xsl \
    bug-80.out bug-80.xsl \
    bug-81.out bug-81.xsl \
    bug-82.out bug-82.xsl \
    bug-83.out bug-83.xsl \
    bug-84.out bug-84.xsl \
    bug-86.out bug-86.xsl \
    bug-87.out bug-87.xsl \
    bug-88.out bug-88.xsl \
    bug-89.out bug-89.xsl \
    bug-90.out bug-90.xsl \
    bug-91.out bug-91.xsl \
    bug-92.out bug-92.xsl \
    bug-93.out bug-93.xsl \
    bug-93-inc.out bug-93-inc.xsl \
    bug-94.out bug-94.xsl \
    bug-95.out bug-95.xsl \
    bug-96.out bug-96.xsl \
    bug-97.out bug-97.xsl \
    bug-98.out bug-98.xsl \
    bug-99.out bug-99.xsl \
    bug-100.out bug-100.xsl \
    bug-101.out bug-101.xsl \
    bug-102.out bug-102.xsl \
    bug-102-inc.out bug-102-inc.xsl \
    bug-103.out bug-103.xsl \
    bug-104.out bug-104.xsl \
    bug-105.out bug-105.xsl \
    bug-106.out bug-106.xsl \
    bug-107.out bug-107.xsl \
    bug-108.out bug-108.xsl \
    bug-109.out bug-109.xsl \
    bug-110.out bug-110.xsl bug-110.err \
    bug-111.out bug-111.xsl \
    bug-112.out bug-112.xsl \
    bug-113.out bug-113.xsl \
    bug-114.out bug-114.xsl \
    bug-115.out bug-115.xsl \
    bug-116.out bug-116.xsl \
    bug-117.out bug-117.xsl \
    bug-118.out bug-118.xsl \
    bug-119.out bug-119.xsl \
    bug-120.out bug-120.xsl \
    bug-121.out bug-121.xsl \
    bug-122.out bug-122.xsl \
    bug-123.out bug-123.xsl \
    bug-124.out bug-124.xsl \
    bug-125.out bug-125.xsl \
    bug-126.out bug-126.xsl \
    bug-127.out bug-127.xsl \
    bug-128.out bug-128.xsl \
    bug-129.out bug-129.xsl \
    bug-130.out bug-130.xsl \
    bug-130-imp1.imp bug-130-imp2.imp bug-130-imp3.imp bug-130-imp4.imp \
    bug-131.out bug-131.xsl bug-131-imp.imp \
    bug-132.out bug-132.xsl \
    bug-133.out bug-133.xsl \
    bug-134.out bug-134.xsl \
    bug-135.out bug-135.xsl \
    bug-136.out bug-136.xsl \
    bug-137.imp  bug-137.out  bug-137.xsl \
    bug-138.out bug-138.xsl \
    bug-139.out bug-139.xsl \
    bug-140.out bug-140.xsl \
    bug-141.out bug-141.xsl \
    bug-142.out bug-142.xsl \
    bug-143.out bug-143.xsl \
    bug-144.out bug-144.xsl \
    bug-145.out bug-145.xsl bug-145.err \
    bug-146.out bug-146.xsl \
    bug-147.out bug-147.xsl \
    bug-147-1.imp bug-147-2.imp bug-147-3.imp \
    bug-147-4.imp bug-147-5.imp bug-147-6.imp \
    bug-148.out bug-148.xsl \
    bug-149.out bug-149.xsl \
    bug-150.out bug-150.xsl \
    bug-151.out bug-151.xsl \
    bug-152.out bug-152.xsl \
    bug-153.out bug-153.xsl \
    bug-154.out bug-154.xsl \
    bug-155.out bug-155.xsl \
    bug-156.err bug-156.out bug-156.xsl \
    bug-156.imp1.imp bug-156.imp2.imp \
    bug-157.err bug-157.out bug-157.xsl \
    bug-158.out bug-158.xsl \
    bug-159.out bug-159.xsl \
    bug-160.out bug-160.xsl \
    bug-161.out bug-161.xsl \
    bug-163.out bug-163.xsl \
    bug-164.out bug-164.xsl \
    bug-165.out bug-165.xsl bug-165.err \
    bug-166.out bug-166.xsl \
    bug-167.out bug-167.xsl \
    bug-168.out bug-168.xsl \
    bug-169.out bug-169.xsl bug-169.imp \
    bug-170.out bug-170.xsl \
    bug-171.out bug-171.xsl \
    bug-172.out bug-172.xsl \
    bug-173.out bug-173.xsl \
    bug-174.out bug-174.xsl bug-174.err \
    bug-175.out bug-175.xsl bug-175.err \
    bug-176.out bug-176.xsl \
    bug-177.out bug-177.xsl \
    bug-178.out bug-178.xsl \
    bug-179.out bug-179.xsl \
    bug-180.out bug-180.xsl bug-180.err \
    bug-181.out bug-181.xsl \
    bug-182.out bug-182.xsl \
    bug-183.out bug-183.xsl \
    bug-184.out bug-184.xsl bug-184.err \
    bug-185.out bug-185.xsl bug-185.err \
    bug-186.out bug-186.xsl \
    bug-187.out bug-187.xsl bug-187.err \
    bug-188.out bug-188.xsl bug-188-imp.out bug-188-imp.xsl \
    bug-189.out bug-189.xsl \
    bug-190.out bug-190.xsl bug-190-imp.out bug-190-imp.xsl \
    bug-191.out bug-191.xsl bug-191.err bug-191-imp.out bug-191-imp.xsl \
    bug-192.out bug-192.xsl \
    bug-193.out bug-193.xsl \
    bug-194.out bug-194.xsl bug-194.err \
    bug-195.out bug-195.xsl \
    bug-196.out bug-196.xsl \
    bug-197.out bug-197.xsl \
    bug-198.out bug-198.xsl \
    bug-199.out bug-199.xsl \
    bug-200.out bug-200.xsl \
    bug-201.out bug-201.xsl bug-201.err \
    bug-202.out bug-202.xsl bug-202.err \
    bug-203.out bug-203.xsl bug-203.err \
    bug-204.out bug-204.xsl bug-204.err \
    bug-205.out bug-205.xsl \
    bug-206.out bug-206.xsl \
    bug-207.out bug-207.xsl \
    bug-208.out bug-208.xsl bug-208.err \
    bug-209.out bug-209.xsl \
    bug-210.out bug-210.xsl \
    bug-211.out bug-211.xsl \
    bug-212.out bug-212.xsl \
    bug-213.out bug-213.xsl \
    bug-214.out bug-214.xsl \
    bug-215.out bug-215.xsl bug-215.err \
    bug-216.out bug-216.xsl \
    bug-217.out bug-217.xsl \
    bug-218.out bug-218.xsl \
    bug-219.out bug-219.xsl \
    bug-220.out bug-220.xsl \
    bug-221.out bug-221.xsl \
    bug-222.out bug-222.xsl \
    character.out character.xsl \
    character2.out character2.xsl \
    itemschoose.out itemschoose.xsl \
    inner.xsl \
    date_add.out date_add.xsl

CLEANFILES = .memdump

valgrind:
	@echo '## Running the regression tests under Valgrind'
	$(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests

test tests: $(top_builddir)/xsltproc/xsltproc
	@echo '## Running general tests'
	@(echo > .memdump)
	-@(for i in $(srcdir)/../docs/*.xml ; do \
	  if [ -d $$i ] ; then continue ; fi ; \
	  doc=`basename $$i .xml` ; \
	  for j in $(srcdir)/$$doc*.xsl ; do \
	  if [ ! -f $$j ] ; then continue ; fi ; \
	  if [ -d $$j ] ; then continue ; fi ; \
	  name=`basename $$j .xsl`; \
	  out=$(srcdir)/"$$name".out; \
	  err=$(srcdir)/"$$name".err; \
	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --maxdepth 200 $$j $$i \
	  	> result.$$name 2>err.$$name; \
	  if [ ! -f $$out ] ; then \
	  	cp result.$$name $$out ; \
		if [ -s err.$$name ] ; then \
			cp err.$$name $$err ; \
		fi ; \
	  else \
	  	diff $$out result.$$name; \
		if [ -s $$err ] ; then \
	  		diff $$err err.$$name; \
		else \
			diff /dev/null err.$$name; \
		fi ; \
	  fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true`;\
	  if [ -n "$$log" ] ; then \
	  	echo $$name result ; \
		echo "$$log" ; \
	  fi ; \
	  rm -f result.$$name err.$$name; \
	  done ; done)
	@echo '## Running general tests without dictionaries'
	-@(for i in $(srcdir)/../docs/*.xml ; do \
	  if [ -d $$i ] ; then continue ; fi ; \
	  doc=`basename $$i .xml` ; \
	  for j in $(srcdir)/$$doc*.xsl ; do \
	  if [ ! -f $$j ] ; then continue ; fi ; \
	  if [ -d $$j ] ; then continue ; fi ; \
	  name=`basename $$j .xsl`; \
	  out=$(srcdir)/"$$name".out; \
	  err=$(srcdir)/"$$name".err; \
	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nodict --maxdepth 200 $$j $$i \
	  	> result.$$name 2>err.$$name; \
	  if [ ! -f $$out ] ; then \
	  	cp result.$$name $$out ; \
		if [ -s err.$$name ] ; then \
			cp err.$$name $$err ; \
		fi ; \
	  else \
	  	diff $$out result.$$name; \
		if [ -s $$err ] ; then \
	  		diff $$err err.$$name; \
		else \
			diff /dev/null err.$$name; \
		fi ; \
	  fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true`;\
	  if [ -n "$$log" ] ; then \
	  	echo $$name result ; \
		echo "$$log" ; \
	  fi ; \
	  rm -f result.$$name err.$$name; \
	  done ; done)

