From 1f66c0f3ee2696ed9a7bdae9c2b08759b1bfe42e Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Sat, 14 Dec 2019 23:16:01 +0100 Subject: [PATCH 1/4] Makefile.include: RIOTBOARD as BOARDSDIR fallback --- Makefile.include | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile.include b/Makefile.include index 7b551e44d8..2e1f8b8cbe 100644 --- a/Makefile.include +++ b/Makefile.include @@ -158,6 +158,20 @@ else all: link +# Include Board and CPU configuration, if BOARD is not found in BOARDSDIR +# e.g. when set by the environment fallback to searching in RIOTBOARD +ifeq (,$(wildcard $(BOARDSDIR)/$(BOARD)/.)) + ifneq ($(RIOTBOARD),$(BOARDSDIR)) + # The specified board $(BOARD) was not found in $(BOARDSDIR) fallback to RIOTBOARD + BOARDSDIR = $(RIOTBOARD) + endif + ifeq ($(RIOTBOARD),$(BOARDSDIR)) + ifeq (,$(wildcard $(BOARDSDIR)/$(BOARD)/.)) + $(error The specified board $(BOARD) does not exist.) + endif + endif +endif + include $(RIOTMAKE)/info.inc.mk # Static code analysis tools provided by LLVM @@ -265,9 +279,6 @@ LAZYSPONGE_FLAGS ?= $(if $(filter 1,$(QUIET)),,--verbose) ifeq (, $(APPLICATION)) $(error An application name must be specified as APPLICATION.) endif -ifneq (0,$(shell test -d $(BOARDSDIR)/$(BOARD); echo $$?)) - $(error The specified board $(BOARD) does not exist.) -endif # Use TOOLCHAIN environment variable to select the toolchain to use. # Default for macOS: llvm; for other OS: gnu From 18444ac99a461181cf24370c29b7956847b727e9 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Sun, 15 Dec 2019 10:40:54 +0100 Subject: [PATCH 2/4] makefiles/boards.inc.mk: include BOARDSDIR and RIOTBOARD --- makefiles/boards.inc.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/makefiles/boards.inc.mk b/makefiles/boards.inc.mk index 7a56a238fc..27fe0b3836 100644 --- a/makefiles/boards.inc.mk +++ b/makefiles/boards.inc.mk @@ -1,10 +1,18 @@ # Default when RIOTBASE is not set and is executed from the RIOT directory BOARDSDIR ?= $(or $(RIOTBASE),$(CURDIR))/boards -# List all boards. +# List all boards in a directory # By default, all directories in BOARDSDIR except 'common' # use 'wildcard */.' to only list directories -ALLBOARDS ?= $(sort $(filter-out common,$(patsubst $(BOARDSDIR)/%/.,%,$(wildcard $(BOARDSDIR)/*/.)))) +_get_boards_in_directory = $(filter-out common,$(patsubst $1/%/.,%,$(wildcard $1/*/.))) + +# If BOARDSDIR is not in RIOTBOARD also list BOARDS in RIOTBOARD +ifneq ($(RIOTBOARD),$(BOARDSDIR)) + ALLBOARDS_RIOTBOARD ?= $(call _get_boards_in_directory,$(RIOTBOARD)) +endif + +# Get all boards +ALLBOARDS ?= $(sort $(call _get_boards_in_directory,$(BOARDSDIR)) $(ALLBOARDS_RIOTBOARD)) # Set the default value from `BOARDS` BOARDS ?= $(ALLBOARDS) From cacdd5634864a5510b2d9558db54ecb322a3c75e Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Sat, 14 Dec 2019 23:17:04 +0100 Subject: [PATCH 3/4] makefiles/info-global.inc.mk: RIOTBOAR as BOARDSDIR fallback --- makefiles/info-global.inc.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/makefiles/info-global.inc.mk b/makefiles/info-global.inc.mk index c51b2a1237..b99eda1096 100644 --- a/makefiles/info-global.inc.mk +++ b/makefiles/info-global.inc.mk @@ -1,6 +1,7 @@ .PHONY: info-buildsizes info-buildsizes-diff info-features-missing \ info-boards-features-missing +BOARDSDIR_GLOBAL := $(BOARDSDIR) USEMODULE_GLOBAL := $(USEMODULE) USEPKG_GLOBAL := $(USEPKG) FEATURES_REQUIRED_GLOBAL := $(FEATURES_REQUIRED) @@ -13,6 +14,7 @@ FEATURES_BLACKLIST_GLOBAL := $(FEATURES_BLACKLIST) define board_unsatisfied_features BOARD := $(1) + BOARDSDIR := $(BOARDSDIR_GLOBAL) USEMODULE := $(USEMODULE_GLOBAL) USEPKG := $(USEPKG_GLOBAL) DISABLE_MODULE := $(DISABLE_MODULE_GLOBAL) @@ -31,6 +33,12 @@ define board_unsatisfied_features undefine CPU undefine CPU_MODEL + # Replicate Makefile.include handling that sets BOARDSDIR to RIOTBOARD + # when BOARD is not found in BOARDSDIR + ifeq (,$(wildcard $(BOARDSDIR_GLOBAL)/$(BOARD)/.)) + BOARDSDIR = $(RIOTBOARD) + endif + include $(RIOTBASE)/Makefile.features include $(RIOTMAKE)/defaultmodules.inc.mk From 33dbf9dfcde7db1f0a5d3cbfe768834469626431 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Sun, 22 Dec 2019 09:48:42 +0100 Subject: [PATCH 4/4] tests/external_board_native: require arch_native --- tests/external_board_native/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/external_board_native/Makefile b/tests/external_board_native/Makefile index 94c1ef91bf..a8dab58549 100644 --- a/tests/external_board_native/Makefile +++ b/tests/external_board_native/Makefile @@ -9,6 +9,10 @@ RIOTBASE ?= $(CURDIR)/../../ # In practice it should be something else BOARD ?= native +# Require arch_native feature so this is not compiled for other boards in +# $(RIOTBOARD)/ +FEATURES_REQUIRED += arch_native + # Set without '?=' to also verify the docker integration when set with = BOARDSDIR = $(CURDIR)/external_boards