2022-08-10 09:57:15 +02:00
|
|
|
PANDOC = pandoc
|
|
|
|
LATEX = pdflatex
|
|
|
|
LATEXMK = latexmk
|
|
|
|
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)
|
|
|
|
|
|
|
|
TEX_PATH = $(MANUAL_ROOT)/tex
|
|
|
|
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-10 11:16:05 +02:00
|
|
|
%.pdf:: %.tex $(MAN_TEX) $(wildcard $(TEX_PATH)/*.tex)
|
2022-08-10 09:57:15 +02:00
|
|
|
$(LATEXMK) -cd -pdf $<
|
|
|
|
|
|
|
|
doc-man: $(MAN_DSTS)
|
|
|
|
find assets/manual/man -regex '.*/[^.]+\.[^.]+$$' | tar -cJf ${MANUAL_ROOT}/man.tar.xz -T -
|
|
|
|
|
|
|
|
%:: %.md
|
|
|
|
$(PANDOC) -s -t man -o $@ $<
|
|
|
|
|
|
|
|
$(MAN_TEX): $(MAN_TEXS)
|
|
|
|
find $(MAN_PATH) -name '*.tex' -printf '\\input{../man/%P}\n' | sort > $(MAN_TEX)
|
|
|
|
|
2022-08-10 11:16:05 +02:00
|
|
|
%.tex:: %.md ${MANUAL_ROOT}/filter_man_md2tex.lua
|
2022-08-10 09:57:15 +02:00
|
|
|
$(PANDOC) -L ${MANUAL_ROOT}/filter_man_md2tex.lua -t latex -o $@ $<
|