mongoose/test/pico-sdk/Makefile
2024-11-11 14:52:28 -03:00

28 lines
786 B
Makefile

PROJECTS ?= $(wildcard ../../examples/pico-sdk/*-picosdk-*)
SDK_PATH ?= $(realpath $(PWD))/pico-sdk
SDK_VERSION ?= 2.0.0
all: $(PROJECTS)
echo
$(PROJECTS): pico-sdk FORCE
(make -C $@ build SDK_PATH=$(SDK_PATH) && make -C $@ clean) || ( \
ln -s $(SDK_PATH) $@/pico-sdk && \
cd $@ && rm -rf build && mkdir -p build && \
cd build && cmake -DPICO_BOARD=$(SDKBNAME) -G "Unix Makefiles" .. && make && \
cd .. && rm -rf build pico-sdk )
FORCE:
pico-sdk:
test -d $(SDK_PATH) || ( git clone --depth 1 -b $(SDK_VERSION) https://github.com/raspberrypi/pico-sdk $@ && \
cd $@ && git submodule update --init )
clean:
rm -rf $(SDK_PATH)
# Wizard-style board name --> Pico-SDK board name; SDKBNAME = table[BOARD]
SDK_evb-pico := pico
SDK_evb-pico2 := pico2
SDKBNAME = $(SDK_$(BOARD))