commit 1fd341eb6445264cb3dffec83cfc22192a7a7c4e parent 34121e8a63e8dedc3e50fb4a9fb8f624768c79fe Author: Louis Burda <quent.burda@gmail.com> Date: Tue, 27 Dec 2022 22:56:49 +0100 Simplify make targets Diffstat:
M | Makefile | | | 27 | +++++++++++---------------- |
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile @@ -1,5 +1,8 @@ FAMILY ?= rp2040 +SIDE ?= left +SPLIT_SIDE = $(shell echo "$(SIDE)" | tr a-z A-Z) + PICO_SDK_PATH ?= lib/picosdk TINYUSB_PATH ?= lib/tinyusb @@ -7,21 +10,19 @@ PICO_SCK_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_FLAGS_LEFT = $(CMAKE_FLAGS) -DSPLIT_SIDE=LEFT $(CMAKE_FLAGS_LEFT_EXTRA) -CMAKE_FLAGS_RIGHT = $(CMAKE_FLAGS) -DSPLIT_SIDE=RIGHT $(CMAKE_FLAGS_RIGHT_EXTRA) +CMAKE_FLAGS += -DSPLIT_SIDE=$(SPLIT_SIDE) $(CMAKE_FLAGS_LEFT_EXTRA) all: left right clean: rm -rf .build -left: | $(PICO_SDK_FILES) $(TINYUSB_FILES) .build/left - cmake -B .build/left $(CMAKE_FLAGS_LEFT) - make -C .build/left +build: | $(PICO_SDK_FILES) $(TINYUSB_FILES) .build/$(SIDE) + cmake -B .build/$(SIDE) $(CMAKE_FLAGS) + make -C .build/$(SIDE) -right: | $(PICO_SDK_FILES $(TINYUSB_FILES) .build/right - cmake -B .build/right $(CMAKE_FLAGS_RIGHT) - make -C .build/right +flash: + picotool load .build/$(SIDE)/sxkbd.uf2 $(PICO_SDK_FILES): git submodule update --init lib/picosdk @@ -30,13 +31,7 @@ $(TINYUSB_FILES): git submodule update --init lib/tinyusb git -C lib/tinyusb apply ../../extra/tinyusb.diff -.build/left .build/right: +.build/$(SIDE): mkdir -p $@ -flash_left: - picotool load .build/left/sxkbd.uf2 - -flash_right: - picotool load .build/right/sxkbd.uf2 - -.PHONY: all clean left right flash_left flash_right +.PHONY: all clean build flash