-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (62 loc) · 2.21 KB
/
Copy pathMakefile
File metadata and controls
74 lines (62 loc) · 2.21 KB
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
SHELL := /bin/bash
.PHONY: install all analyze docs clean composer
install: | vendor
all: analyze docs
analyze: | vendor
$(COMPOSER) normalize
touch -m composer.lock
$(COMPOSER) exec -v parallel-lint -- src
$(COMPOSER) exec -v php-cs-fixer -- fix
$(COMPOSER) exec -v phpcpd -- --fuzzy --min-lines=2 --min-tokens=15 --progress src
$(COMPOSER) exec -v phpmd -- src text phpmd.xml
$(COMPOSER) exec -v phpa -- src
$(COMPOSER) exec -v phan -- --allow-polyfill-parser --directory src --unused-variable-detection --dead-code-detection --target-php-version 7.2
$(COMPOSER) exec -v phpstan -- analyse --level=7 src
$(COMPOSER) exec -v psalm -- --stats --long-progress --find-dead-code=always --show-snippet=true --find-unused-code=always --show-info=true
docs: | vendor
[ -d build ] || mkdir build
$(COMPOSER) exec -v phploc -- --log-xml=build/phploc.xml src
$(COMPOSER) exec -v phpdox -- --file phpdox-composer.xml
$(COMPOSER) exec -v phpdox
clean::
@echo Remove all generated files
rm -f composer.phar
rm -f .php_cs.cache
rm -f composer.lock
@echo Remove all generated directories
rm -rf vendor
rm -rf build
rm -rf docs
# # Or
# grep -v -E "^(#.+)?$" .gitignore vendor-bin/.gitignore |\
# sed 's/.gitignore://' | sed 's#^#./#' | sed 's#//#/#' |\
# xargs -I % rm -rf %
# # Or
# find . -name .gitignore | xargs -I % sh -c "sed '/^$/d' % | sed '/^#/d' | sed 's#^#%#'" |\
# sed 's#/.gitignore#/#' | sed 's#//#/#' | sed '/!/d' |\
# xargs -I % rm -rf %
# Files
vendor: composer.lock
$(COMPOSER) install --optimize-autoloader --prefer-dist
composer.lock: composer.json
$(COMPOSER) update --prefer-lowest --prefer-dist
composer.phar:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --quiet
rm composer-setup.php
# Check Composer installation
ifneq ($(shell command -v composer > /dev/null ; echo $$?), 0)
ifneq ($(MAKECMDGOALS),composer.phar)
$(shell $(MAKE) composer.phar)
endif
COMPOSER=php composer.phar
else
COMPOSER=composer
endif
# Magic "make composer ..." command
ifeq ($(firstword $(MAKECMDGOALS)),composer)
COMPOSER_ARGS=$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
$(eval $(COMPOSER_ARGS):;@:)
endif
composer:
$(COMPOSER) $(COMPOSER_ARGS)