rdv-info-markdown/Makefile

49 lines
1.2 KiB
Makefile

SOURCE_FOLDER := sources
# Liste les fichiers sources.
MD_UNSORTED := $(wildcard $(SOURCE_FOLDER)/*.md)
# Ordonne les fichiers sources sur la base du début numérique du nom des
# fichiers.
MD_SORTED := $(shell printf '%s\n' $(MD_UNSORTED) | sort -t- -k1,1n)
.PHONY: all
all: pdf
# Construit le fichier HTML.
.PHONY: html
html: $(MD_SORTED)
pandoc \
--to=html --standalone \
--template=static/template.html --css=static/style.css \
-V static='./static' \
--citeproc \
--toc --toc-depth=2 \
--out=document.html $(MD_SORTED)
# Construit le fichier PDF.
.PHONY: pdf
pdf: $(MD_SORTED)
pandoc \
--to=pdf --pdf-engine=pagedjs-cli --embed-resources=true \
--template=static/template.html --css=static/style.css \
-V noscript=true -V static='./static' \
--citeproc \
--toc --toc-depth=2 \
--out=document.pdf $(MD_SORTED)
# Reconstruit le fichier HTML à la modification des autres fichiers.
.PHONY: watch
watch:
watchexec -r -w . -i document.html \
-- make html
# Supprime les fichiers construits lorsqu'ils ne sont plus nécessaire.
.PHONY: clean
clean:
rm -f *.html *.pdf
# Lance un serveur web pour servir le HTML.
.PHONY: serve
serve:
watchexec -r -w . "python -m http.server"