aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2022-08-10 09:57:15 +0200
committerY. Wang <yw05@forksworld.de>2022-08-10 09:57:15 +0200
commit4f9bd72a847ccec3b580def8a4ca2ee12e453477 (patch)
tree03d22fb205cfd4bf128e36a84ea94f43ac6267df /Makefile
parent5cc7f50bad779e4f4efb747a74bbce53a7e05cd3 (diff)
downloadadvtrains-4f9bd72a847ccec3b580def8a4ca2ee12e453477.tar.gz
advtrains-4f9bd72a847ccec3b580def8a4ca2ee12e453477.tar.bz2
advtrains-4f9bd72a847ccec3b580def8a4ca2ee12e453477.zip
Reformat RWT documentation as manual pages
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 36 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..fad6c8a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+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)
+%.pdf:: %.tex $(MAN_TEX)
+ $(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)
+
+%.tex:: %.md
+ $(PANDOC) -L ${MANUAL_ROOT}/filter_man_md2tex.lua -t latex -o $@ $<