Makefile 1.02 KB
Newer Older
1 2 3 4 5 6 7

IPYNBDIR := ipynb

IPYNBFILES := $(shell find $(IPYNBDIR) -name '*.ipynb' | grep -v ipynb_checkpoints)

IPYNBPRES = $(addsuffix .slides.html, $(basename $(IPYNBFILES)))

paugier's avatar
paugier committed
8 9
# TPL_FILE = ipynb/slides_reveal_wide.tpl
TPL_FILE = ipynb/slides_reveal.tpl
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

define STR_HELP
This makefile can be used for

help: print this help.

lab: run jupyter-lab.

presentations: build the html presentations.

serve: launch a small server to display the notebooks with reveal.js

endef

export STR_HELP

paugier's avatar
paugier committed
26
.PHONY: help lab serve presentations ipynb/index.rst
27 28 29 30 31 32 33

help:
	@echo "$$STR_HELP"

clean:
	rm -f ipynb/*.slides.html
	rm -f ipynb/index.html
paugier's avatar
paugier committed
34
	rm -rf ipynb/tmp
35 36 37 38

lab:
	jupyter-lab

paugier's avatar
paugier committed
39
ipynb/index.rst:
40
	python3 ipynb/make_index.py
paugier's avatar
paugier committed
41

42 43 44
ipynb/index.html: ipynb/index.rst
	cd $(IPYNBDIR) && rst2html5 index.rst > index.html

paugier's avatar
paugier committed
45 46
%.slides.html: %.ipynb $(TPL_FILE)
	jupyter-nbconvert $< --reveal-prefix='./reveal.js' --to slides --template $(TPL_FILE)
47 48 49 50 51

presentations: $(IPYNBPRES) ipynb/index.html

serve: $(IPYNBPRES) ipynb/index.html
	cd $(IPYNBDIR) && python3 -m http.server