summaryrefslogtreecommitdiff
path: root/Makefile
blob: b8606d298eb8ccf0c235e19e99a086d4c6d1e2f9 (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. mediawiki_includes = copyright.mw preface.mw foreword.mw
  12. includes += $(mediawiki_includes:.mw=.tex)
  13. localfilters = $(filter ./%,$(filters))
  14. title = Ensuring utmost transparency
  15. subtitle = Free Software and Open Standards under the Rules of Procedure of the European Parliament
  16. env_filter += $(citeproc_file:%=PANDOC_CITEPROC_FILE=%)
  17. env_filter += $(if $(flightcheck),NETWORK_TESTS=1)
  18. args_filter += $(filters:%=--filter %)
  19. args_meta += $(citeproc_file:%=-M bibliography=%)
  20. args_meta += -V lang=english -V langoption=variant=british
  21. args_meta += -M title="$(title) - $(subtitle)"
  22. args_meta += -V title="$(title)"
  23. args_meta += -V subtitle="$(subtitle)"
  24. args_meta += -M author="Carlo Piana, Ulf Öberg"
  25. args_meta += -V author="Carlo Piana" -V author="Ulf Öberg"
  26. args_meta += -V date=""
  27. args_latex += --template=template.tex --latex-engine=xelatex
  28. args_latex += -H header.tex -B before.tex -A after.tex
  29. args_latex += -V mainfont="Lora" -V sansfont="Quattrocento Sans" -V monofont="Inconsolata"
  30. args_latex += -V documentclass=memoir -V pagestyle=plain -V headstyles=komalike -V chapterstyle=ell
  31. args_latex += -V matter=yes -V classoption=titlepage -V classoption=$(if $(final),final,draft)
  32. flavors = a4 book ebook
  33. args_a4 = -V papersize=a4paper -V fontsize=10pt -V classoption=oneside
  34. args_book = -V papersize=b5paper -V fontsize=10pt -V classoption=twoside
  35. args_ebook = -V papersize=ebook -V fontsize=12pt -V classoption=oneside -V classoption=openany
  36. all: $(flavors:%=$(stem)-%.pdf)
  37. download:
  38. wget -O $(stem).raw '$(source_baseurl)w/index.php?title=$(source_basename)&action=edit'
  39. $(stem).mw: $(stem).raw
  40. ./mediawiki-extract $< $@
  41. ./mediawiki-trim $@
  42. ./mediawiki-blockquote $@
  43. ./mediawiki-uri-escape $@
  44. ./mediawiki-matter $@
  45. $(stem).native: $(stem).mw $(localfilters)
  46. $(env_filter) pandoc -f mediawiki $(args_meta) $(args_filter) -o $@ $<
  47. $(mediawiki_includes:.mw=.tex): %.tex: %.mw $(stem).mw
  48. pandoc -f mediawiki -t latex --chapters -o $@ $<
  49. $(flavors:%=$(stem)-%.tex): $(stem)-%.tex: $(stem).native $(templates) $(includes)
  50. pandoc $(args_meta) $(args_latex) $(args_$*) -o $@ $<
  51. XELATEX = xelatex -no-shell-escape -halt-on-error -interaction=batchmode
  52. %.pdf: %.tex
  53. $(XELATEX) $<
  54. $(XELATEX) $<
  55. $(XELATEX) $<