vail-adapter/Makefile

55 lines
1.7 KiB
Makefile
Raw Permalink Normal View History

2022-05-22 21:55:22 -06:00
FQBN_qtpy = adafruit:samd:adafruit_qtpy_m0
FQBN_xiao = Seeeduino:samd:seeed_XIAO_m0
UF2_MOUNT = /mnt/chromeos/removable/Arduino
ARDUINO_DIR = /app/Arduino
BUILDER = flatpak run --command ${ARDUINO_DIR}/arduino-builder cc.arduino.arduinoide
2022-05-22 21:55:22 -06:00
default: build/vail-adapter.qtpy.uf2 build/vail-adapter.xiao.uf2
2024-02-05 12:33:56 -07:00
install: install-xiao
install-xiao: build/vail-adapter.xiao.uf2
./install.sh $< $(UF2_MOUNT)
2024-02-05 12:33:56 -07:00
install-qtpy: build/vail-adapter.qtpy.uf2
./install.sh $< /mnt/chromeos/removable/QTPY_BOOT
2022-05-22 21:55:22 -06:00
clean:
rm -rf build/*
# uf2conv.py is covered by an MIT license.
build/uf2conv.py: build/uf2families.json
mkdir -p build
curl -L https://raw.githubusercontent.com/microsoft/uf2/master/utils/$(@F) > $@
chmod +x $@
build/uf2families.json:
mkdir -p build
curl -L https://raw.githubusercontent.com/microsoft/uf2/master/utils/$(@F) > $@
2022-05-22 21:55:22 -06:00
%.xiao.uf2: %.xiao.bin build/uf2conv.py
build/uf2conv.py -b 0x2000 -c -o $@ $<
%.qtpy.uf2: %.qtpy.bin build/uf2conv.py
build/uf2conv.py -b 0x2000 -c -o $@ $<
2022-05-22 21:55:22 -06:00
build/%.qtpy.bin: FQBN = adafruit:samd:adafruit_qtpy_m0
build/%.xiao.bin: FQBN = Seeeduino:samd:seeed_XIAO_m0
build/vail-adapter.%.bin: vail-adapter.ino *.cpp *.h
mkdir -p build/$*
arduino-builder \
-build-cache ~/.cache/arduino \
2022-05-22 21:55:22 -06:00
-build-path build/$* \
-core-api-version 10813 \
-fqbn $(FQBN) \
-hardware ~/.arduino15/packages \
-tools $(ARDUINO_DIR)/tools-builder \
-tools ~/.arduino15/packages \
-hardware $(ARDUINO_DIR)/hardware \
-hardware ~/.arduino15/packages \
-built-in-libraries $(ARDUINO_DIR)/libraries \
-libraries ~/Arduino/libraries \
-compile \
$<
2022-05-22 21:55:22 -06:00
mv build/$*/vail-adapter.ino.bin $@
upload: vail-adapter.ino
arduino --upload --board $(FQBN) $<