diff options
| author | Jim Mussared <jim.mussared@gmail.com> | 2023-02-21 16:24:17 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-02-23 09:50:07 +1100 |
| commit | 8e430a7d43ea6e32fa4c16cb45bc533704a8b996 (patch) | |
| tree | 4076c417e547890bfce3dc9f682fbd7f902ebb31 | |
| parent | 742037ec3836c56baf51289288ba954d901e728a (diff) | |
rp2/Makefile: Allow specifying BOARD_DIR on make command line.
This matches the behavior of the makefile ports but implemented for CMake,
making it easy to specify custom board definitions.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
| -rw-r--r-- | ports/rp2/Makefile | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ports/rp2/Makefile b/ports/rp2/Makefile index 7057021bf..4f5b4728e 100644 --- a/ports/rp2/Makefile +++ b/ports/rp2/Makefile @@ -2,13 +2,26 @@ # # This is a simple wrapper around cmake +# Select the board to build for: +ifdef BOARD_DIR +# Custom board path - remove trailing slash and get the final component of +# the path as the board name. +BOARD ?= $(notdir $(BOARD_DIR:/=)) +else +# If not given on the command line, then default to PICO. BOARD ?= PICO +BOARD_DIR ?= boards/$(BOARD) +endif + +ifeq ($(wildcard $(BOARD_DIR)/.),) +$(error Invalid BOARD specified: $(BOARD_DIR)) +endif BUILD ?= build-$(BOARD) $(VERBOSE)MAKESILENT = -s -CMAKE_ARGS = -DMICROPY_BOARD=$(BOARD) +CMAKE_ARGS = -DMICROPY_BOARD=$(BOARD) -DMICROPY_BOARD_DIR=$(abspath $(BOARD_DIR)) ifdef USER_C_MODULES CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES} |
