2022-08-10 09:57:15 +02:00
|
|
|
PANDOC = pandoc
|
2022-08-14 17:46:33 +02:00
|
|
|
LATEXMK = latexmk -cd -pdf -silent
|
2022-08-10 09:57:15 +02:00
|
|
|
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)
|
2022-08-10 14:33:33 +02:00
|
|
|
MAN_FILTER = $(MANUAL_ROOT)/filter_man.lua
|
2022-08-10 09:57:15 +02:00
|
|
|
|
|
|
|
TEX_PATH = $(MANUAL_ROOT)/tex
|
2022-08-12 08:13:48 +02:00
|
|
|
MAN_TEX_DIR = $(TEX_PATH)/man
|
2022-08-10 09:57:15 +02:00
|
|
|
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)
|
2022-08-12 08:13:48 +02:00
|
|
|
%.pdf: %.tex $(MAN_TEX) $(wildcard $(TEX_PATH)/*.tex)
|
2022-08-14 17:46:33 +02:00
|
|
|
$(LATEXMK) $<
|
2022-08-10 09:57:15 +02:00
|
|
|
|
|
|
|
doc-man: $(MAN_DSTS)
|
|
|
|
find assets/manual/man -regex '.*/[^.]+\.[^.]+$$' | tar -cJf ${MANUAL_ROOT}/man.tar.xz -T -
|
|
|
|
|
2022-08-10 14:33:33 +02:00
|
|
|
%:: %.md ${MAN_FILTER}
|
|
|
|
$(PANDOC) -L ${MAN_FILTER} -s -t man -o $@ $<
|
2022-08-10 09:57:15 +02:00
|
|
|
|
2022-08-10 14:33:33 +02:00
|
|
|
%.tex:: %.md ${MAN_FILTER}
|
2022-08-12 08:13:48 +02:00
|
|
|
$(PANDOC) -L ${MAN_FILTER} -t latex -o $(MAN_TEX_DIR)/$(notdir $@) $<
|
2022-08-11 19:07:42 +02:00
|
|
|
|
|
|
|
$(MAN_TEX): $(MAN_TEXS)
|
2022-08-12 08:13:48 +02:00
|
|
|
find $(MAN_TEX_DIR) -name '*.tex' -printf '\\include{man/%f}\n' | sort | sed '1s/^\\include/\\input/' > $(MAN_TEX)
|