gray/doc/Makefile

44 lines
883 B
Makefile
Raw Normal View History

2021-12-15 02:30:58 +01:00
# Load the configure script variables
-include ../configure.mk
##
## Options
##
# Pandoc flags
FLAGS = --filter pandoc-crossref --citeproc --toc --number-sections
PDF_FLAGS = --pdf-engine=xelatex
2021-12-15 02:31:01 +01:00
HTML_FLAGS = --standalone --katex$(KATEX_URL) --lua-filter filters/add-anchors.lua
2021-12-15 02:30:58 +01:00
# Rebuild everything if the makefile changed
.EXTRA_PREREQS += Makefile
# User manual
DOCDIR = ../build/share/doc
2021-12-15 02:30:58 +01:00
SECTIONS = $(wildcard [0-9].*.md)
MANUALS = $(addprefix $(DOCDIR)/,manual.html manual.pdf res)
##
## Targets
##
.PHONY: all clean
2021-12-15 02:31:18 +01:00
all: $(MANUALS) $(MANPAGES)
2021-12-15 02:30:58 +01:00
clean:
rm -r build
$(DOCDIR)/manual.html: $(SECTIONS) res | $(DOCDIR)
2021-12-15 02:31:18 +01:00
pandoc $(FLAGS) $(HTML_FLAGS) $(filter %.md, $^) -o '$@'
2021-12-15 02:30:58 +01:00
$(DOCDIR)/res: res | $(DOCDIR)
cp -Tfr $^ '$@'
2021-12-15 02:30:58 +01:00
$(DOCDIR)/manual.pdf: $(SECTIONS) | $(DOCDIR)
2021-12-15 02:31:18 +01:00
pandoc $(FLAGS) $(PDF_FLAGS) $^ -o '$@'
2021-12-15 02:30:58 +01:00
# Create directories
$(DOCDIR):
2021-12-15 02:31:18 +01:00
mkdir -p '$@'