-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (52 loc) · 1.19 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
SHELL = /bin/bash
.DEFAULT_GOAL := all
HERE := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
# https://mwop.net/blog/2023-12-11-advent-makefile.html
##@ help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: all
all: analyze lint tests ## (default) analyze & tests
# ### #
.PHONY: analyze
analyze: ## Static analysis with PHPStan
@echo
@echo "--> Analyze: PHPStan"
@echo
vendor/bin/phpstan
@echo
.PHONY: lint
lint: ## Lint check
@echo
@echo "--> Lint"
@echo
php -l server.php
php -l lib/protocols/memcached-text.php
php -l lib/storage/sqlite.php
@echo
.PHONY: tests
tests: server-start ## Run Pest tests
@echo
@echo "--> Tests: Pest"
@echo
bash -c "./vendor/bin/pest || php server.php stop"
@echo
@echo "--> Server: stop"
@echo
php server.php stop
@echo
# ### #
.PHONY: server-start
server-start:
@echo
@echo "--> Server: start"
@echo
php server.php start -d
@echo
.PHONY: server-stop
server-stop:
@echo
@echo "--> Server: stop"
@echo
php server.php stop
@echo