pdfminer.six/samples/Makefile

78 lines
1.5 KiB
Makefile
Raw Normal View History

# GNUMakefile for test
UNAME_S := $(shell uname -o)
CNVTXT=:
ifeq ($(UNAME_S),Cygwin)
CNVTXT=unix2dos
endif
RM=rm -f
CMP=:
2014-06-15 02:41:30 +00:00
ECHO=echo
PYTHON=python
2011-02-27 10:48:22 +00:00
PDF2TXT=PYTHONPATH=.. $(PYTHON) ../tools/pdf2txt.py -p1 -V
2014-06-15 02:41:30 +00:00
FREE= \
simple1 \
simple2 \
simple3 \
jo
2014-06-15 02:41:30 +00:00
NONFREE= \
nonfree/dmca \
nonfree/f1040nr \
nonfree/i1040nr \
nonfree/kampo \
nonfree/naacl06-shinyama \
nonfree/nlp2004slides
2014-06-15 02:41:30 +00:00
TESTS=$(FREE) $(NONFREE)
2014-06-15 02:41:30 +00:00
CRYPT_PASS1=foo
CRYPT_PASS2=baz
CRYPT_BASE=encryption/base
CRYPTS= \
encryption/rc4-40 \
encryption/rc4-128 \
encryption/aes-128 \
encryption/aes-128-m \
encryption/aes-256 \
encryption/aes-256-m
2014-06-15 02:41:30 +00:00
all: tests crypts
2014-06-15 02:41:30 +00:00
tests:
for i in $(TESTS); do \
$(ECHO) $$i; \
2014-06-25 10:50:20 +00:00
$(PDF2TXT) -t html -o $$i.html $$i.pdf || exit 1; \
$(CNVTXT) $$i.html || exit 1; \
2014-06-25 10:50:20 +00:00
$(CMP) $$i.html $$i.html.ref || exit 1; \
$(PDF2TXT) -t xml -o $$i.xml $$i.pdf || exit 1; \
$(CNVTXT) $$i.xml || exit 1; \
2014-06-25 10:50:20 +00:00
$(CMP) $$i.xml $$i.xml.ref || exit 1; \
$(PDF2TXT) -t text -o $$i.txt $$i.pdf || exit 1; \
$(CNVTXT) $$i.txt || exit 1; \
2014-06-25 10:50:20 +00:00
$(CMP) $$i.txt $$i.txt.ref || exit 1; \
2014-06-15 02:41:30 +00:00
done
2014-06-15 02:41:30 +00:00
crypts:
for i in $(CRYPTS); do \
$(ECHO) $$i; \
2014-06-25 10:50:20 +00:00
$(PDF2TXT) -t xml -P $(CRYPT_PASS1) -o $$i.1.xml $$i.pdf || exit 1; \
$(CMP) $$i.1.xml $(CRYPT_BASE).xml || exit 1; \
$(PDF2TXT) -t xml -P $(CRYPT_PASS2) -o $$i.2.xml $$i.pdf || exit 1; \
$(CMP) $$i.2.xml $(CRYPT_BASE).xml || exit 1; \
2014-06-15 02:41:30 +00:00
done
2014-06-15 02:41:30 +00:00
test:
$(MAKE) all CMP=cmp
2014-06-15 02:41:30 +00:00
clean:
-for i in $(TESTS); do \
$(RM) $$i.html $$i.xml $$i.txt; \
done
-for i in $(CRYPTS); do \
$(RM) $$i.1.xml $$i.2.xml; \
done