book-a4.pdf: book.md
	pandoc                           \
	    --standalone                 \
	    --toc                        \
	    --toc-depth 2                \
	    --number-sections            \
	    --highlight-style zenburn    \
	    -V documentclass:extarticle  \
	    -V papersize:A4              \
	    -V fontsize:14pt             \
	    -V geometry:"top=2.5cm,      \
	                 bottom=2.6cm,   \
	                 left=2.5cm,     \
	                 right=2.5cm"    \
	    $< -o $@

book-a4.ps: book-a4.pdf
	pdf2ps $< $@

book-a4-signature.ps: book-a4.ps
	psbook $< $@

book-a5-signature.ps: book-a4-signature.ps
	psnup -2 $< $@

book-a5-signature.pdf: book-a5-signature.ps
	ps2pdf $< $@

.PHONY: clean
clean:
	rm -f book-a4.pdf
	rm -f book-a4.ps
	rm -f book-a4-signature.pdf
	rm -f book-a4-signature.ps
	rm -f book-a5-signature.pdf
	rm -f book-a5-signature.ps

.PHONY: help
help:
	@echo "Usage:"
	@echo "  make TARGET"
	@echo
	@echo "Available targets:"
	@echo "  book-a4.pdf"
	@echo "  book-a4.ps"
	@echo "  book-a4-signature.pdf"
	@echo "  book-a4-signature.ps"
	@echo "  book-a5-signature.pdf"
	@echo "  book-a5-signature.ps"
	@echo "  clean"
	@echo "  help"