summaryrefslogtreecommitdiff
path: root/Makefile
blob: 774bd70c1d0eb7df3dd7773a0d1a3a10a95c734f (plain)
  1. # expensive checks enabled: make -B flightcheck=1
  2. # Final document: make -B final=1
  3. stem = eut
  4. source_baseurl = http://euwiki.org/
  5. source_basename = EUT/2nd-edition
  6. citeproc_file = $(stem).bib
  7. templates = template.tex header.tex before.tex after.tex
  8. filters = ./pandoc-cs1 ./pandoc-todo
  9. filters += $(if $(citeproc_file),pandoc-citeproc)
  10. filters += ./pandoc-iri
  11. markdown_includes = copyright.md colophon.md
  12. mediawiki_includes = preface.mw foreword.mw
  13. includes += $(markdown_includes:.md=.tex)
  14. includes += $(mediawiki_includes:.mw=.tex)
  15. localfilters = $(filter ./%,$(filters))
  16. title = Ensuring utmost transparency
  17. subtitle = Free Software and Open Standards under the Rules of Procedure of the European Parliament
  18. env_filter += $(citeproc_file:%=PANDOC_CITEPROC_FILE=%)
  19. env_filter += $(if $(flightcheck),NETWORK_TESTS=1)
  20. args_filter += $(filters:%=--filter %)
  21. args_meta += $(citeproc_file:%=-M bibliography=%)
  22. args_meta += -V lang=english -V langoption=variant=british
  23. args_meta += -M title="$(title) - $(subtitle)"
  24. args_meta += -V title="$(title)"
  25. args_meta += -V subtitle="$(subtitle)"
  26. args_meta += -M author="Carlo Piana, Ulf Öberg"
  27. args_meta += -V author="Carlo Piana" -V author="Ulf Öberg"
  28. args_meta += -V date=""
  29. args_latex += --template=template.tex --latex-engine=xelatex
  30. args_latex += -H header.tex -B before.tex -A after.tex
  31. args_latex += -V mainfont="Lora" -V sansfont="Quattrocento Sans" -V monofont="Inconsolata"
  32. args_latex += -V documentclass=memoir -V pagestyle=plain -V headstyles=komalike -V chapterstyle=ell
  33. args_latex += -V matter=yes -V classoption=titlepage -V classoption=$(if $(final),final,draft)
  34. flavors = a4 book ebook
  35. args_a4 = -V papersize=a4paper -V fontsize=10pt -V classoption=oneside
  36. args_book = -V papersize=b5paper -V fontsize=10pt -V classoption=twoside
  37. args_ebook = -V papersize=ebook -V fontsize=12pt -V classoption=oneside -V classoption=openany
  38. all: $(flavors:%=$(stem)-%.pdf)
  39. download:
  40. ./mediawiki-fetch $(source_baseurl) $(source_basename) $(stem).raw
  41. $(stem).mw: $(stem).raw
  42. ./mediawiki-trim $< $@
  43. ./mediawiki-blockquote $@
  44. ./mediawiki-uri-escape $@
  45. ./mediawiki-matter $@
  46. $(stem).native: $(stem).mw $(localfilters)
  47. $(env_filter) pandoc -f mediawiki $(args_meta) $(args_filter) -o $@ $<
  48. $(mediawiki_includes): $(stem).mw
  49. $(mediawiki_includes:.mw=.tex): %.tex: %.mw $(stem).mw
  50. pandoc -f mediawiki -t latex --chapters -o $@ $<
  51. $(markdown_includes:.md=.tex): %.tex: %.md
  52. pandoc -f markdown -t latex --chapters -o $@ $<
  53. $(flavors:%=$(stem)-%.tex): $(stem)-%.tex: $(stem).native $(templates) $(includes)
  54. pandoc --standalone $(args_meta) $(args_latex) $(args_$*) -o $@ $<
  55. XELATEX = xelatex -no-shell-escape -halt-on-error -interaction=batchmode
  56. %.pdf: %.tex
  57. $(XELATEX) $<
  58. $(XELATEX) $<
  59. $(XELATEX) $<
  60. $(XELATEX) $<
  61. clean:
  62. rm -f $(foreach ext,pdf aux log out toc tex,$(flavors:%=$(stem)-%.$(ext)))
  63. rm -f $(foreach ext,native bib mw,$(stem:%=%.$(ext)))
  64. rm -f $(foreach ext,aux tex,$(includes:%.tex=%.$(ext)))
  65. rm -f $(mediawiki_includes)
  66. distclean: clean
  67. rm -f $(stem:%=%.raw)