Makefile 2.36 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
PYVER := 3
VENV := .venv

all: help

help:
	@ echo "USAGE"
	@ echo ""
	@ echo "  make apt-install    --  Uses Debian's apt to install required system tools"
	@ echo ""
Nelso Jost's avatar
Nelso Jost committed
11
	@ echo "  make setup          --  Install Python requirements (need only once)"
12
13
14
15
16
17
18
19
20
21
	@ echo ""
	@ echo "  make build          --  Compile the sketch"
	@ echo "  make upload         --  Send the compiled sketch to the board"
	@ echo "  make serial         --  Enter IPython session with serial opened"
	@ echo ""
	@ echo "  make bu             --  build & upload"
	@ echo "  make bus            --  build & upload & serial"
	@ echo ""
	@ echo "  make sync-rtc       --  Synchronizes the board's clock with the system's"
	@ echo ""
Nelso Jost's avatar
Nelso Jost committed
22
23
	@ echo "  make run-logger     --  Starts the logger. Log: apper on the screen"
	@ echo "  make deploy-logger  --  Activate logger daemon. Log at logger/logs/execution.log"
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	@ echo "  make undeploy-logger -- Deactivate logger daemon."
	@ echo "  make tail-logger     -- Exibits and follow daemon execution log."

apt-install:
	sudo apt-get install python python3 python3-pip supervisor
	sudo pip${PYVER} install virtualenv

install-ino:
	sudo apt-get install python-pip
	sudo pip2 install ino
	
setup: clean-venv
	@ echo "-------------------------------------------------------"
	virtualenv -v --python='python${PYVER}' ${VENV}
	@ echo "Virtualenv with 'python${PYVER}' interpreter was created at ${VENV}"
	@ echo "-------------------------------------------------------"
	${VENV}/bin/pip install --upgrade pip
	@ echo "-------------------------------------------------------"
Nelso Jost's avatar
Nelso Jost committed
42
	${VENV}/bin/pip install -r logger/requirements.pip
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
	@ echo "-------------------------------------------------------"
	@ echo "Virtualenv is ready at ${VENV}!"
	@ echo " "
	@ echo "TOTAL SIZE: "
	@ du -sh ${VENV}

clean-venv:
	rm -rf ${VENV}

clean:
	rm -rf .build src/*

build:
	mkdir -p .ino
	mkdir -p .ino/src/ .ino/lib/
	cp -rf meteorolog/. .ino/src/
	cp logger/ino.ini .ino/
	cd .ino/ && ino build
	
upload:
	cd .ino/ && ino upload

serial:
	${VENV}/bin/ipython3 -i logger/init_serial.py

bu: build upload

bus: build upload serial

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

deploy-logger:
	mkdir -p logger/logs
	sudo ${VENV}/bin/python${PYVER} logger/deploy.py

undeploy-logger:
	sudo ${VENV}/bin/python${PYVER} logger/deploy.py -u

tail-logger:
	tail -F logger/logs/execution.log