summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: bef809347dfbd3c8ecaf2ba778d3fa48b6065912 (plain)
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
# Makefile for building the project
app_name=$(notdir $(CURDIR))
build_directory=$(CURDIR)/build/artifacts/source
package_name=$(build_directory)/$(app_name)
npm=$(shell which npm)

all: build

.PHONY: build
build:
	make composer
	make npm

.PHONY: composer
composer:
ifeq (, $(shell which composer))
	@echo "Using composer from website"
	curl -sS https://getcomposer.org/installer | php
	php composer.phar install --prefer-dist
	php composer.phar update --prefer-dist
	rm -f composer.phar
else
	composer install --prefer-dist
	composer update --prefer-dist
endif

.PHONY: npm
npm:
	cd js && $(npm) run build

.PHONY: clean
clean:
	rm -rf ./build

.PHONY: distclean
distclean: clean
	rm -rf vendor
	rm -rf js/vendor
	rm -rf js/node_modules

.PHONY: dist
dist:
	make clean
	make build
	make test
	mkdir -p $(build_directory)
	tar cvzf $(package_name).tar.gz ../$(app_name) \
	--exclude-vcs \
	--exclude=../$(app_name)/build \
	--exclude=../$(app_name)/js/node_modules \

.PHONY: test
test:
	cd js && $(npm) run test
	phpunit -c phpunit.xml
	phpunit -c phpunit.integration.xml