This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
90 lines (70 loc) · 2.45 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
79
80
81
82
83
84
85
86
87
88
89
90
STATIC_DIR = cilantro/static
COFFEE_DIR = ${STATIC_DIR}/coffee
JS_SRC_DIR = ${STATIC_DIR}/js/src
JS_MIN_DIR = ${STATIC_DIR}/js/min
PID_FILE = .watch-pid
HIGHCHARTS_SM = ${STATIC_DIR}/highcharts
SASS_DIR = ${STATIC_DIR}/scss
CSS_DIR = ${STATIC_DIR}/css
COMPILE_SASS = `which sass` \
--scss \
--style=compressed \
-r ${STATIC_DIR}/scss/coriander/bourbon/lib/bourbon.rb \
${SASS_DIR}:${CSS_DIR}
COMPILE_COFFEE = `which coffee` -b -o ${JS_SRC_DIR} -c ${COFFEE_DIR}
WATCH_COFFEE = `which coffee` -w -b -o ${JS_SRC_DIR} -c ${COFFEE_DIR}
REQUIRE_OPTIMIZE = `which node` bin/r.js -o cilantro/static/js/app.build.js
LATEST_TAG = `git describe --tags \`git rev-list --tags --max-count=1\``
all: build-submodules watch
build: build-submodules sass coffee optimize
dist: build
@echo 'Creating a source distributions...'
@python setup.py sdist > /dev/null
sass:
@echo 'Compiling Sass...'
@mkdir -p ${CSS_DIR}
@${COMPILE_SASS} --update
coffee:
@echo 'Compiling CoffeeScript...'
@${COMPILE_COFFEE}
watch: unwatch
@echo 'Watching in the background...'
@${WATCH_COFFEE} &> /dev/null & echo $$! > ${PID_FILE}
@${COMPILE_SASS} --watch &> /dev/null & echo $$! >> ${PID_FILE}
unwatch:
@if [ -f ${PID_FILE} ]; then \
echo 'Watchers stopped'; \
for pid in `cat ${PID_FILE}`; do kill -9 $$pid; done; \
rm ${PID_FILE}; \
fi;
init-submodules:
@echo 'Initializing submodules...'
@if [ -d .git ]; then \
if git submodule status | grep -q -E '^-'; then \
git submodule update --init --recursive; \
else \
git submodule update --init --recursive --merge; \
fi; \
fi;
build-submodules: init-submodules coriander backbone-common jquery-idle-timeout highcharts
coriander:
@echo 'Setting up submodule coriander...'
@rm -rf ${STATIC_DIR}/scss/coriander
@cp -r ./modules/coriander ${STATIC_DIR}/scss/coriander
backbone-common:
@echo 'Setting up submodule backbone-common...'
@rm -rf ${STATIC_DIR}/coffee/common
@cp -r ./modules/backbone-common ${STATIC_DIR}/coffee/common
jquery-idle-timeout:
@echo 'Setting up submodule jquery-idle-timeout...'
@cat ./modules/jquery-idle-timeout/src/*.js > ${JS_SRC_DIR}/vendor/jquery.idle.js
highcharts:
@echo 'Setting up submodule highcharts...'
@cp ./modules/highcharts/js/highcharts.src.js ${JS_SRC_DIR}/vendor/highcharts.js
optimize: clean
@echo 'Optimizing the javascript...'
@mkdir -p ${JS_MIN_DIR}
@${REQUIRE_OPTIMIZE} > /dev/null
clean:
@rm -rf ${JS_MIN_DIR}
.PHONY: all sass coffee watch unwatch optimize clean