Makefile 1.86 KB
Newer Older
1
PY := 3
2
VENV := .venv
Nelso Jost's avatar
Nelso Jost committed
3

4
5
6
all: help

help:
Nelso Jost's avatar
Nelso Jost committed
7
	@ echo "USAGE:"
8
	@ echo ""
9
	@ echo "    make apt-install -- Uses apt to install required system tools"
10
11
12
13
14
15
16
17
18
	@ echo "                        (for Debian-based systems only)"
	@ echo ""
	@ echo "    make setup       -- Create a local Python virtual environment"
	@ echo "                        that will hold requirements.pip modules"
	@ echo ""
	@ echo "    make run         -- Executes the logger"
	@ echo ""
	@ echo "    make deploy      -- Register meteorologger proccess on the"
	@ echo "                        supervisor daemon tool (requires root)"
19
	@ echo ""
20
21
22
23
	@ echo "    make undeploy    -- Unregister meteorologger proccess on the"
	@ echo "                        supervisor daemon tool (requires root)"
	@ echo ""
	@ echo "    make tail-exec   -- Follow the logger's execution.log"
Nelso Jost's avatar
Nelso Jost committed
24
25
	@ echo ""
	@ echo "    make sync-rtc    -- Send the current system time to the board"
Nelso Jost's avatar
Nelso Jost committed
26

Nelso Jost's avatar
Nelso Jost committed
27
apt-install:
28
29
	sudo apt-get install python python3-pip supervisor
	sudo pip${PYVER} install virtualenv
Nelso Jost's avatar
Nelso Jost committed
30

31
setup: clean-venv
Nelso Jost's avatar
Nelso Jost committed
32
	@ echo "-------------------------------------------------------"
33
34
	virtualenv -v --python='python${PYVER}' ${VENV}
	@ echo "Virtualenv with 'python${PYVER}' interpreter was created at ${VENV}"
35
	@ echo "-------------------------------------------------------"
36
	${VENV}/bin/pip${PYVER} install --upgrade pip
37
	@ echo "-------------------------------------------------------"
38
	${VENV}/bin/pip${PYVER} install -r requirements.pip
39
40
41
42
43
44
45
46
	@ echo "-------------------------------------------------------"
	@ echo "Virtualenv is ready at ${VENV}!"
	@ echo " "
	@ echo "TOTAL SIZE: "
	@ du -sh ${VENV}

clean-venv:
	rm -rf ${VENV}
Nelso Jost's avatar
Nelso Jost committed
47

48
run:
49
	${VENV}/bin/python${PYVER} run.py
Nelso Jost's avatar
Nelso Jost committed
50

51
deploy:
52
	sudo ${VENV}/bin/python${PYVER} app/deploy.py
53
54

undeploy:
55
	sudo ${VENV}/bin/python${PYVER} app/deploy.py -u
56
57
58

tail-exec:
	tail -F logs/execution.log
Nelso Jost's avatar
Nelso Jost committed
59
60
61

sync-rtc:
	${VENV}/bin/python${PYVER} run.py --syncrtc