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