MAKEFLAGS += -R -r ARDUINO_CLI = arduino-cli ZIP = zip SKETCH = max80 TARGET = output/$(SKETCH).ino.bin GENFILES = www.zip WWW = www PORT ?= /dev/ttyACM2 BOARD = esp32:esp32:esp32s2usb ARDUINO_OPTS = -b $(BOARD) \ --warnings all \ --build-path ../build \ --output-dir ../output \ --build-cache-path ../cache \ --build-property 'build.flash_size=4MB' \ --build-property 'build.defines=-DBOARD_HAS_PSRAM' \ --build-property 'build.partitions=min_spiffs' all: $(TARGET) properties: cd $(SKETCH) && \ $(ARDUINO_CLI) compile --show-properties $(ARDUINO_OPTS) $(TARGET): $(shell find $(SKETCH) -type f) $(GENFILES) mkdir -p build output cache cd $(SKETCH) && \ $(ARDUINO_CLI) compile $(ARDUINO_OPTS) .PHONY: zip zip: mkdir -p zip cd www && \ TZ=GMT0 \ $(ZIP) -9DrpX -FS ../zip/www.zip . \ -x '.*' -x '#*' -x '*~' -x '*.bak' # Ugly hack but needed to avoid unnecessary rebuilds www.zip: zip if [ ! -f $@ ] || [ zip/$@ -nt $@ ]; then \ cp -f zip/$@ $@; \ rm -f build/sketch/www.c build/sketch/www.c.*; \ fi upload: $(TARGET) $(ARDUINO_CLI) upload -i $(TARGET) -p $(PORT) -b $(BOARD) $(SKETCH) clean: rm -rf build cache zip $(GENFILES) spotless: clean rm -rf output