-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (61 loc) · 1.79 KB
/
Makefile
File metadata and controls
88 lines (61 loc) · 1.79 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
############################
# Usage
# make # converts all *.md files to *.pdf and *.pptx files using pandoc
# make clean # cleans up *.pdf and *.pptx artifacts
############################
all:
############################
# Common
############################
PANDOC = pandoc
PUBLISH_DIR = publish
############################
# Targets
############################
SRC = $(filter-out README.md, $(wildcard *.md) $(wildcard **/*.md))
PDF = $(SRC:.md=.pdf)
PPTX = $(SRC:.md=.pptx)
PDF_PUBLISH = $(addprefix $(PUBLISH_DIR)/,$(PDF))
SVG = $(wildcard *.svg) $(wildcard **/*.svg)
SVG_PDF = $(SVG:.svg=.pdf)
DOT = $(wildcard *.dot) $(wildcard **/*.dot)
DOT_PDF = $(DOT:.dot=.pdf)
############################
# Goals
############################
.PHONY: all clean pdf pptx publish
.DEFAULT_GOAL := all
all: pdf
publish: $(PDF_PUBLISH)
pdf: $(PDF)
pptx: $(PPTX)
clean:
@echo "Cleaning up..."
rm -rvf $(PDF) $(PPTX) $(SVG_PDF) $(DOT_PDF)
############################
# Publish patterns
############################
$(PDF_PUBLISH): $(PUBLISH_DIR)/%.pdf: %.pdf
@mkdir -p $(@D)
cp $< $@
############################
# Pandoc patterns
############################
PANDOC_ARGS :=
$(PDF): %.pdf: %.md
$(PANDOC) $(PANDOC_ARGS) -t beamer --pdf-engine xelatex $< -o $@
%.pptx: %.md
$(PANDOC) $(PANDOC_ARGS) $< -o $@
############################
# Image patterns
############################
$(SVG_PDF): %.pdf: %.svg
inkscape -D $< -o $@
$(DOT_PDF): %.pdf: %.dot
dot -Tpdf $< -o $@
############################
# Custom patterns
############################
pres.pdf pres.pptx pres.odp: pres.yaml $(filter images/%,$(DOT_PDF) $(SVG_PDF))
pres.pdf: pres-preamble.tex pres-template.tex
pres.pdf: PANDOC_ARGS = pres.yaml -H pres-preamble.tex --listings --template pres-template.tex --slide-level=1