Fix MKWS-296 ("PDF versions of documents do not build on Debian 6.0")
[mkws-moved-to-github.git] / doc / Makefile
1 # Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com
2 #
3 # To build the PDFs, you will need these Debian packages:
4 #       texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
5
6 # Older versions of pandoc don't do PDF output, but have a companion program
7 MARKDOWN2PDF = $(shell which markdown2pdf pandoc)
8
9 DOCS = index.html index.pdf \
10        mkws-manual.html mkws-manual.pdf \
11        mkws-developer.html mkws-developer.pdf \
12        mkws-doc.css
13
14 INSTALLED = $(DOCS:%=../tools/htdocs/%)
15
16 all: $(INSTALLED)
17
18 ../tools/htdocs/%: %
19         rm -f $@
20         cp $< $@
21         chmod ugo-w $@
22
23 # For a description of pandoc's markdown format, see:
24 # http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html
25
26 # for older pandoc (<1.9) run first:
27 # perl -i.bak -npe 's/"(Authors|Subjects)": "(.*?)"/"$1": "test"/' tools/htdocs/mkws-manual.markdown
28 #
29 ../tools/htdocs/%.html: %.markdown tweak-html
30         rm -f $@
31         pandoc --standalone --toc -c mkws-doc.css $< | ./tweak-html > $@
32         chmod ugo-w $@
33
34 # ### In order to compile the manual, which has tables, to PDF,
35 # you will need to install the Debian package
36 #       texlive-latex-recommended
37 ../tools/htdocs/%.pdf: %.markdown
38         rm -f $@
39         $(MARKDOWN2PDF) --standalone $< -o $@
40         chmod ugo-w $@
41
42 clean:
43         rm -f $(INSTALLED)
44         rm -f *.drupal.html
45
46 distclean: clean
47         # Nothing more to remove in the doc directory
48
49 push:
50         pandoc --toc index.markdown > index.drupal.html
51         pandoc --toc mkws-manual.markdown > mkws-manual.drupal.html
52         cat index.drupal.html | ./drupaljson.pl | curl --upload-file - http://www.indexdata.com/script/node/332?services_token=cda1e26e5733ce3f604773e94f0721df5c31a948 -v --header "Content-Type:application/json"
53         cat mkws-manual.drupal.html | ./drupaljson.pl | curl --upload-file - http://www.indexdata.com/script/node/323?services_token=cda1e26e5733ce3f604773e94f0721df5c31a948 -v --header "Content-Type:application/json"
54
55 help:
56         @echo "make [ all | clean | push ]"
57