2021-01-20 13:34:08 +00:00
|
|
|
# Makefile for micropython on Raspberry Pi RP2
|
|
|
|
#
|
|
|
|
# This is a simple wrapper around cmake
|
|
|
|
|
2021-04-05 21:57:18 +01:00
|
|
|
BOARD ?= PICO
|
|
|
|
|
|
|
|
BUILD ?= build-$(BOARD)
|
2021-01-20 13:34:08 +00:00
|
|
|
|
|
|
|
$(VERBOSE)MAKESILENT = -s
|
|
|
|
|
2021-04-05 21:57:18 +01:00
|
|
|
CMAKE_ARGS = -DMICROPY_BOARD=$(BOARD)
|
2021-02-23 22:57:14 +00:00
|
|
|
|
|
|
|
ifdef USER_C_MODULES
|
|
|
|
CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES}
|
|
|
|
endif
|
|
|
|
|
2022-02-09 11:58:56 +00:00
|
|
|
ifneq ($(FROZEN_MANIFEST),)
|
|
|
|
CMAKE_ARGS += -DMICROPY_FROZEN_MANIFEST=${FROZEN_MANIFEST}
|
|
|
|
endif
|
|
|
|
|
2022-04-27 09:43:26 +01:00
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=Debug
|
|
|
|
endif
|
|
|
|
|
2022-09-11 02:40:59 +01:00
|
|
|
ifdef BOARD_VARIANT
|
|
|
|
CMAKE_ARGS += -DBOARD_VARIANT=${BOARD_VARIANT}
|
|
|
|
endif
|
|
|
|
|
2022-09-14 01:08:59 +01:00
|
|
|
HELP_BUILD_ERROR ?= "See \033[1;31mhttps://github.com/micropython/micropython/wiki/Build-Troubleshooting\033[0m"
|
|
|
|
|
2021-01-20 13:34:08 +00:00
|
|
|
all:
|
2022-07-04 02:14:47 +01:00
|
|
|
[ -e $(BUILD)/Makefile ] || cmake -S . -B $(BUILD) -DPICO_BUILD_DOCS=0 ${CMAKE_ARGS}
|
2022-09-14 01:08:59 +01:00
|
|
|
$(MAKE) $(MAKESILENT) -C $(BUILD) || (echo -e $(HELP_BUILD_ERROR); false)
|
2021-01-20 13:34:08 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) -rf $(BUILD)
|
2021-08-17 11:40:20 +01:00
|
|
|
|
2022-07-08 06:26:06 +01:00
|
|
|
# First ensure that pico-sdk is initialised, then use cmake to pick everything
|
|
|
|
# else (including board-specific dependencies).
|
2021-08-17 11:40:20 +01:00
|
|
|
submodules:
|
2022-06-30 07:01:02 +01:00
|
|
|
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="lib/pico-sdk" submodules
|
2022-07-08 06:26:06 +01:00
|
|
|
GIT_SUBMODULES=$$(cmake -B $(BUILD)/submodules -DECHO_SUBMODULES=1 ${CMAKE_ARGS} -S . 2>&1 | \
|
|
|
|
grep '^GIT_SUBMODULES=' | cut -d= -f2); \
|
2022-04-28 20:49:20 +01:00
|
|
|
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" submodules
|
2022-09-11 02:40:59 +01:00
|
|
|
|
|
|
|
query-variants:
|
|
|
|
@BOARD_VARIANTS=$$(cmake -B $(BUILD)/variants -DECHO_BOARD_VARIANTS=1 ${CMAKE_ARGS} -S . 2>&1 | \
|
|
|
|
grep '^BOARD_VARIANTS=' | cut -d= -f2); \
|
|
|
|
echo "VARIANTS: $${BOARD_VARIANTS}"
|