extract latest git commit ID from github, MKWS-420
[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 if which markdown2pdf > /dev/null; then echo markdown2pdf; else echo pandoc --standalone; fi)
8 HAVE_PDFLATEX = $(shell which pdflatex 2>/dev/null)
9
10 DOCS = index.html \
11        mkws-manual.html \
12        mkws-developer.html \
13        mkws-doc.css
14
15 PDFS = index.pdf \
16        mkws-manual.pdf \
17        mkws-developer.pdf
18
19 #
20 # skip PDF creation if pdflatex is not installed
21 # The debian tex package may download up to 650MB
22 #
23 ifneq "${HAVE_PDFLATEX}" ""
24 DOCS+= ${PDFS}
25 endif
26
27 INSTALLED = $(DOCS:%=../tools/htdocs/%)
28
29 all: $(INSTALLED)
30
31 ../tools/htdocs/%: %
32         rm -f $@
33         cp $< $@
34         chmod ugo-w $@
35
36 # For a description of pandoc's markdown format, see:
37 # http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html
38
39 # for older pandoc (<1.9) run first:
40 # perl -i.bak -npe 's/"(Authors|Subjects)": "(.*?)"/"$1": "test"/' tools/htdocs/mkws-manual.markdown
41 #
42 ../tools/htdocs/%.html: %.markdown tweak-html
43         rm -f $@
44         pandoc --standalone --toc -c mkws-doc.css $< | ./tweak-html > $@
45         chmod ugo-w $@
46
47 ../tools/htdocs/%.pdf: %.markdown
48         rm -f $@
49         $(MARKDOWN2PDF) $< -o $@
50         chmod ugo-w $@
51
52 clean:
53         rm -f $(INSTALLED)
54         rm -f *.drupal.html
55
56 distclean: clean
57         # Nothing more to remove in the doc directory
58
59 push:
60         pandoc --toc index.markdown > index.drupal.html
61         pandoc --toc mkws-manual.markdown > mkws-manual.drupal.html
62         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"
63         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"
64
65 help:
66         @echo "make [ all | clean | push ]"