2021-01-20 08:34:08 -05:00
|
|
|
# Makefile for micropython on Raspberry Pi RP2
|
|
|
|
#
|
|
|
|
# This is a simple wrapper around cmake
|
|
|
|
|
2021-04-05 16:57:18 -04:00
|
|
|
BOARD ?= PICO
|
|
|
|
|
|
|
|
BUILD ?= build-$(BOARD)
|
2021-01-20 08:34:08 -05:00
|
|
|
|
|
|
|
$(VERBOSE)MAKESILENT = -s
|
|
|
|
|
2021-04-05 16:57:18 -04:00
|
|
|
CMAKE_ARGS = -DMICROPY_BOARD=$(BOARD)
|
2021-02-23 17:57:14 -05:00
|
|
|
|
|
|
|
ifdef USER_C_MODULES
|
|
|
|
CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES}
|
|
|
|
endif
|
|
|
|
|
2022-02-09 06:58:56 -05:00
|
|
|
ifneq ($(FROZEN_MANIFEST),)
|
|
|
|
CMAKE_ARGS += -DMICROPY_FROZEN_MANIFEST=${FROZEN_MANIFEST}
|
|
|
|
endif
|
|
|
|
|
2022-04-27 04:43:26 -04:00
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=Debug
|
|
|
|
endif
|
|
|
|
|
2021-01-20 08:34:08 -05:00
|
|
|
all:
|
2022-07-03 21:14:47 -04:00
|
|
|
[ -e $(BUILD)/Makefile ] || cmake -S . -B $(BUILD) -DPICO_BUILD_DOCS=0 ${CMAKE_ARGS}
|
2021-01-20 08:34:08 -05:00
|
|
|
$(MAKE) $(MAKESILENT) -C $(BUILD)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) -rf $(BUILD)
|
2021-08-17 06:40:20 -04:00
|
|
|
|
2022-06-30 02:01:02 -04:00
|
|
|
GIT_SUBMODULES += lib/mbedtls lib/tinyusb
|
2021-08-17 06:40:20 -04:00
|
|
|
|
|
|
|
submodules:
|
2022-06-30 02:01:02 -04:00
|
|
|
# lib/pico-sdk is required for the cmake build to function (as used for boards other than PICO below)
|
|
|
|
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="lib/pico-sdk" submodules
|
2022-04-28 15:49:20 -04:00
|
|
|
ifeq ($(BOARD),PICO)
|
|
|
|
# Run the standard submodules target with minimum required submodules above
|
2021-08-17 06:40:20 -04:00
|
|
|
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$(GIT_SUBMODULES)" submodules
|
2022-04-28 15:49:20 -04:00
|
|
|
else
|
|
|
|
# Run submodules task through cmake interface to pick up any board specific dependencies.
|
|
|
|
GIT_SUBMODULES=$$(cmake -B $(BUILD)/submodules -DECHO_SUBMODULES=1 -DGIT_SUBMODULES="$(GIT_SUBMODULES)" ${CMAKE_ARGS} -S . 2>&1 | \
|
|
|
|
grep 'GIT_SUBMODULES=' | cut -d= -f2); \
|
|
|
|
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" submodules
|
|
|
|
endif
|