-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
45 lines (38 loc) · 1.16 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
all: build upload
install:
docker build -t platformio:latest .
@USB_DEVICE=$$(ls /dev/ttyUSB* /dev/ttyACM* 2>/dev/null | head -n 1); \
if [ -z "$$USB_DEVICE" ]; then \
echo "No USB device found"; \
echo "Please connect your device and try again"; \
else \
docker create -it --name platformio \
--mount type=bind,source="$(CURDIR)",target=/me_prac \
-w /me_prac \
--device $$USB_DEVICE \
platformio:latest; \
echo "PlatformIO container created"; \
echo "To build the project run 'make build'"; \
echo "To upload the project run 'make upload'"; \
echo "To attach to the container run 'make attach'"; \
echo "To plot the data run 'make plot'"; \
echo "To clean the container run 'make clean'"; \
fi
build:
docker start platformio
docker exec platformio /bin/sh -c "pio run"
upload:
docker start platformio
docker exec platformio /bin/sh -c "pio run -t upload"
attach:
docker start platformio
docker attach platformio
plot:
./arduino-plotter-listener-linux64/listener
clean:
docker start platformio
docker exec platformio /bin/sh -c "pio run -t clean"
docker stop platformio
docker rm platformio
uninstall:
docker rmi platformio:latest