blob: 704500172e796229eb2a18d2dc41a905941b0aad (
plain)
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
|
INSTALL = /usr/bin/env install
GLOBAL_PREFIX = /usr/local
ifeq ($(shell id -u), 0)
USER_PREFIX = /usr/local
else
USER_PREFIX = $(HOME)/.local
endif
PROGRAMS = admin_bot inverter_bot pump_bot sensors_bot
PROGRAMS += inverter_mqtt_receiver inverter_mqtt_sender
PROGRAMS += sensors_mqtt_receiver sensors_mqtt_sender
PROGRAMS += temphumd
PROGRAMS += gpiorelayd
PROGRAMS += gpiosensord
#PROGRAMS += web_api
all:
@echo "Supported commands:"
@echo
@echo " \033[1mmake install\033[0m symlink all programs to $(USER_PREFIX)"
@echo " \033[1mmake install-tools\033[0m copy admin scripts to /usr/local/bin"
@echo " \033[1mmake venv\033[0m create virtualenv and install dependencies"
@echo " \033[1mmake web-api-dev\033[0m launch web api development server"
@echo
venv:
python3 -m venv venv
. ./venv/bin/activate && pip3 install -r requirements.txt
web-api-dev:
. ./venv/bin/activate && FLASK_ENV=development python3 src/web_api.py
install: check-root
for name in @(PROGRAMS); do ln -s src/${name}.py $(USER_PREFIX)/bin/$name; done
install-tools: check-root
$(INSTALL) tools/clickhouse-backup.sh $(GLOBAL_PREFIX)/bin
chmod +x $(GLOBAL_PREFIX)/bin/clickhouse-backup.sh
check-root:
ifneq ($(shell id -u), 0)
$(error "You must be root.")
endif
.PHONY: all install install-local install-tools venv web-api-dev check-root
|