-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (66 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
SOURCES := $(filter-out ./src/controls.py, $(wildcard ./src/*.py))
NOTEBOOKS := $(patsubst ./src/%.py,./build/%.ipynb,$(SOURCES))
.PHONY: default
default: help
.PHONY: help
help:
@echo
@echo "Photonics Project Notebooks"
@echo "==========================="
@echo "Below are the available \`make\` targets for the Photoics Project Notebooks package."
@echo
@echo "Build:"
@echo " install-requirements"
@echo " install the requirements in the current Python environment"
@echo " lowtran"
@echo " compile and run lowtran to construct the data tables"
@echo " notebooks"
@echo " build the notebooks"
@echo
@echo "Development:"
@echo " start-dev"
@echo " watch Python source files and convert to IPython notebooks"
@echo " run Voila server"
@echo " stop-dev"
@echo " terminate the background processes initiated by \`start-dev\`"
@echo
.PHONY: install-requirements
install-requirements:
$(MAKE) -C ./requirements/ install
.PHONY: all
all: lowtran notebooks
.PHONY: build
build: all | ./build/
cp ./lowtran/lowtran7.npz ./build/
cp ./src/controls.py ./build/
cp -r ./src/templates ./build/
.PHONY: lowtran
lowtran:
make -C lowtran
.PHONY: notebooks
notebooks: $(NOTEBOOKS)
.PHONY: check
check: build
pytest --nbmake ./build/
.PHONY: start-dev
start-dev: stop-dev build
watchmedo shell-command ./src/ --recursive --patterns="*.py;*.vue" --command='make build' \
& echo "$$!" >> watchmedo.pid
voila --debug ./build/ \
& echo "$$!" >> voila.pid
.PHONY: stop-dev
stop-dev:
- pkill -F watchmedo.pid
- pkill -F voila.pid
- rm watchmedo.pid
- rm voila.pid
.PHONY: clean
clean:
- rm -rf ./build
.PHONY: clean-all
clean-all: clean
make clean -C lowtran
./build/:
mkdir -p ./build
./build/%.ipynb: ./src/%.py | ./build/
jupytext --from py:percent --to notebook --output $@ $<