mockband/Makefile

45 lines
1.2 KiB
Makefile

DEVICE=/dev/ttyACM0
all: firmwares
firmwares: build/MockBand.guitar-wammy.hex
build/MockBand.guitar-wammy.hex: VID=0x1bad
build/MockBand.guitar-wammy.hex: PID=0x0004
build/MockBand.guitar-wammy.hex: FLAGS=-DWAMMY
firmwares: build/MockBand.guitar.hex
build/MockBand.guitar.hex: VID=0x1bad
build/MockBand.guitar.hex: PID=0x0004
firmwares: build/MockBand.drums.hex
build/MockBand.drums.hex: VID=0x1bad
build/MockBand.drums.hex: PID=0x3110
build/MockBand.%.hex: MockBand.ino
mkdir -p build/cache
rm -f build/build.options.json
arduino-builder \
-build-path $(abspath build/) \
-build-cache $(abspath build/cache/) \
-fqbn arduino:avr:leonardo \
-hardware /usr/share/arduino/hardware/ \
-tools /usr/share/arduino/tools/ \
-prefs="build.extra_flags=-DUSB_VID=$(VID) -DUSB_PID=$(PID) '-DUSB_PRODUCT=\"Mockband $*\"' -DUSB_MANUFACTURER=\"woozle.org\" -DCDC_DISABLED $(FLAGS)" \
-compile $<
mv build/MockBand.ino.hex $@
flash-%: build/MockBand.%.hex
echo -n "Waiting for $(DEVICE)..."; while [ ! -e $(DEVICE) ]; do echo -n .; sleep 1; done
avrdude -v -patmega32u4 -cavr109 -P$(DEVICE) -b57600 -D -Uflash:w:$<:i
dist: build/MockBand.zip
build/MockBand.zip: firmwares
rm -f $@
zip -r $@ README.md build/*.hex docs/
clean:
rm -rf build