From 97ffc53ec9ff10c7585125229ef077233c77cc48 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Tue, 15 Aug 2023 23:30:22 +1000 Subject: [PATCH] {esp32,rp2,stm32}/Makefile: Append board variant to BUILD. This allows switching between variants without clobbering the build output. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared --- ports/esp32/Makefile | 7 ++++++- ports/rp2/Makefile | 8 +++++++- ports/stm32/Makefile | 7 ++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile index 239618c6f73a..9d57ee4c2179 100644 --- a/ports/esp32/Makefile +++ b/ports/esp32/Makefile @@ -17,8 +17,13 @@ ifeq ($(wildcard $(BOARD_DIR)/.),) $(error Invalid BOARD specified: $(BOARD_DIR)) endif -# If the build directory is not given, make it reflect the board name. +# If the build directory is not given, make it reflect the board name (and +# optionally the board variant). +ifneq ($(BOARD_VARIANT),) +BUILD ?= build-$(BOARD)-$(BOARD_VARIANT) +else BUILD ?= build-$(BOARD) +endif # Device serial settings. PORT ?= /dev/ttyUSB0 diff --git a/ports/rp2/Makefile b/ports/rp2/Makefile index ccfc1ac7d6c7..fdca11d11eba 100644 --- a/ports/rp2/Makefile +++ b/ports/rp2/Makefile @@ -16,8 +16,14 @@ endif ifeq ($(wildcard $(BOARD_DIR)/.),) $(error Invalid BOARD specified: $(BOARD_DIR)) endif - + +# If the build directory is not given, make it reflect the board name (and +# optionally the board variant). +ifneq ($(BOARD_VARIANT),) +BUILD ?= build-$(BOARD)-$(BOARD_VARIANT) +else BUILD ?= build-$(BOARD) +endif $(VERBOSE)MAKESILENT = -s diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 7051398970fb..475d8f1004f0 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -13,8 +13,13 @@ ifeq ($(wildcard $(BOARD_DIR)/.),) $(error Invalid BOARD specified: $(BOARD_DIR)) endif -# If the build directory is not given, make it reflect the board name. +# If the build directory is not given, make it reflect the board name (and +# optionally the board variant). +ifneq ($(BOARD_VARIANT),) +BUILD ?= build-$(BOARD)-$(BOARD_VARIANT) +else BUILD ?= build-$(BOARD) +endif include ../../py/mkenv.mk -include mpconfigport.mk