From 5f448321518a8a950330cab88277318455e5da32 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Fri, 5 Jan 2024 08:50:10 -0700 Subject: [PATCH] move to Makefile --- .gitea/workflows/build.yaml | 4 ++-- .gitignore | 1 + Makefile | 44 +++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 7774179..d3d694b 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -10,8 +10,8 @@ jobs: - name: check out repository run: git clone -b $GITHUB_REF_NAME $GITHUB_SERVER_URL/$GITHUB_REPOSITORY . - name: build - run: .gitea/build.sh + run: make - name: publish env: PACKAGE_API_TOKEN: ${{ secrets.PACKAGE_API_TOKEN }} - run: .gitea/publish.sh out/* + run: make publish diff --git a/.gitignore b/.gitignore index 7ebfec5..a97d760 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.zip *.hex +build/ diff --git a/Makefile b/Makefile index 875b198..38d0541 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,37 @@ DEVICE=/dev/ttyACM0 +all: + +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 + all: $(firmwares) -firmwares += out/MockBand.guitar-wammy.hex -out/MockBand.guitar-wammy.hex: VID=0x1bad -out/MockBand.guitar-wammy.hex: PID=0x000f -out/MockBand.guitar-wammy.hex: FLAGS=-DWAMMY - -firmwares += out/MockBand.guitar.hex -out/MockBand.guitar.hex: VID=0x1bad -out/MockBand.guitar.hex: PID=0x000f - -firmwares += out/MockBand.drums.hex -out/MockBand.guitar.hex: VID=0x1bad -out/MockBand.guitar.hex: PID=0x3110 - -out/MockBand.%.hex: MockBand.ino - rm -rf build +build/MockBand.%.hex: MockBand.ino mkdir -p build/cache + rm -f build/build.options.json arduino-builder \ - -build-path $(path)/build/ \ - -build-cache $(path)/build/cache/ \ + -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)" \ + -prefs="build.extra_flags=-DUSB_VID=$(VID) -DUSB_PID=$(PID) '-DUSB_PRODUCT=\"Mockband $*\"' -DUSB_MANUFACTURER=\"woozle.org\" -DCDC_DISABLED $(FLAGS)" \ -compile $< - mkdir -p out mv build/MockBand.ino.hex $@ -flash-%: out/MockBand.%.hex + +flash-%: build/MockBand.%.hex while [ ! -e $(DEVICE) ]; do echo Waiting for $(DEVICE)...; sleep 1; done avrdude -v -patmega32u4 -cavr109 -P$(DEVICE) -b57600 -D -Uflash:w:$<:i @@ -37,5 +39,5 @@ publish: $(firmwares) .gitea/publish.sh $^ clean: - rm -rf out build + rm -rf build