MAKEFLAGS += -R -r ARDUINO_CLI = arduino-cli ZIP = zip SKETCH = max80 TARGET = output/$(SKETCH).ino.bin GENFILES = $(SKETCH)/data/www.zip WWW = www PORT ?= /dev/ttyACM2 BOARD = esp32:esp32:esp32s2usb all: $(TARGET) $(TARGET): $(shell find $(SKETCH) -type f) $(GENFILES) mkdir -p build output cd $(SKETCH) && \ $(ARDUINO_CLI) compile -b $(BOARD) \ --build-path ../build --output-dir ../output wwwfiles := $(shell find www -type f -print) $(SKETCH)/data/www.zip: $(wwwfiles) rm -f $@ ( cd www && $(ZIP) -9DrpX - . -x '.*' -x '#*' -x '*~' -x '*.bak' ) \ > $@ upload: $(TARGET) $(ARDUINO_CLI) upload -i $(TARGET) -p $(PORT) -b $(BOARD) $(SKETCH) clean: rm -rf build $(SKETCH)/data/*.zip spotless: clean rm -rf output