aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: c0840b1457119804227aa0e3de7ce6adfe291f78 (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
PATH := vendor/bin:node_modules/.bin:$(PATH)
GIT_VERSION := $(shell git --no-pager describe --always --tags)

js_sources := $(wildcard src/*.js)
js_bundles := $(js_sources:src/%.js=assets/js/%.bundle.js)
zip_release := $(GIT_VERSION:%=dist/w_cms_%.zip)

build: clean $(zip_release)

install: php_dependencies $(js_bundles)

dist/w_cms_%.zip: install
	@echo "Building Zip release..."
	mkdir -p $(dir $@)
	zip -r $@ \
		app \
		assets \
		vendor \
		.htaccess \
		index.php \
		LICENSE.md \
		README.md \
		-x "*test*" \
		-x "*docs*"

assets/js/%.bundle.js: src/%.js js_dependencies
	@echo "Building JS Bundles..."
	mkdir -p $(dir $@)
	webpack --env prod

php_dependencies:
	@echo "Installing PHP dependencies..."
	composer install --no-dev --prefer-dist

php_clean:
	@echo "Cleaning PHP..."
	rm -rf vendor

js_dependencies:
	@echo "Installing JS dependencies..."
	npm install

js_clean:
	@echo "Cleaning JS..."
	rm -rf node_modules

clean: php_clean js_clean
	rm -rf dist