summaryrefslogtreecommitdiff
path: root/doc/Makefile
blob: d6b576c4abc8f699b9cb63b7141ac101b2309c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
NAME		= luaotfload
DOCPDF		= $(NAME).pdf
DOCSRC		= $(NAME)-latex.tex $(NAME)-main.tex

SCRIPTNAME	= luaotfload-tool
TOOLMANSRC	= $(SCRIPTNAME).rst
TOOLMAN		= $(SCRIPTNAME).1

CONFNAME	= luaotfload.conf
CONFMANSRC	= $(CONFNAME).rst
CONFMAN		= $(CONFNAME).5

MANPAGES	= $(TOOLMAN) $(CONFMAN)

GRAPH		= filegraph
DOTPDF		= $(GRAPH).pdf
DOT		= $(GRAPH).dot

DOCS		= $(DOTPDF) $(DOCPDF) $(MANPAGES)

DO_LATEXMK	= @latexmk -e '$$max_repeat = 5' -pdf -lualatex -silent $< >/dev/null
# latexmk does only one run on my machine, so we’re not going to rely on it
DO_LATEX	= @lualatex -interaction=batchmode $< >/dev/null
DO_GRAPHVIZ	= @dot -Tpdf -o $@ $< > /dev/null
DO_DOCUTILS	= @rst2man $< >$@ 2>/dev/null

doc: graph $(DOCPDF)
all: manuals doc
graph: $(DOTPDF)
manuals: $(TOOLMAN) $(CONFMAN)

$(DOCPDF): $(DOCSRC) graph
	@echo "creating PDF documentation ($@)"
	$(DO_LATEX)
	$(DO_LATEX)
	mv -f -- $(<:tex=pdf) $@

$(TOOLMAN): $(TOOLMANSRC)
	@echo "creating man page ($(TOOLMAN))"
	$(DO_DOCUTILS)

$(CONFMAN): $(CONFMANSRC)
	@echo "creating man page ($(CONFMAN))"
	$(DO_DOCUTILS)

$(DOTPDF): $(DOT)
	@echo "creating file graph ($(DOTPDF))"
	$(DO_GRAPHVIZ)

.PHONY: clean mrproper graph doc all manuals

clean:
	@$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg *.out

mrproper: clean
	@$(RM) -- $(DOCS)

# vim:noexpandtab:tabstop=8:shiftwidth=2