Add Makefile for building and uploading to UNO
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Tue, 22 Oct 2024 08:27:16 +0000 (10:27 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Tue, 22 Oct 2024 08:27:53 +0000 (10:27 +0200)
The Makefile uses arduino-cli.

Makefile [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..2cfbb78
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+
+MAINCMD := arduino-cli compile --upload --verify
+
+FQBN := arduino:avr:uno
+PORT := /dev/ttyACM0
+
+MAINCMD += --port $(PORT)
+MAINCMD += --fqbn $(FQBN)
+
+ifneq ("$(wildcard .verbose)","")
+       MAINCMD += --verbose
+endif
+
+SRCS :=        Servomatic.ino  \
+
+
+NAME := Servomatic
+
+all : $(NAME)
+
+$(NAME) : $(NAME).ino
+       $(MAINCMD) $<
+       touch $(NAME)
+
+verbose : .verbose
+
+noverbose :
+       if [ -f .verbose ]; then rm .verbose && $(MAKE) re; fi
+
+re : fclean
+       $(MAKE)
+
+clean :
+
+fclean : clean
+       $(RM) $(NAME)
+
+.% :
+       if [ ! -f $@ ]; then touch $@ && $(MAKE) re; fi