From dec128f508a5c1a3ce4050b43838366a6b6f74c1 Mon Sep 17 00:00:00 2001 From: Rose Hooper Date: Mon, 31 Oct 2022 23:57:59 -0400 Subject: [PATCH 1/6] add boards list to make error message --- ports/atmel-samd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 4405766d00c86..d82c5faabc4ec 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -24,7 +24,7 @@ # Select the board to build for. ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(error You must provide a BOARD parameter: $(basename $(wildcard boards/*))) else ifeq ($(wildcard boards/$(BOARD)/.),) $(error Invalid BOARD specified) From 36c4cc7d303e1700c684e80d290ca9ec275e38fe Mon Sep 17 00:00:00 2001 From: Rose Hooper Date: Tue, 1 Nov 2022 00:18:46 -0400 Subject: [PATCH 2/6] fix output layout of board list --- ports/atmel-samd/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index d82c5faabc4ec..fce68d4d41251 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -23,8 +23,15 @@ # THE SOFTWARE. # Select the board to build for. +define boardlist + +$(foreach dir,$(filter-out %.*,$(wildcard boards/*)),$(notdir $(dir))) + + +endef + ifeq ($(BOARD),) - $(error You must provide a BOARD parameter: $(basename $(wildcard boards/*))) + $(error You must provide a BOARD parameter: $(boardlist)Rerun with $(MAKE) BOARD=) else ifeq ($(wildcard boards/$(BOARD)/.),) $(error Invalid BOARD specified) From 8933f93439b10a7402f2c962bd5742b7902f1e38 Mon Sep 17 00:00:00 2001 From: Rose Hooper Date: Tue, 1 Nov 2022 11:00:48 -0400 Subject: [PATCH 3/6] simplify and use columns for boardlist --- ports/atmel-samd/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index fce68d4d41251..d27a048399f22 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -23,18 +23,20 @@ # THE SOFTWARE. # Select the board to build for. -define boardlist - -$(foreach dir,$(filter-out %.*,$(wildcard boards/*)),$(notdir $(dir))) - - +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) endef ifeq ($(BOARD),) - $(error You must provide a BOARD parameter: $(boardlist)Rerun with $(MAKE) BOARD=) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif From e2a359726351cd18ecaaf13c6adaca2091abb2ee Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Fri, 18 Nov 2022 11:27:23 +0530 Subject: [PATCH 4/6] add awesome new make error message Copied from initial implementation on atmel-samd Co-authored-by: Rose Hooper Co-authored-by: Jeff Epler --- ports/broadcom/Makefile | 13 ++++++++++--- ports/cxd56/Makefile | 13 +++++++++++-- ports/espressif/Makefile | 13 +++++++++++-- ports/litex/Makefile | 13 +++++++++++-- ports/mimxrt10xx/Makefile | 13 +++++++++++-- ports/nrf/Makefile | 16 +++++++++++----- ports/raspberrypi/Makefile | 13 +++++++++++-- ports/stm/Makefile | 17 +++++++++++++---- 8 files changed, 89 insertions(+), 22 deletions(-) diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index 757e7f3450d5c..ca516958e0f5f 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -1,11 +1,18 @@ # Select the board to build for. -BOARD?=raspberrypi_pi4b +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD "$(BOARD)" specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 073d2d59ce43c..208d3222b061a 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -23,11 +23,20 @@ # THE SOFTWARE. # Select the board to build for. +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 30c35f9caf7e3..331e443561a0a 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -23,11 +23,20 @@ # THE SOFTWARE. # Select the board to build for. +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 6b1e33c8d1cee..3281977657c69 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -23,11 +23,20 @@ # THE SOFTWARE. # Select the board to build for. +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 4b05c91714355..2dda646882d3a 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -24,11 +24,20 @@ # THE SOFTWARE. # Select the board to build for. +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index bbe102ffc8cc3..2dbc5820222b5 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -23,14 +23,20 @@ # THE SOFTWARE. # Select the board to build for. +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + ifeq ($(BOARD),) - $(info You must provide a BOARD parameter with 'BOARD=') - $(info Possible values are:) - $(info $(sort $(subst /.,,$(subst boards/,,$(wildcard boards/*/.))))) - $(error BOARD not defined) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 5095c4c1f8dbb..151c60ba1b90e 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -23,11 +23,20 @@ # THE SOFTWARE. # Select the board to build for. +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(info No BOARD specified) + $(call show_board_error) else ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) + $(info Invalid BOARD specified) + $(call show_board_error) endif endif diff --git a/ports/stm/Makefile b/ports/stm/Makefile index afde51bdc0413..ac373cbbfa694 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -24,12 +24,21 @@ # THE SOFTWARE. # Select the board to build for. +define show_board_error +boardlist = +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + ifeq ($(BOARD),) -$(error You must provide a BOARD parameter) + $(info No BOARD specified) + $(call show_board_error) else -ifeq ($(wildcard boards/$(BOARD)/.),) -$(error Invalid BOARD specified) -endif + ifeq ($(wildcard boards/$(BOARD)/.),) + $(info Invalid BOARD specified) + $(call show_board_error) + endif endif # If the build directory is not given, make it reflect the board name. From c3c1717813808563b9a5f3cd6072d93eb7ba401e Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Fri, 18 Nov 2022 23:00:28 +0530 Subject: [PATCH 5/6] refactor common port specific Makefile code --- ports/atmel-samd/Makefile | 40 +--------------------- ports/broadcom/Makefile | 64 ++++++++++++++-------------------- ports/cxd56/Makefile | 43 +---------------------- ports/espressif/Makefile | 46 +------------------------ ports/litex/Makefile | 41 +--------------------- ports/mimxrt10xx/Makefile | 40 +--------------------- ports/nrf/Makefile | 45 +++--------------------- ports/raspberrypi/Makefile | 40 +--------------------- ports/stm/Makefile | 41 +--------------------- py/circuitpy_mkenv.mk | 70 ++++++++++++++++++++++++++++++++++++++ 10 files changed, 107 insertions(+), 363 deletions(-) create mode 100644 py/circuitpy_mkenv.mk diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index d27a048399f22..fdfb6c81b89ba 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -22,45 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk -# Port-specific -include mpconfigport.mk -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +include ../../py/circuitpy_mkenv.mk CROSS_COMPILE = arm-none-eabi- diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index ca516958e0f5f..cbd072e8336b6 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -1,42 +1,28 @@ -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk -# Port-specific -include mpconfigport.mk -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +# This file is part of the MicroPython project, http://micropython.org/ +# +# The MIT License (MIT) +# +# SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +include ../../py/circuitpy_mkenv.mk ifeq ($(CHIP_VARIANT), "bcm2711") CFLAGS += -mcpu=cortex-a72 -DBCM_VERSION=2711 diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 208d3222b061a..389b8a7fe6434 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -22,48 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk - -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk - -# Port-specific -include mpconfigport.mk - -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +include ../../py/circuitpy_mkenv.mk CROSS_COMPILE = arm-none-eabi- diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 331e443561a0a..b197195aa2bcf 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -22,51 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the flash PORT is not given, use the default /dev/tty.SLAB_USBtoUART. -PORT ?= /dev/tty.SLAB_USBtoUART - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk - -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk - -# Port-specific -include mpconfigport.mk - -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +include ../../py/circuitpy_mkenv.mk ifeq ($(IDF_TARGET),esp32c3) IDF_TARGET_ARCH = riscv diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 3281977657c69..1c5c0a014e6b4 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -22,46 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk -# Port-specific -include mpconfigport.mk - -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +include ../../py/circuitpy_mkenv.mk CROSS_COMPILE = riscv64-unknown-elf- diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 2dda646882d3a..1c5c62bb8557c 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -23,45 +23,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk -# Port-specific -include mpconfigport.mk -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +include ../../py/circuitpy_mkenv.mk CROSS_COMPILE = arm-none-eabi- diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 2dbc5820222b5..22cfd474ce340 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -22,51 +22,16 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif +include ../../py/circuitpy_mkenv.mk -CLI_SD := $(SD) SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]') -# Build directory with SD if it's different from the default. -BUILD ?= $(if $(CLI_SD),build-$(BOARD)-$(SD_LOWER),build-$(BOARD)) - -include ../../py/mkenv.mk -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk -# Port-specific -include mpconfigport.mk -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk - ifneq ($(SD), ) include bluetooth/bluetooth_common.mk + ifeq ($(BUILD), build-$(BOARD)) + # Build directory with SD if it's different from the default. + BUILD = build-$(BOARD)-$(SD_LOWER) + endif endif CROSS_COMPILE = arm-none-eabi- diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 151c60ba1b90e..06408e25c6c78 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -22,45 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk -# Port-specific -include mpconfigport.mk -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +include ../../py/circuitpy_mkenv.mk CROSS_COMPILE = arm-none-eabi- diff --git a/ports/stm/Makefile b/ports/stm/Makefile index ac373cbbfa694..726123a0ba509 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -23,46 +23,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -# Select the board to build for. -define show_board_error -boardlist = -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif - -# If the build directory is not given, make it reflect the board name. -BUILD ?= build-$(BOARD) - -include ../../py/mkenv.mk -# Board-specific -include boards/$(BOARD)/mpconfigboard.mk -# Port-specific -include mpconfigport.mk - -# CircuitPython-specific -include $(TOP)/py/circuitpy_mpconfig.mk - -# qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h - -# include py core make definitions -include $(TOP)/py/py.mk - -include $(TOP)/supervisor/supervisor.mk - -# Include make rules and variables common across CircuitPython builds. -include $(TOP)/py/circuitpy_defns.mk +include ../../py/circuitpy_mkenv.mk CROSS_COMPILE = arm-none-eabi- diff --git a/py/circuitpy_mkenv.mk b/py/circuitpy_mkenv.mk new file mode 100644 index 0000000000000..d776cc2fef29f --- /dev/null +++ b/py/circuitpy_mkenv.mk @@ -0,0 +1,70 @@ +# This file is part of the MicroPython project, http://micropython.org/ +# +# The MIT License (MIT) +# +# SPDX-FileCopyrightText: Copyright (c) 2022 MicroDev +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Common Makefile items that can be shared across CircuitPython ports. + +# Select the board to build for. +define show_board_error +$(info Valid boards:) +$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) +$(error Rerun with $(MAKE) BOARD=) +endef + +ifeq ($(BOARD),) + $(info No BOARD specified) + $(call show_board_error) +else + ifeq ($(wildcard boards/$(BOARD)/.),) + $(info Invalid BOARD specified) + $(call show_board_error) + endif +endif + +# If the flash PORT is not given, use the default /dev/tty.SLAB_USBtoUART. +PORT ?= /dev/tty.SLAB_USBtoUART + +# If the build directory is not given, make it reflect the board name. +BUILD ?= build-$(BOARD) + +include ../../py/mkenv.mk + +# Board-specific +include boards/$(BOARD)/mpconfigboard.mk + +# Port-specific +include mpconfigport.mk + +# CircuitPython-specific +include $(TOP)/py/circuitpy_mpconfig.mk + +# qstr definitions (must come before including py.mk) +QSTR_DEFS = qstrdefsport.h + +# include py core make definitions +include $(TOP)/py/py.mk + +include $(TOP)/supervisor/supervisor.mk + +# Include make rules and variables common across CircuitPython builds. +include $(TOP)/py/circuitpy_defns.mk From 7c51201e88e75f351aa882a97e7395181585f8fd Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sat, 19 Nov 2022 00:18:35 +0530 Subject: [PATCH 6/6] fix nRF build directory naming --- ports/nrf/Makefile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 22cfd474ce340..67d2a5e68527d 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -24,14 +24,8 @@ include ../../py/circuitpy_mkenv.mk -SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]') - ifneq ($(SD), ) include bluetooth/bluetooth_common.mk - ifeq ($(BUILD), build-$(BOARD)) - # Build directory with SD if it's different from the default. - BUILD = build-$(BOARD)-$(SD_LOWER) - endif endif CROSS_COMPILE = arm-none-eabi- pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy