forked from UCL/rsd-engineeringcourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
119 lines (91 loc) · 3.12 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
PANDOC=pandoc
ROOT=""
PANDOCARGS=-t revealjs -s -V theme=night --css=http://lab.hakim.se/reveal-js/css/theme/night.css \
--css=$(ROOT)/css/ucl_reveal.css --css=$(ROOT)/site-styles/reveal.css \
--default-image-extension=png --highlight-style=zenburn --mathjax -V revealjs-url=http://lab.hakim.se/reveal-js
NOTEBOOKS=$(filter-out %.v2.ipynb %.nbconvert.ipynb,$(sort $(wildcard ch*/*.ipynb)))
SVGS=$(wildcard ch*/*.svg)
HTMLS=$(NOTEBOOKS:.ipynb=.html)
EXECUTED=$(NOTEBOOKS:.ipynb=.nbconvert.ipynb)
PNGS=$(SVGS:.svg=.png)
NBV2=$(NOTEBOOKS:.ipynb=.v2.ipynb)
default: _site
%/slides.html: %/*.md Makefile
cat $^ | $(PANDOC) $(PANDOCARGS) -o $@
%.png: %.py Makefile
python $< $@
%.png: %.nto Makefile
neato $< -T png -o $@
%.png: %.dot Makefile
dot $< -T png -o $@
%.png: %.svg Makefile
dbus-run-session inkscape -z -e $@ -w 600 $<
%.png: %.uml plantuml.jar Makefile
java -Djava.awt.headless=true -jar plantuml.jar -p < $< > $@
%.html: %.nbconvert.ipynb Makefile jekyll.tpl
jupyter nbconvert --to html --template jekyll.tpl --stdout $< > $@
%.v2.ipynb: %.nbconvert.ipynb
jupyter nbconvert --to notebook --nbformat 2 --stdout $< > $@
%.nbconvert.ipynb: %.ipynb
jupyter nbconvert --to notebook --allow-errors --ExecutePreprocessor.timeout=120 --execute --stdout $< > $@
notes.pdf: combined.ipynb $(PNGS) Makefile
jupyter nbconvert --to pdf --template latex.tplx $<
mv combined.pdf notes.pdf
combined.ipynb: $(EXECUTED)
python nbmerge.py $^ $@
sed -i -e 's/\.svg/\.png/g' $@
notes.tex: combined.ipynb $(PNGS) Makefile
jupyter nbconvert --to latex --template latex.tplx $<
mv combined.tex notes.tex
notebooks.zip: ${NBV2}
zip -r notebooks $^
master.zip: Makefile
rm -f master.zip
wget https://github.com/UCL-RITS/indigo-jekyll/archive/master.zip
ready: indigo $(HTMLS) # notes.pdf notebooks.zip
indigo-jekyll-master: Makefile master.zip
rm -rf indigo-jekyll-master
unzip master.zip
touch indigo-jekyll-master
indigo: indigo-jekyll-master Makefile
cp -r indigo-jekyll-master/indigo/images .
cp -r indigo-jekyll-master/indigo/js .
cp -r indigo-jekyll-master/indigo/css .
cp -r indigo-jekyll-master/indigo/_includes .
cp -r indigo-jekyll-master/indigo/_layouts .
cp -r indigo-jekyll-master/indigo/favicon* .
touch indigo
plantuml.jar:
wget http://sourceforge.net/projects/plantuml/files/plantuml.jar/download -O plantuml.jar
.PHONY: ready
_site: ready
jekyll build --verbose
preview: ready
jekyll serve --verbose
clean:
rm -f ch*/generated/*.png
rm -rf ch*/*.html
rm -f ch*/*.pyc
rm -f index.html
rm -rf _site
rm -rf images js css _includes _layouts favicon* master.zip indigo-jekyll-master
rm -f indigo
rm -f ch01python/analyzer.py
rm -f ch01python/eight
rm -f ch01python/eight.py
rm -rf ch01python/module1/
rm -f ch01python/pretty.py
rm -f ch*/*.nbconvert.ipynb
rm -rf ch*/*.v2.ipynb
rm -rf combined*
rm -f notes.pdf
rm -f notes.tex
rm -f ch04packaging/greeter.py
rm -f ch04packaging/map.png
rm -f ch05construction/anotherfile.py
rm -f ch05construction/config.yaml
rm -f ch05construction/context.py
rm -f ch06design/fixed.png
rm -f ch07dry/datasource*.yaml
rm -f ch07dry/example.yaml
rm -f notebooks.zip