1all: clean coverage docs
2
3docs:
4	cd docs && make html
5
6view-docs:
7	open docs/_build/html/index.html
8
9start-server: stop-server
10	node tests/Client/server.js &> /dev/null &
11
12stop-server:
13	@PID=$(shell ps axo pid,command \
14	  | grep 'tests/Client/server.js' \
15	  | grep -v grep \
16	  | cut -f 1 -d " "\
17	) && [ -n "$$PID" ] && kill $$PID || true
18
19test: start-server
20	vendor/bin/phpunit $(TEST)
21	$(MAKE) stop-server
22
23coverage: start-server
24	vendor/bin/phpunit --coverage-html=build/artifacts/coverage $(TEST)
25	$(MAKE) stop-server
26
27view-coverage:
28	open build/artifacts/coverage/index.html
29
30clean:
31	rm -rf build/artifacts/*
32	cd docs && make clean
33
34tag:
35	$(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1"))
36	@echo Tagging $(TAG)
37	chag update -m '$(TAG) ()'
38	git add -A
39	git commit -m '$(TAG) release'
40	chag tag
41
42perf: start-server
43	php tests/perf.php
44	$(MAKE) stop-server
45
46.PHONY: docs
47