# ServoTimer2Plus build helpers

CLI := arduino-cli
FQBN := arduino:avr:uno
EXAMPLE := examples/CompileTest
LIBRARY := $(CURDIR)

.PHONY: all compile clean update-core install-avr nano nano-old

all: compile

compile:
	$(CLI) compile --fqbn $(FQBN) --library $(LIBRARY) --warnings all $(EXAMPLE)

nano:
	$(CLI) compile --fqbn arduino:avr:nano:cpu=atmega328 --library $(LIBRARY) $(EXAMPLE)

nano-old:
	$(CLI) compile --fqbn arduino:avr:nano:cpu=atmega328old --library $(LIBRARY) $(EXAMPLE)

install-avr:
	$(CLI) core update-index
	$(CLI) core install arduino:avr

update-core:
	$(CLI) core update-index

clean:
	rm -rf build
	rm -rf /tmp/arduino-sketch-*