-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmakefile
231 lines (179 loc) · 6.2 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# COPYRIGHT (c) 2016 Cristóbal Ganter
#
# GNU AFFERO GENERAL PUBLIC LICENSE
# Version 3, 19 November 2007
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
.DEFAULT_GOAL = run
program = run.py
dir_name = $${PWD\#\#*/}
runenv = . env/bin/activate
python = $(runenv) && python
pip_install = $(runenv) && pip install
unittest = $(python) -m unittest
gempath = ./gems
gembin = $(gempath)/bin
use_gempath = export GEM_HOME=$(gempath)
csspath = static/css
scsspath = static/scss
sasspaths = $(scsspath):$(csspath)
sasscmd = $(gembin)/sass
bbfoldername = bourbon_files
bbpath = $(scsspath)/$(bbfoldername)
nmodulespath = ./node_modules
bowerpath = ./bower_components
bowercmd = $(nmodulespath)/bower/bin/bower
jspath = static/js
coffeepath = static/coffee
coffeepaths = $(jspath) $(coffeepath)
coffeeoptions = --map --compile --output
coffeecmd = $(nmodulespath)/coffee-script/bin/coffee
sub_target =
sub_make_resources = export coffeecmd="$$(readlink -e $(coffeecmd))" && \
export sasscmd="$$(readlink -e $(sasscmd))" && \
export GEM_HOME="$$(readlink -e $(gempath))"
make_iterate_over_d = for d in */ ; \
do if [ -f "$$d/makefile" ]; then \
$(MAKE) -C "$$d" --no-print-directory $(sub_target); \
fi \
done
VPATH = static $(gembin) $(scsspath) $(nmodulespath) \
$(jspath) env/lib/python3.4/site-packages \
make_empty_targets $(csspath)
qrm_path = src/utils/qrmaster
doc_path = doc
green = \033[0;32m
nc = \033[0m
make_empty_targets:
mkdir make_empty_targets
dependencies: | make_empty_targets
sudo apt-get update
sudo apt-get install python3 python3-dev \
build-essential ruby npm curl \
screen nodejs-legacy libjpeg-dev \
mongodb
touch make_empty_targets/dependencies
virtualenv: | dependencies
url=$$(./get_venv_url.py) && \
mkdir $@ && \
curl $$url | tar xvfz - -C $@ --strip-components=1
env: | dependencies virtualenv
cd virtualenv && \
python3 virtualenv.py --python=python3 ../env
tornado motor oauth2client qrcode: | env
$(pip_install) $@
jwt: | env
$(pip_install) PyJWT
PIL: | env
$(pip_install) pillow
httplib2: | env
$(pip_install) git+https://github.com/jcgregorio/httplib2.git
sphinx: | env
$(pip_install) Sphinx
sass bourbon: | dependencies
$(use_gempath) && gem install --no-ri --no-rdoc $@
$(bbfoldername): bourbon
$(use_gempath) && $(gembin)/bourbon install \
--path=$(scsspath)
mv $(scsspath)/bourbon $(bbpath)
css: $(scsspath)/*.scss | $(bbfoldername) sass
$(use_gempath) && $(sasscmd) --update $(sasspaths)
coffee-script bower: | dependencies
npm install $@
normalize.css: | css bower
$(bowercmd) install $@
cd $(csspath) && ln -s ../../$(bowerpath)/normalize-css/$@ $@
tinycolor.js: | bower js
$(bowercmd) install tinycolor
cd $(jspath) && ln -s ../../$(bowerpath)/tinycolor/$@ $@
reconnecting-websocket.js: | bower js
$(bowercmd) install reconnectingWebsocket
cd $(jspath) && ln -s ../../$(bowerpath)/reconnectingWebsocket/$@ $@
unibabel.js: | bower js
$(bowercmd) install unibabel
cd $(jspath) && ln -s ../../$(bowerpath)/unibabel/index.js $@
js: $(coffeepath)/*.coffee | coffee-script
$(coffeecmd) $(coffeeoptions) $(coffeepaths)
.PHONY: run python srun drun testenv attach csswatch dcsswatch \
jswatch djswatch clean panels notifications \
locking_panels qrmaster controls autodoc clean_doc test
vtest showdocs
run_py_deps = tornado motor jwt httplib2 oauth2client
run: $(run_py_deps) dependencies css js \
reconnecting-websocket.js tinycolor.js unibabel.js \
normalize.css panels notifications locking_panels \
controls qrmaster
$(python) -i $(program)
python: dependencies
$(python)
srun:
screen -S $(dir_name) $(MAKE) run
drun:
screen -d -m -S $(dir_name) $(MAKE) run
qrmaster_py_deps = tornado qrcode PIL
qrmaster: dependencies sass $(bbfoldername) $(qrmaster_py_deps)
-cd $(qrm_path) && \
ln -s ../../../$(bbpath) $(bbfoldername)
$(sub_make_resources) && \
cd $(qrm_path) && \
$(MAKE)
panels notifications locking_panels controls: coffee-script sass $(bbfoldername)
@echo "$(green)Executing makefiles in $@ ...$(nc)"
@$(sub_make_resources) && \
cd $@ && \
$(make_iterate_over_d)
testenv: env
$(python) -V
test:
$(unittest)
vtest:
$(unittest) -v
attach:
screen -r $(dir_name)
#Upstream Merge
upsm:
git pull --no-commit --no-rebase cganterh.net:git/tornadoBoxes.git
csswatch: scss $(bbfoldername) sass
$(use_gempath) && $(sasscmd) --watch $(sasspaths)
dcsswatch:
screen -d -m -S $(dir_name)_sass $(MAKE) csswatch
jswatch:
$(nmodulespath)/coffee-script/bin/coffee --watch $(coffeeoptions) $(coffeepaths)
djswatch:
screen -d -m -S $(dir_name)_coffee $(MAKE) jswatch
autodoc: $(run_py_deps) $(qrmaster_py_deps) sphinx
$(runenv) && \
dir_name=$(dir_name) && \
cd .. && \
sphinx-apidoc --separate -f -o $$dir_name/$(doc_path) $$dir_name
$(runenv) && \
cd $(doc_path) && \
export AA_PATH=".." && \
$(MAKE) html
showdocs: autodoc
xdg-open doc/_build/html/index.html
clean_doc: | sphinx
$(runenv) && cd $(doc_path) && $(MAKE) clean
cd $(doc_path) && \
find . -maxdepth 1 -type f ! -regex '.*\(index.rst\|todo.rst\|conf.py\|[mM]akefile\)' -delete
clean: sub_target = clean
clean: clean_doc
rm -rf $(bowerpath) env $(nmodulespath) \
__pycache__ $(csspath) $(jspath) $(gempath) \
log.log $(bbpath) virtualenv temp
-cd panels && $(make_iterate_over_d)
-cd notifications && $(make_iterate_over_d)
-cd locking_panels && $(make_iterate_over_d)
-cd controls && $(make_iterate_over_d)
cd $(qrm_path) && $(MAKE) clean