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.
+RM := rm -rf
MAINCMD := arduino-cli compile --upload --verify
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
clean :
fclean : clean
- $(RM) $(NAME)
+ $(RM) .compile .upload
.% :
if [ ! -f $@ ]; then touch $@ && $(MAKE) re; fi