DEVICE=/dev/ttyACM0
all: firmwares
firmwares: MockBand.guitar-wammy.hex
MockBand.guitar-wammy.hex: VID=0x1bad
MockBand.guitar-wammy.hex: PID=0x0004
MockBand.guitar-wammy.hex: FLAGS=-DWAMMY
firmwares: MockBand.guitar.hex
MockBand.guitar.hex: VID=0x1bad
MockBand.guitar.hex: PID=0x0004
firmwares: MockBand.drums.hex
MockBand.drums.hex: VID=0x1bad
MockBand.drums.hex: PID=0x3110
MockBand.drums-xbox.hex: VID=0x1bad
MockBand.drums-xbox.hex: PID=0x0003
MockBand.drums-rb1.hex: VID=0x1bad
MockBand.drums-rb1.hex: PID=00005
MockBand.%.hex: MockBand.ino
rm -rf build
mkdir -p build/cache
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-%: 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: MockBand.zip
MockBand.zip: firmwares
rm -f $@
zip -r $@ README.md *.hex docs/
clean:
rm -rf build MockBand.*.hex MockBand.zip