This repository has been archived by the owner on Aug 3, 2020. It is now read-only.
forked from axismaps/climatecommons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (68 loc) · 2.37 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
78
build-dir = Build/
yui-jar = tools/yuicompressor-2.4.8pre.jar
html-replace = $(build-dir)index.html
html-prereq = about.html \
index.html \
submit.html \
dir-prereq = data \
fonts \
images \
lib \
css-path = css/
css-build-path = $(build-dir)css/
css-page-target = $(css-build-path)ejn.min.css
css-page-prereq = $(css-path)main.css
js-path = com/
js-build-path = $(build-dir)com/
js-page-target = $(js-build-path)ejn.min.js
js-page-prereq = $(js-path)filter.js \
$(js-path)HexGrid.js \
$(js-path)layers.js \
$(js-path)map.js \
$(js-path)news.js \
$(js-path)search.js \
$(js-path)styles.js \
$(js-path)view.js \
all: $(css-page-target) $(js-page-target)
clean:
@rm -rf $(build-dir)
install: js-build := `cat $(js-page-target) | /usr/bin/openssl sha1 | cut -c1-8`.js
install: css-build := `cat $(css-page-target) | /usr/bin/openssl sha1 | cut -c1-8`.css
install: copy-dir copy-html all
@cp $(css-page-target) $(css-build-path)$(css-build)
@cp $(js-page-target) $(js-build-path)$(js-build)
@echo "Linking to updated CSS and JavaScript…\t\c"
@sed -i.bak "s|\"com\/.*\.js\"|\"com\/$(js-build)\"|g" $(html-replace)
@sed -i.bak "s|\"css\/.*\.css\"|\"css\/$(css-build)\"|g" $(html-replace)
@sed -i.bak "$$!N; /^\(.*\)\n\1$$/!P; D" $(html-replace)
@rm $(css-page-target)
@rm $(js-page-target)
@rm $(html-replace).bak
@echo "[ Done ]"
@echo "Installation is complete."
$(css-page-target): $(css-page-prereq)
@rm -rf $(css-build-path)
@mkdir -p $(css-build-path)
@rm -f $(css-page-target)
@echo "Merging CSS files…\t\t\t\c"
@cat $(css-page-prereq) > $(css-path)tmp.css
@echo "[ Done ]"
@echo "Compressing merged CSS…\t\c"
@java -jar $(yui-jar) -o $(css-page-target) $(css-path)tmp.css
@echo "[ Done ]"
@rm -f $(css-path)tmp.css
$(js-page-target): $(js-page-prereq)
@rm -rf $(js-build-path)
@mkdir -p $(js-build-path)
@rm -f $(js-page-target)
@echo "Merging JS files…\t\t\t\c"
@cat $(js-page-prereq) > $(js-path)tmp.js
@echo "[ Done ]"
@echo "Compressing merged JS…\t\c"
@java -jar $(yui-jar) -o $(js-page-target) $(js-path)tmp.js
@echo "[ Done ]"
@rm -f $(js-path)tmp.js
copy-dir: ; $(foreach dir,$(dir-prereq),rsync -rupE --delete --exclude=".svn*" $(dir) $(build-dir) && ) :
copy-html:
@rm -f $(html-replace)
$(foreach html,$(html-prereq),rsync -rupE --delete --exclude=".svn*" $(html) $(build-dir) && ) :