1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- MAKEFLAGS += -R -r
- ARDUINO_CLI = arduino-cli
- ZIP = zip
- SKETCH = max80
- TARGET = output/$(SKETCH).ino.bin
- GENFILES = www.zip
- WWW = www
- PORT ?= /dev/ttyACM0
- build_defines = -DBOARD_HAS_PSRAM -I$(realpath ../common)
- 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=$(build_defines)' \
- --build-property 'build.cdc_on_boot=1' \
- --build-property 'build.msc_on_boot=0' \
- --build-property 'build.dfu_on_boot=1' \
- --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: zipexclude
- mkdir -p zip
- if ! cmp -q ../version.mk www/version 2>/dev/null; then \
- cp -f ../version.mk www/version; \
- fi
- cd www && \
- TZ=GMT0 \
- $(ZIP) -9DrpX -UN=UTF8 -FS ../zip/www.zip . -x@../zipexclude
- # 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
|