summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-08-15 23:30:22 +1000
committerJim Mussared <jim.mussared@gmail.com>2023-08-23 13:54:37 +1000
commit97ffc53ec9ff10c7585125229ef077233c77cc48 (patch)
treefd38239f5aa2000268abdf50dc816259c2e253b4
parent1a99f74063569df0927e1ada0256059fcdef128c (diff)
{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 <jim.mussared@gmail.com>
-rw-r--r--ports/esp32/Makefile7
-rw-r--r--ports/rp2/Makefile8
-rw-r--r--ports/stm32/Makefile7
3 files changed, 19 insertions, 3 deletions
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile
index 239618c6f..9d57ee4c2 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 ccfc1ac7d..fdca11d11 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 705139897..475d8f100 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