From: Lukáš Jiřiště Date: Wed, 23 Oct 2024 09:13:40 +0000 (+0200) Subject: Change Makefile to better track what to do X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=e60d648889723b2b733630a93f2ddf00b49dfa0c;p=Servomatic.git 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. --- 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