aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
blob: 6fa09b69c2dde981431098d93bcf4eb6a2bff0bb (plain) (blame)
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
include prelude.mk

PORT ?= 23666
$(eval $(call noexpand,PORT))

url := http://localhost:$(PORT)/
state := ./void.state

venv_dir := .venv
venv_activate := . '$(call escape,$(venv_dir)/bin/activate)'

.PHONY: all
all: serve

.PHONY: venv/reset
venv/reset:
	rm -rf -- '$(call escape,$(venv_dir))'
	mkdir -p -- '$(call escape,$(venv_dir))'
	python -m venv -- '$(call escape,$(venv_dir))'

.PHONY: venv
venv: venv/reset
	$(venv_activate) && pip install -q -r requirements.txt

.PHONY: serve
serve:
	$(venv_activate) && ./server.py --port '$(call escape,$(PORT))' --void '$(call escape,$(state))'

.PHONY: clean
clean:
	rm -f -- '$(call escape,$(state))'

.PHONY: view
view:
	xdg-open '$(call escape,$(url))' &> /dev/null

.PHONY: test
test:
	./test/test.sh