-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
44 lines (31 loc) · 1.22 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
## This Makefile is largely based on kjhealy's available at
## https://github.com/kjhealy/pandoc-templates/blob/master/examples/Makefile
## Additionally the following Stack Overflow question was used
## https://stackoverflow.com/questions/7004702/how-can-i-create-a-makefile-for-c-projects-with-src-obj-and-bin-subdirectories
# Directories
SRCDIR = src
BLDDIR = build
# Location of Pandoc support files.
TEMPLATES = ./templates
# All yaml files in the SRCDIR directory
SOURCES = $(wildcard $(SRCDIR)/*.yaml)
# All target files in the BLDDIR directory
TARGETS = $(patsubst $(SRCDIR)/%,$(BLDDIR)/%,$(SOURCES))
# Create filetype references using pattern substitutions
PDF=$(patsubst %.yaml,%.pdf,$(TARGETS))
TEX=$(patsubst %.yaml,%.tex,$(TARGETS))
# Define build types
all: $(PDF) $(TEX)
pdf: clean $(PDF) clean-tex
tex: clean-tex $(TEX)
## Define rules for filetypes:
# .tex
$(BLDDIR)/%.tex: $(SRCDIR)/%.yaml
pandoc --template=$(TEMPLATES)/quiz.xelatex.template -o $@ $<
# .pdf
$(BLDDIR)/%.pdf: $(SRCDIR)/%.yaml
pandoc --template=$(TEMPLATES)/quiz.xelatex.template --latex-engine=xelatex -o $@ $<
clean:
rm -f $(BLDDIR)/*.log $(BLDDIR)/*.aux $(BLDDIR)/*.tex $(BLDDIR)/*.pdf
clean-tex:
rm -f $(BLDDIR)/*.log $(BLDDIR)/*.aux $(BLDDIR)/*.tex