-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (47 loc) · 1.63 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
62
63
64
65
MKDIR := mkdir -p
RM := rm -rf
.SILENT:
.SUFFIXES:
.DELETE_ON_ERROR:
.PRECIOUS: %/.
%/.:
$(MKDIR) $@
.PHONY: install
install: vendor/autoload.php git/setup ## Install all depedencies
.PHONY: vendor/update
vendor/update: composer.lock
.PHONY: unit-tests
unit-tests: install ## Run unit tests
php tests/units/runner.php -ulr
.PHONY: unit-tests/loop
unit-tests/loop: install ## Run unit tests in an infinite loop
php tests/units/runner.php -ulr --loop
.PHONY: tests
tests: unit-tests
.PHONY: git/setup
git/setup: .git/hooks/pre-commit ## Install pre-commit hook for git.
.PHONY: export
export: | .git ## Generate a `./score.zip` archive from local git repository
git archive -o score.zip HEAD
vendor/autoload.php: composer.lock | bin/composer
bin/composer install
composer.lock: composer.json
bin/composer update
bin/composer: bin/. ## Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
if [ $$(wget -q -O - https://composer.github.io/installer.sig) != $$(php -r "echo hash_file('SHA384', 'composer-setup.php');") ]; then >&2 echo 'ERROR: Invalid installer signature'; exit 1; fi
php composer-setup.php --quiet
$(RM) composer-setup.php
mv ./composer.phar $@
.git/hooks/pre-commit: ./resources/pre-commit | .git
cp $^ $@
chmod u+x $@
.git:
git init
.PHONY: clean
clean: ## Remove empty directories and untracked files, use it CAREFULY!
find src tests/units/src -type d -empty -delete
git clean -f
.PHONY: help
help: ## Display this help.
@printf "$$(cat $(MAKEFILE_LIST) | egrep -h '^[^:]+:[^#]+## .+$$' | sed -e 's/:[^#]*##/:/' -e 's/\(.*\):/\\033[92m\1\\033[0m:/' | sort -d | column -c2 -t -s :)\n"