# GNUMakefile for test

RM=rm -f
#CMP=cmp
CMP=:
PYTHON=python
PDF2TXT=PYTHONPATH=.. $(PYTHON) ../tools/pdf2txt.py -Dx -p1

HTMLS=$(HTMLS_FREE) $(HTMLS_NONFREE)
HTMLS_FREE= \
	simple1.html \
	simple2.html \
	jo.html
HTMLS_NONFREE= \
	nonfree/dmca.html \
	nonfree/f1040nr.html \
	nonfree/i1040nr.html \
	nonfree/kampo.html \
	nonfree/naacl06-shinyama.html \
	nonfree/nlp2004slides.html

TEXTS=$(TEXTS_FREE) $(TEXTS_NONFREE)
TEXTS_FREE= \
	simple1.txt \
	simple2.txt \
	jo.txt
TEXTS_NONFREE= \
	nonfree/dmca.txt \
	nonfree/f1040nr.txt \
	nonfree/i1040nr.txt \
	nonfree/kampo.txt \
	nonfree/naacl06-shinyama.txt \
	nonfree/nlp2004slides.txt

XMLS=$(XMLS_FREE) $(XMLS_NONFREE)
XMLS_FREE= \
	simple1.xml \
	simple2.xml \
	jo.xml
XMLS_NONFREE= \
	nonfree/dmca.xml \
	nonfree/f1040nr.xml \
	nonfree/i1040nr.xml \
	nonfree/kampo.xml \
	nonfree/naacl06-shinyama.xml \
	nonfree/nlp2004slides.xml

test: htmls texts xmls

clean:
	-$(RM) $(HTMLS)
	-$(RM) $(TEXTS)
	-$(RM) $(XMLS)

htmls: $(HTMLS)
texts: $(TEXTS)
xmls: $(XMLS)

.SUFFIXES: .pdf .html .xml .txt

.pdf.html:
	$(PDF2TXT) -t html $< > $@
	$(CMP) $@ $@.ref

.pdf.xml:
	$(PDF2TXT) -t xml $< > $@
	$(CMP) $@ $@.ref

.pdf.txt:
	$(PDF2TXT) -t text $< > $@
	$(CMP) $@ $@.ref
