-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
414 lines (363 loc) · 11.5 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
TZ := 'Europe/Berlin'
HEUTE := backup
HEUTE_todo := "date '+%Y_%m_%d'"
APP_MYSELF := flask_covid19
PYTHON := python
PIP_COMPILE := pip-compile
PIP := pip
NPM := npm
GIT := git
MAKE := make
UNAME = $(shell uname)
DB_DIR := project/db
DOCS_DIR := docs
DATA_DIR := data
PIP_REQUIREMENTS_IN_DIR := requirements/in
PIP_REQUIREMENTS_WINDOWS_DIR := requirements/windows
PIP_REQUIREMENTS_LINUX_DIR := requirements/linux
.PHONY: all
all: start
# -------------------------------------------------------------------------------------
#
# clean
#
# -------------------------------------------------------------------------------------
clean_linux:
@echo "--------------------"
@echo "making clean_linux"
@echo "--------------------"
rm -rf .eggs
rm -rf project.egg-info
rm -rf flask_petclinic.egg-info
rm -rf build
rm -rf dist
rm -rf .pytest_cache
rm -rf .checkmate
rm -rf node_modules
rm -rf broker
rm -rf .tox
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -rf {} +
@echo "-------------------------"
@echo "making clean_linux DONE"
@echo "-------------------------"
clean_windows:
@echo "----------------------"
@echo "making clean_windows"
@echo "----------------------"
$(shell rm -rf flask_covid19.egg-info)
$(shell rm -rf node_modules)
$(shell rm -rf .tox)
$(shell rm -rf broker)
$(shell rm -rf build)
$(shell rm -rf dist)
@echo "---------------------------"
@echo "making clean_windows DONE"
@echo "---------------------------"
# -------------------------------------------------------------------------------------
#
# pip
#
# -------------------------------------------------------------------------------------
pip_check:
@echo "pip_check"
$(PYTHON) -m pip check
pip-audit
pip_compile_windows:
@echo "------------------"
@echo "making pip_compile_windows"
@echo "------------------"
python -m pip install --upgrade pip
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_WINDOWS_DIR)/build.txt $(PIP_REQUIREMENTS_IN_DIR)/build.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_WINDOWS_DIR)/docs.txt $(PIP_REQUIREMENTS_IN_DIR)/docs.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_WINDOWS_DIR)/tests.txt $(PIP_REQUIREMENTS_IN_DIR)/tests.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_WINDOWS_DIR)/typing.txt $(PIP_REQUIREMENTS_IN_DIR)/typing.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_WINDOWS_DIR)/dev.txt $(PIP_REQUIREMENTS_IN_DIR)/dev.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_WINDOWS_DIR)/windows.txt $(PIP_REQUIREMENTS_IN_DIR)/windows.in
@echo "------------------"
@echo "making pip_compile_windows DONE"
@echo "------------------"
pip_compile_linux:
@echo "------------------"
@echo "making pip_compile_linux"
@echo "------------------"
python -m pip install --upgrade pip
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_LINUX_DIR)/build.txt $(PIP_REQUIREMENTS_IN_DIR)/build.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_LINUX_DIR)/docs.txt $(PIP_REQUIREMENTS_IN_DIR)/docs.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_LINUX_DIR)/tests.txt $(PIP_REQUIREMENTS_IN_DIR)/tests.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_LINUX_DIR)/typing.txt $(PIP_REQUIREMENTS_IN_DIR)/typing.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_LINUX_DIR)/dev.txt $(PIP_REQUIREMENTS_IN_DIR)/dev.in
@echo "------------------"
$(PIP_COMPILE) -r --output-file $(PIP_REQUIREMENTS_LINUX_DIR)/linux.txt $(PIP_REQUIREMENTS_IN_DIR)/linux.in
@echo "------------------"
@echo "making pip_compile_linux DONE"
@echo "------------------"
pip_install_windows_build:
@echo "------------------"
@echo "making pip_install"
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_WINDOWS_DIR)/build.txt
@echo "------------------"
pip_install_windows: pip_install_windows_build
@echo "------------------"
@echo "making pip_install"
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_WINDOWS_DIR)/docs.txt
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_WINDOWS_DIR)/tests.txt
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_WINDOWS_DIR)/typing.txt
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_WINDOWS_DIR)/dev.txt
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_WINDOWS_DIR)/windows.txt
@echo "------------------"
$(PIP) freeze > requirements/requirements_windows.txt
@echo "------------------"
$(PIP) check
@echo "------------------"
@echo "making pip_install DONE"
@echo "------------------"
pip_install_linux_build:
@echo "------------------"
@echo "making pip_install_linux_build"
@echo "------------------"
$(PYTHON) -m pip install --upgrade pip
$(PIP) install -r $(PIP_REQUIREMENTS_LINUX_DIR)/build.txt
$(PIP) freeze > requirements/requirements_linux.txt
$(PIP) check
@echo "------------------"
@echo "making pip_install_linux_build DONE"
@echo "------------------"
pip_install_linux: pip_install_linux_build
@echo "------------------"
@echo "making pip_install_linux"
@echo "------------------"
# $(PIP) install -r $(PIP_REQUIREMENTS_LINUX_DIR)/build.txt
@echo "------------------"
@echo "making pip_install_linux docs.txt"
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_LINUX_DIR)/docs.txt
@echo "------------------"
@echo "making pip_install_linux tests.txt"
@echo "------------------"
$(PIP) install -r $(PIP_REQUIREMENTS_LINUX_DIR)/tests.txt
@echo "------------------"
@echo "making pip_install_linux typing.txt"
$(PIP) install -r $(PIP_REQUIREMENTS_LINUX_DIR)/typing.txt
@echo "------------------"
@echo "making pip_install_linux dev.txt"
$(PIP) install -r $(PIP_REQUIREMENTS_LINUX_DIR)/dev.txt
@echo "------------------"
@echo "making pip_install_linux linux.txt"
$(PIP) install -r $(PIP_REQUIREMENTS_LINUX_DIR)/linux.txt
$(PIP) freeze > requirements/requirements_linux.txt
$(PIP) check
@echo "------------------"
@echo "making pip_install_linux DONE"
@echo "------------------"
pip_uninstall_linux:
@echo "------------------"
@echo "making pip_uninstall_linux"
@echo "------------------"
$(PIP) freeze > etc/requirements_linux.txt
@echo "------------------"
$(PIP) uninstall -r etc/requirements_linux.txt -y
@echo "------------------"
$(PIP) check
@echo "------------------"
@echo "making pip_uninstall_linux DONE"
@echo "------------------"
# -------------------------------------------------------------------------------------
#
# setup.py
#
# -------------------------------------------------------------------------------------
setup_setuptools:
@echo "------------------"
@echo "making setup_setuptools"
@echo "------------------"
$(PYTHON) -m pip install --upgrade pip
# $(PYTHON) -m pip install --upgrade setuptools
# $(PYTHON) -m pip install --upgrade wheel
# $(PYTHON) -m pip install setuptools wheel
# $(PYTHON) -m pip uninstall $(APP_MYSELF) -y
@echo "------------------"
@echo "making setup_setuptools DONE"
@echo "------------------"
setup_development: pip_setuptools
@echo "making setup_development"
$(PYTHON) setup.py develop
@echo "making setup_development DONE"
flask_covid19_clean:
@echo "------------------"
@echo "making flask_covid19"
@echo "------------------"
$(PYTHON) -m pip uninstall $(APP_MYSELF) -y
@echo "------------------"
@echo "making flask_covid19 DONE"
@echo "------------------"
flask_covid19:
@echo "------------------"
@echo "making flask_covid19"
@echo "------------------"
$(PIP) install -e .
@echo "------------------"
@echo "making flask_covid19 DONE"
@echo "------------------"
# -------------------------------------------------------------------------------------
#
# venv + renv
#
# -------------------------------------------------------------------------------------
venv:
@echo "------------------"
@echo "making venv_setup"
@echo "------------------"
$(PYTHON) -m venv venv
@echo "------------------"
@echo "making venv_setup DONE"
@echo "------------------"
venv_clean:
@echo "------------------"
@echo "making venv_clean"
@echo "------------------"
@echo "deactivate"
@echo "------------------"
rm -rf venv
@echo "------------------"
@echo "making venv_clean DONE"
@echo "------------------"
# -------------------------------------------------------------------------------------
#
# Renv
#
# -------------------------------------------------------------------------------------
renv:
@echo "------------------"
@echo "making venv_setup"
@echo "------------------"
@echo "TBD"
@echo "------------------"
renv_clean:
@echo "------------------"
@echo "making venv_clean"
@echo "------------------"
@echo "deactivate"
@echo "------------------"
rm -rf renv
@echo "------------------"
# -------------------------------------------------------------------------------------
#
# stay human
#
# -------------------------------------------------------------------------------------
love:
@echo "------------------"
@echo "not war!"
@echo "------------------"
# -------------------------------------------------------------------------------------
#
# SCM targets
#
# -------------------------------------------------------------------------------------
git:
@echo "------------------"
@echo "making git"
@echo "------------------"
$(GIT) fetch
$(GIT) status
$(GIT) add -u
$(GIT) commit -m "work"
$(GIT) status
@$(GIT) push
$(GIT) fetch
$(GIT) status
@echo "------------------"
@echo "making git DONE"
@echo "------------------"
# -------------------------------------------------------------------------------------
#
# main targets
#
# -------------------------------------------------------------------------------------
doc:
@echo "------------------"
@echo "making doc"
@echo "------------------"
$(MAKE) -w -C $(DOCS_DIR) html
@echo "------------------"
@echo "making doc DONE"
@echo "------------------"
test:
@echo "------------------"
@echo "making test"
@echo "------------------"
pytest -v
@echo "------------------"
@echo "making test DONE"
@echo "------------------"
download:
@echo "------------------"
@echo "download"
@echo "------------------"
$(MAKE) -w -C $(DATA_DIR) download
@echo "------------------"
@echo "download DONE"
@echo "------------------"
# -------------------------------------------------------------------------------------
#
# frontend
#
# -------------------------------------------------------------------------------------
setup_frontend:
@echo "------------------"
@echo "making setup_frontend"
@echo "------------------"
$(NPM) -v
$(NPM) install
@echo "------------------"
@echo "making setup_frontend DONE"
@echo "------------------"
setup_npm:
@echo "------------------"
@echo "making setup_npm"
@echo "------------------"
sudo npm install -g npm
@echo "------------------"
@echo "making setup_npm DONE"
@echo "------------------"
distclean: venv_clean renv_clean
update_windows: clean_windows pip_compile_windows pip_install_windows pip_check setup_frontend
update_linux: clean_linux pip_compile_linux pip_install_linux pip_check setup_frontend
start_windows: pip_install_windows_build update_windows
start_linux: pip_install_linux_build update_linux
clean:
ifeq ($(UNAME),Linux)
make clean_linux
else
make clean_windows
endif
update:
ifeq ($(UNAME),Linux)
make update_linux
else
make update_windows
endif
start:
ifeq ($(UNAME),Linux)
make start_linux
else
make start_windows
endif