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] 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 757e7f3450..ca516958e0 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 073d2d59ce..208d3222b0 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 30c35f9caf..331e443561 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 6b1e33c8d1..3281977657 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 4b05c91714..2dda646882 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 bbe102ffc8..2dbc582022 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 5095c4c1f8..151c60ba1b 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 afde51bdc0..ac373cbbfa 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.