-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (38 loc) · 1.71 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
_: list
## Config
PHPCS_CONFIG=tools/phpcs.xml
PHPSTAN_CONFIG=tools/phpstan.neon
PHPSTAN_BASELINE_CONFIG=tools/phpstan.baseline.neon
## Install
update: ## Update all dependencies
make update-php
update-php: ## Update PHP dependencies
composer update
## QA
cs: ## Check PHP files coding style
mkdir -p var/tools/PHP_CodeSniffer
$(PRE_PHP) "vendor/bin/phpcs" src --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS)
csf: ## Fix PHP files coding style
mkdir -p var/tools/PHP_CodeSniffer
$(PRE_PHP) "vendor/bin/phpcbf" src --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS)
phpstan: ## Analyse code with PHPStan
mkdir -p var/tools
$(PRE_PHP) "vendor/bin/phpstan" analyse src -c $(PHPSTAN_CONFIG) $(ARGS)
phpstan-baseline: ## Add PHPStan errors to baseline
make phpstan ARGS="-b $(PHPSTAN_BASELINE_CONFIG)"
## Utilities
.SILENT: $(shell grep -h -E '^[a-zA-Z_-]+:.*?$$' $(MAKEFILE_LIST) | sort -u | awk 'BEGIN {FS = ":.*?"}; {printf "%s ", $$1}')
list:
awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"}'
@max_len=0; \
for target in $$(grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "} {print $$1}'); do \
len=$${#target}; \
if [ $$len -gt $$max_len ]; then \
max_len=$$len; \
fi \
done; \
awk -v max_len=$$max_len 'BEGIN {FS = ":.*?## "; last_section=""} \
/^## /{last_section=sprintf("\n\033[1m%s\033[0m", substr($$0, 4)); next} \
/^[a-zA-Z_-]+:.*?## /{if (last_section != "") { printf "%s\n", last_section; last_section=""; } printf " \033[36m%-*s\033[0m %s\n", max_len + 1, $$1, $$2}' $(MAKEFILE_LIST)
PRE_PHP=XDEBUG_MODE=off
LOGICAL_CORES=$(shell nproc || sysctl -n hw.logicalcpu || wmic cpu get NumberOfLogicalProcessors || echo 4)