-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (81 loc) · 1.8 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# https://learnxinyminutes.com/docs/make/
SHELL = /usr/bin/bash
VAR_FILE = variables.yaml
BIB_FILE = bib/refs.bib
# output file name
DATE = $$(date '+%Y%m%d')
FNAME = $$(niet first-name ${VAR_FILE})
LNAME = $$(niet last-name ${VAR_FILE})
MAT_NUM = $$(niet mat-number ${VAR_FILE})
COURSE_ID = $$(niet course-id ${VAR_FILE})
OUTPUT_FILE = ${DATE}_${LNAME}_${FNAME}_${MAT_NUM}_${COURSE_ID}.pdf
build:
$(export_listings)
$(run_code)
$(compile_thesis)
export_listings:
$(export_listings)
run_code:
$(run_code)
generate_plantuml:
$(generate_plantuml)
compile_thesis:
$(compile_thesis)
compile_complete_document:
$(compile_complete_document)
tidy_bib:
$(tidy_bib)
update_bib:
$(update_bib)
$(tidy_bib)
define export_listings
@echo "Exporting listings"
@code/.venv/bin/python\
code/utils/export_listings.py\
code output/listings.md\
# --tree
endef
define run_code
@echo "Running all code"
@for file in $(wildcard $(CURDIR)/code/*.py); do \
echo "Running $$file"; \
$(CURDIR)/code/.venv/bin/python "$$file"; \
done
endef
define generate_plantuml
@plantuml plantuml/*.puml -tsvg -o ../output/plantuml
endef
define compile_thesis
@echo "Compiling thesis"
@pandoc\
thesis.md -o output/${OUTPUT_FILE}\
-s -V papersize:a4\
--template=template/eisvogel.latex\
--metadata-file=variables.yaml\
--pdf-engine=xelatex\
--filter pandoc-include\
--filter pantable\
--filter pandoc-crossref\
--filter pandoc-mustache\
--filter pandoc-latex-environment\
--listings\
--citeproc
endef
define tidy_bib
@bibtex-tidy\
${BIB_FILE}\
--curly\
--numeric\
--tab\
--align=13\
--sort=year\
--duplicates=key,doi,citation\
--merge=combine\
--no-escape\
--sort-fields\
--trailing-commas\
--wrap=80
endef
define update_bib
@bibcure -i ${BIB_FILE} -o ${BIB_FILE}
endef