forked from EFForg/OpenWireless
/
Makefile
36 lines (27 loc) · 1.24 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
TEMPLATES_JS=app/js/templates.js
HANDLEBARS_FILES=$(wildcard app/templates/*.handlebars) # Used to generate templates.js
.PHONY: all
all: $(TEMPLATES_JS)
.PHONY: clean
clean:
rm -f $(TEMPLATES_JS)
$(TEMPLATES_JS): $(HANDLEBARS_FILES)
$(eval TEMPFILE=$(shell mktemp --suffix _templates.js))
./node_modules/handlebars/bin/handlebars -f $(TEMPFILE) $(HANDLEBARS_FILES)
mv -f $(TEMPFILE) $(TEMPLATES_JS)
chmod 644 $(TEMPLATES_JS)
# NOTE: assert_templates_js_up_to_date is a temporary workaround to confirm
# that templates.js is up-to-date with the handlebars templates used to
# generate it. Both are checked in to source control because the build server
# currently does not have handlebars installed so relies on the repo version of
# templates.js
#
# TODO: once the build server has handlebars installed:
# - remove apps/js/templates.js from source control (https://github.com/EFForg/OpenWireless/pull/234)
# - always build templates.js from apps/templates/*
# - remove this make target.
.PHONY: assert_templates_js_up_to_date
assert_templates_js_up_to_date:
$(eval TEMPFILE=$(shell mktemp --suffix _templates.js))
./node_modules/handlebars/bin/handlebars -f $(TEMPFILE) $(HANDLEBARS_FILES)
diff --brief $(TEMPFILE) $(TEMPLATES_JS) # exit=1 if different