Makefile (972B)
1FAMILY ?= rp2040 2 3SIDE ?= left 4 5PICO_SDK_PATH ?= lib/picosdk 6TINYUSB_PATH ?= lib/tinyusb 7 8PICO_SDK_FILES = $(PICO_SDK_PATH)/CMakeLists.txt 9TINYUSB_FILES = $(TINYUSB_PATH)/hw/bsp/family_support.cmake 10 11CMAKE_FLAGS = -DFAMILY=$(FAMILY) -DPICO_SDK_PATH=$(PICO_SDK_PATH) 12CMAKE_C_FLAGS = -DSPLIT_SIDE=$(shell echo "$(SIDE)" | tr a-z A-Z) 13ifdef ROLE 14CMAKE_C_FLAGS += -DSPLIT_ROLE=$(shell echo "$(ROLE)" | tr a-z A-Z) 15endif 16ifneq ($(GPIO_MOD),0) 17CMAKE_C_FLAGS += -DBAD_GPIO_MITIGATION=1 18endif 19 20all: build flash 21 22clean: 23 rm -rf .build 24 25build: | $(PICO_SDK_FILES) $(TINYUSB_FILES) .build/$(SIDE) 26 cmake -B .build/$(SIDE) $(CMAKE_FLAGS) -DCMAKE_C_EXTRA_FLAGS="$(CMAKE_C_FLAGS)" 27 make -C .build/$(SIDE) 28 29flash: 30 picotool load .build/$(SIDE)/sxkbd.uf2 31 32$(PICO_SDK_FILES): 33 git submodule update --init lib/picosdk 34 35$(TINYUSB_FILES): 36 git submodule update --init lib/tinyusb 37 git -C lib/tinyusb apply ../../extra/tinyusb.diff 38 39.build/$(SIDE): 40 mkdir -p $@ 41 42.PHONY: all clean build flash