blob: 275478408b5d70234d6659f57a19c367443fd680 (
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
|
PANDOC = pandoc
LATEXMK = latexmk -cd -pdf -silent
LUA = luajit
MANUAL_ROOT = assets/manual
MAN_PATH = $(MANUAL_ROOT)/man
MAN_SRCS = $(wildcard $(MAN_PATH)/*/*.md)
MAN_DSTS = $(MAN_SRCS:%.md=%)
MAN_TEXS = $(MAN_SRCS:%.md=%.tex)
MAN_FILTER = $(MANUAL_ROOT)/filter_man.lua
TEX_PATH = $(MANUAL_ROOT)/tex
MAN_TEX_DIR = $(TEX_PATH)/man
MAN_TEX = $(TEX_PATH)/man.tex
TEX_MAIN_SRCS = $(wildcard $(TEX_PATH)/*manual.tex)
TEX_MAIN_DSTS = $(TEX_MAIN_SRCS:%.tex=%.pdf)
all: doc
doc: doc-pdf doc-man
doc-pdf: $(TEX_MAIN_DSTS)
%.pdf: %.tex $(MAN_TEX) $(wildcard $(TEX_PATH)/*.tex)
$(LATEXMK) $<
doc-man: $(MAN_DSTS)
find assets/manual/man -regex '.*/[^.]+\.[^.]+$$' | tar -cJf ${MANUAL_ROOT}/man.tar.xz -T -
%:: %.md ${MAN_FILTER}
$(PANDOC) -L ${MAN_FILTER} -s -t man -o $@ $<
%.tex:: %.md ${MAN_FILTER}
$(PANDOC) -L ${MAN_FILTER} -t latex -o $(MAN_TEX_DIR)/$(notdir $@) $<
$(MAN_TEX): $(MAN_TEXS)
find $(MAN_TEX_DIR) -name '*.tex' -printf '\\include{man/%f}\n' | sort | sed '1s/^\\include/\\input/' > $(MAN_TEX)
|