This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
69 lines (45 loc) · 1.55 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
sections = $(wildcard sections/*.md)
common_build_args = \
--lua-filter=lua-filters/abstract-to-meta.lua \
--lua-filter=lua-filters/include-files.lua \
--filter pandoc-plantuml \
--filter pandoc-xnos \
--lua-filter=lua-filters/plantuml-converter.lua \
--lua-filter=lua-filters/short-captions.lua \
--metadata-file=./metadata.yaml \
--citeproc \
--standalone
.PHONY: default clean clean_diagrams clean_build build build_html build_pdf build_sections force pdf html
default: clean_build build
force:
clean: clean_diagrams clean_build
clean_diagrams: $(call rwildcard,diagrams,*.png)
@echo "Clean compiled plantuml diagram pngs."
@rm -f $?
clean_build:
@echo "Clean build directory."
@rm -rf ./public
@mkdir -p ./public
build: html pdf
build_html:
@echo "Build HTML version"
@mkdir -p ./public
@pandoc ${common_build_args} --toc --output=public/index.html ${sections}
@cp -R images public/
@cp -R plantuml-images public/
@cp -R diagrams public/
@rm -rf public/diagrams/.gitignore
html: build_html
build_pdf:
@echo "Build PDF version"
@mkdir -p ./public
@pandoc ${common_build_args} --output=public/report.pdf ${sections}
pdf: build_pdf
sections/%.md: force
@echo "Build section $@ to pdf"
@pandoc $(filter-out --metadata-file=./metadata.yaml,$(common_build_args)) \
--metadata-file=./section-metadata.yaml \
--output=public/$(patsubst sections/%,%,$(patsubst %.md,%.pdf,$(@))) \
$@
build_sections: $(foreach section,$(sections),$(section))