gray/doc/Makefile
2022-05-11 01:14:59 +02:00

44 lines
852 B
Makefile

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