-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (49 loc) · 1.58 KB
/
Makefile
File metadata and controls
55 lines (49 loc) · 1.58 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
.PHONY := help clean depend build
.DEFAULT_GOAL := help
COLOR_RESET = \033[0m
COLOR_INFO = \033[32m
COLOR_COMMENT = \033[33m
## Displays this information
help:
@printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
@printf " make [target]\n\n"
@printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
@awk '/^[a-zA-Z\-0-9\.@]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
# SOURCE : http://stackoverflow.com/questions/10858261/abort-makefile-if-variable-not-set
# Check that given variables are set and all have non-empty values,
# die with an error otherwise.
#
# Params:
# 1. Variable name(s) to test.
# 2. (optional) Error message to print.
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))
## Cleanup previously compiled files
clean:
@rm -rf app/vendor
@echo "Removed application dependencies"
@rm -f patchtool.phar patchtool patchtool.phar.gz
@echo "Removed build artifacts"
## Install dependencies via composer
depend:
docker run --rm --interactive --tty --volume ${PWD}/app:/app composer install --ignore-platform-reqs
## Build phar file
build:
@if [ ! -d app/vendor ]; then\
echo "Missing vendor folder, run 'make depend'";\
exit 1;\
fi
php -f build.php
chmod +x patchtool.phar