From e60d648889723b2b733630a93f2ddf00b49dfa0c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Wed, 23 Oct 2024 11:13:40 +0200 Subject: [PATCH] Change Makefile to better track what to do Normally the object files and executable are used for tracking but arduino-cli does not generate any files inside the working directory. The changes use dotfiles .compile and .upload to keep track of what needs to be done. In addition to the dotfiles compile and upload rules were added, that force the action. --- Makefile | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a714226..b952ff9 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +RM := rm -rf MAINCMD := arduino-cli compile --upload --verify @@ -19,9 +20,21 @@ NAME := Servomatic all : $(NAME) -$(NAME) : $(SRCS) - $(MAINCMD) $< - touch $(NAME) +$(NAME) : .upload + +.upload : .compile + $(MAKE) upload + touch .upload + +upload : .compile + arduino-cli upload --port $(PORT) --verify + +.compile : $(SRCS) + $(MAKE) compile + touch .compile + +compile : $(SRCS) + arduino-cli compile --fqbn $(FQBN) $< verbose : .verbose @@ -34,7 +47,7 @@ re : fclean clean : fclean : clean - $(RM) $(NAME) + $(RM) .compile .upload .% : if [ ! -f $@ ]; then touch $@ && $(MAKE) re; fi -- 2.30.2