-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (28 loc) · 831 Bytes
/
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
.DEFAULT_GOAL := copy
.user := pi
.machine := pi2.local
.env := /home/pi/.virtualenvs/cv/bin/activate
.dir := scripts
help:
@echo ""
@echo "Available commands :"
@echo ""
@echo " make \t\t\t\tcopies current directory"
@echo " make copy\t\t\tcopies current directory"
@echo " make install\t\t\tinstalls Python dependencies"
@echo " make exec PROGRAM=<program>\texecutes the program"
@echo ""
copy:
rsync -r ./* $(.user)@$(.machine):~/scripts
install: copy
ssh $(.user)@$(.machine) " \
source $(.env); \
pip install -r $(.dir)/requirements.txt"
exec:
ssh $(.user)@$(.machine) " \
source $(.env); \
if pgrep -u $(.user) python; then pkill -u $(.user) python; fi; \
python $(.dir)/programs/$(PROGRAM).py &"
stop:
ssh $(.user)@$(.machine) "pkill -u $(.user) python"
.PHONY: copy install exec stop