-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·156 lines (130 loc) · 3.46 KB
/
Makefile
File metadata and controls
executable file
·156 lines (130 loc) · 3.46 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
.DEFAULT_GOAL := all
ARGS = \
document.md \
--from=markdown \
--standalone \
--bibliography=bibliography.bib \
--smart \
ifndef DISABLE_REFS
ARGS += --filter pandoc-crossref
endif
LATEX_ARGS = \
$(ARGS) \
--include-after-body=appendix.tex \
--template=style/latex.tex \
--number-sections \
--natbib \
HTML_ARGS = \
--webtex \
ifndef DISABLE_REFS
HTML_ARGS += --filter pandoc-citeproc
endif
NON_LATEX_ARGS = \
appendix.md \
style/literatur.md \
--number-sections \
--csl style/ieee.csl \
FIGURES = $(wildcard figures/*.svg)
WATCH_SCRIPT = \
from livereload import Server, shell; \
server = Server(); \
server.watch('document.md', shell('make html', cwd = '.')); \
server.watch('presentation.md', shell('make presentation', cwd = '.')); \
server.serve(root = '.'); \
watch:
echo "$(WATCH_SCRIPT)" | python
hello:
@echo ""
@echo -e " \033[1mSuper awesome Thesis Builder v1.0\033[m"
@echo "-----------------------------------"
all: pdf html epub presentation
announce-figures-pdf:
@echo -e "> \033[1minkscape:\033[m SVG => PDF"
announce-figures-png:
@echo -e "> \033[1minkscape:\033[m SVG => PNG"
pdf: hello latex announce-figures-pdf figures-pdf build-latex
latex: compile-appendix-tex compile-acknowledgements-tex fix-mendeley-bug
@echo -e "> \033[1mpandoc:\033[m Markdown => Latex"
@pandoc \
metadata.yml \
$(LATEX_ARGS) \
--listings \
--table-of-contents \
--output=document.tex \
--default-image-extension=pdf \
html: hello fix-mendeley-bug
@echo -e "> \033[1mpandoc:\033[m Markdown => HTML"
@pandoc \
metadata.yml \
$(ARGS) \
$(HTML_ARGS) \
$(NON_LATEX_ARGS) \
--html-q-tags \
--table-of-contents \
--self-contained \
--output=document.html \
--css=style/html.css \
--default-image-extension=svg \
epub: hello announce-figures-png figures-png fix-mendeley-bug
@echo -e "> \033[1mpandoc:\033[m Markdown => EPUB"
@pandoc \
metadata.yml \
$(ARGS) \
$(NON_LATEX_ARGS) \
--write=epub3 \
--output=document.epub \
--epub-stylesheet=style/epub.css \
--default-image-extension=png \
presentation: hello announce-figures-png figures-png fix-mendeley-bug
@echo -e "> \033[1mpandoc:\033[m Presentation"
@pandoc \
$(HTML_ARGS) \
metadata.yml \
presentation.md \
style/literatur.md \
--template=style/presentation.html \
--variable=css:style/presentation.css \
--bibliography=bibliography.bib \
--standalone \
--to=revealjs \
--output=presentation.html \
--default-image-extension=png \
--mathjax \
--csl style/ieee.csl \
build-latex:
@echo -e "> \033[1mxelatex:\033[m Latex => PDF"
@./latexrun -O . \
-Wno-hyperref -Wno-scrextend \
--bibtex-cmd biber --latex-cmd xelatex document
compile-appendix-tex:
@pandoc \
metadata.yml \
appendix.md \
--listings \
--variable=documentclass:report \
--default-image-extension=pdf \
--output=appendix.tex \
--number-sections \
--smart
compile-acknowledgements-tex:
@pandoc \
acknowledgements.md \
--variable=documentclass:report \
--output=acknowledgements.tex \
--number-sections \
--smart
fix-mendeley-bug:
@echo -e "> fixing Mendeley bullshit"
@sed -i -e "s/{\\\_}/_/g" "bibliography.bib"
@sed -i -e "s/{\\\~}/~/g" "bibliography.bib"
figures-pdf: $(FIGURES:%.svg=%.pdf)
figures-png: $(FIGURES:%.svg=%.png)
%.pdf: %.svg
@echo -e " - $*"
@inkscape -A $*.pdf $*.svg >/dev/null 2>&1
%.png: %.svg
@echo -e " - $*"
@inkscape -d 192 -e $*.png $*.svg >/dev/null 2>&1
clean:
@./latexrun --clean-all
@rm -f figures/*.png figures/*.pdf \