-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (51 loc) · 2.74 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
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
TARGETS := dist/assets/js/odyssey.js dist/assets/js/odyssey.min.js dist/assets/js/init.js manifester/world/cities.json manifester/world/trips.json dist/assets/world.json dist/assets/css/odyssey.css
seed := $(shell cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1)
LIVEARGS := src/Main.elm -d dist --pushstate --open -- --output=dist/assets/js/odyssey.js
#LIVEARGS := src/Main.elm -S -c ../localhost.pem -k ../localhost.key -d dist --pushstate --open -- --output=dist/assets/js/odyssey.js
.PHONY: clean build rebuild deploy clearthumb prodindex debugindex prodcss debugcss
prodcss: src/odyssey.css
> crass src/odyssey.css --optimize > dist/assets/css/odyssey.css
debugcss: src/odyssey.css
> cp src/odyssey.css dist/assets/css/odyssey.css
dist/assets/js/odyssey.js:
> elm make src/Main.elm --output=dist/assets/js/odyssey.js --optimize
dist/assets/js/odyssey.min.js: dist/assets/js/odyssey.js
> uglifyjs dist/assets/js/odyssey.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' | uglifyjs --mangle > dist/assets/js/odyssey.min.js
prodjs: dist/assets/js/odyssey.min.js
> mv dist/assets/js/odyssey.min.js dist/assets/js/odyssey.${seed}.min.js
dist/assets/js/init.js: src/init.js vendor/d3.v3.min.js vendor/topojson.1.6.19.min.js
> uglifyjs vendor/d3.v3.min.js vendor/topojson.1.6.19.min.js src/init.js --output dist/assets/js/init.js
prodindex: dist/index.html
> sed -i 's/odyssey.*.js/odyssey.${seed}.min.js/' dist/index.html
debugindex: dist/index.html
> sed -i 's/odyssey.*.js/odyssey.js/' dist/index.html
build: dist/assets/js/odyssey.min.js prodindex prodcss
> @-rm -f dist/assets/js/odyssey.js dist/assets/js/odyssey.*.min.js
rebuild: clean build
manifest: manifester/odyssey.yaml manifester/world/cca3.json manifester/world/countries.json
> cd manifester
> ./update_manifest.sh
> cargo run --release
> cd ..
serve: dist/assets/js/init.js debugindex prodcss
> elm-live ${LIVEARGS} --optimize
debug: dist/assets/js/init.js debugindex debugcss
> elm-live ${LIVEARGS} --debug
align:
> for a in $(find dist/gallery/ -regextype sed -regex ".*/[0-9]\{8\}_[0-9]\{6\}.*"); do mv -v -f $a $(dirname $a)/IMG_$(basename $a); done
clean:
> @-rm -f $(TARGETS)
clearthumb:
> find dist/gallery -name 'Thumbs.db*' -exec rm {} \;
deploy: manifest prodindex dist/assets/js/init.js prodcss build prodjs clearthumb
> rsync -avr --exclude='*.desc' --chown=http:www --checksum --delete -e ssh dist/ KalaR:odyssey