This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
77 lines (51 loc) · 2.26 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
66
67
68
69
70
71
72
73
74
75
76
77
ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
export PATH:=$(ROOT_DIR)node_modules/.bin/:$(PATH)
SHELL :=/bin/bash -O extglob
ignore:=$(shell git ls-files --others -i --exclude-standard src)
src:=$(filter-out $(ignore) , $(shell cd $(ROOT_DIR); find src -type f))
js-source:=$(wildcard src/js/*)
handlebars-source:=$(wildcard src/*.hbs)
handlebars-igore:=$(wildcard src/partials/*.hbs) $(wildcard src/helpers/*.hbs)
handlebars-dist:=$(handlebars-source:src/%.hbs=dist/%.html)
css-dir:=src/css
css-map-source:=\
node_modules/sweetalert2/dist/sweetalert2.min.css\
node_modules/leaflet-easybutton/src/easy-button.css\
node_modules/leaflet/dist/leaflet.css\
$(css-dir)/leaflet-sidebar.css\
$(css-dir)/spel.css\
$(css-dir)/Leaflet.Photo.css\
other-src:= $(filter-out $(js-source) $(css-map-source) $(handlebars-source) $(handlebars-igore), $(src))
other-dist:= $(other-src:src/%=dist/%)
leaflet-images-src:=$(wildcard node_modules/leaflet/dist/images/*)
leaflet-images-dist:=$(leaflet-images-src:node_modules/leaflet/%=%)
VPATH = $(ROOT_DIR)
.PHONY: clean build
build: dist/js/bundle.js dist/css/spel.css $(other-dist) $(leaflet-images) $(leaflet-images-dist) $(handlebars-dist) | dist/
dist/:
git clone -b gh-pages --single-branch $(ROOT_DIR) $(ROOT_DIR)/dist
cd $(ROOT_DIR)dist ;\
git remote set-url origin [email protected]:kwibus/geesten-in-moerenburg.git
$(MAKE) clean
dist/js/bundle.js: $(js-source) dist/js
browserify -g uglifyify $(ROOT_DIR)src/js/map.js > $(ROOT_DIR)dist/js/bundle.js
dist/js: | dist/
mkdir -p $(ROOT_DIR)dist/js
dist/css: | dist/
mkdir -p $(ROOT_DIR)dist/css
dist/css/spel.css: $(css-map-source) | dist/css
cleancss -o $(ROOT_DIR)/dist/css/spel.css $(css-map-source)
dist/css/%.min.css: src/css/%.min.css | dist/css
cp $(ROOT_DIR)$< $(ROOT_DIR)$@
dist/css/%.css: src/css/%.css | dist/css
cleancss -o $(ROOT_DIR)$@ $(ROOT_DIR)$<
dist/%.html : src/%.hbs $(handlebars-igore)
cd $(ROOT_DIR); hbs --partial src/partials/'*' --helper ./src/helpers/test.js -o dist -- $<
dist/images: | dist/
mkdir -p $(ROOT_DIR)dist/images
dist/images/%: node_modules/leaflet/dist/images/% | dist/images
cp $(ROOT_DIR)$< $(ROOT_DIR)$@
dist/%: src/%
install -D $(ROOT_DIR)$< $(ROOT_DIR)$@
clean:
rm -rf $(ROOT_DIR)dist/!(.git|.|..)