From f7f58d6a6b4c62c5df8e53f36e9c9bb15347067c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 27 May 2019 20:56:47 +0200 Subject: [PATCH 1/3] makefiles/boards.inc.mk: list boards variables * Add a variable to list all boards without using 'find'. * By default 'BOARDS' is the list of all boards. * Add the 'info-boards' target that lists BOARDS. * Use in RIOT/Makefile --- Makefile | 1 + makefiles/boards.inc.mk | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 makefiles/boards.inc.mk diff --git a/Makefile b/Makefile index cd6eddd1c3..144cbd7e65 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ welcome: print-versions: @./dist/tools/ci/print_toolchain_versions.sh +include makefiles/boards.inc.mk include makefiles/app_dirs.inc.mk -include makefiles/tests.inc.mk diff --git a/makefiles/boards.inc.mk b/makefiles/boards.inc.mk new file mode 100644 index 0000000000..5049c44c5b --- /dev/null +++ b/makefiles/boards.inc.mk @@ -0,0 +1,14 @@ +# Default when RIOTBASE is not set and is executed from the RIOT directory +RIOTBOARD ?= $(or $(RIOTBASE),$(CURDIR))/boards + +# List all boards. +# By default, all directories in RIOTBOARD except 'common' +# use 'wildcard */.' to only list directories +ALLBOARDS ?= $(sort $(filter-out common,$(patsubst $(RIOTBOARD)/%/.,%,$(wildcard $(RIOTBOARD)/*/.)))) + +# Set the default value from `BOARDS` +BOARDS ?= $(ALLBOARDS) + +.PHONY: info-boards +info-boards: + @echo $(BOARDS) From 6130918ca86b8c63ec9f77a44658bb2a3147e2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 27 May 2019 20:59:19 +0200 Subject: [PATCH 2/3] Makefile.include: use the variables from makefiles/boards.inc.mk BOARDS is defined, so the `find` line in `makefiles/info-global` is not needed anymore. --- Makefile.include | 3 +++ makefiles/info-global.inc.mk | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.include b/Makefile.include index f9ed21b6a1..9c37e40d63 100644 --- a/Makefile.include +++ b/Makefile.include @@ -97,6 +97,9 @@ include $(RIOTMAKE)/color.inc.mk # include concurrency helpers include $(RIOTMAKE)/info-nproc.inc.mk +# List of boards variables +include $(RIOTMAKE)/boards.inc.mk + GLOBAL_GOALS += buildtest info-boards-supported info-boards-features-missing info-buildsizes info-buildsizes-diff ifneq (, $(filter $(GLOBAL_GOALS), $(MAKECMDGOALS))) BOARD=none diff --git a/makefiles/info-global.inc.mk b/makefiles/info-global.inc.mk index f6996eddad..665ecfb7e9 100644 --- a/makefiles/info-global.inc.mk +++ b/makefiles/info-global.inc.mk @@ -37,7 +37,6 @@ define board_missing_features endif endef -BOARDS ?= $(shell find $(RIOTBOARD)/* -maxdepth 0 -type d \! -name "common" -exec basename {} \;) BOARDS := $(filter $(if $(BOARD_WHITELIST), $(BOARD_WHITELIST), %), $(BOARDS)) BOARDS := $(filter-out $(BOARD_BLACKLIST), $(BOARDS)) From 45e611d7656bab59a5077a80a63335f94003a6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 27 May 2019 21:04:49 +0200 Subject: [PATCH 3/3] makefiles/app_dirs.inc.mk: Calculate 'BOARDS' value only once Evaluate BOARDS only once before going in all directories. This uses the target specific 'export BOARDS ?=' to export the variable with its value without evaluating during parsing. --- makefiles/app_dirs.inc.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/makefiles/app_dirs.inc.mk b/makefiles/app_dirs.inc.mk index 6404b63894..d4a9bdd9d6 100644 --- a/makefiles/app_dirs.inc.mk +++ b/makefiles/app_dirs.inc.mk @@ -21,3 +21,5 @@ info-applications-supported-boards: @for dir in $(APPLICATION_DIRS); do \ make --no-print-directory -C $${dir} info-boards-supported 2>/dev/null | xargs -n 1 echo $${dir}; \ done +# BOARDS values from 'boards.inc.mk' to only evaluate it once +info-applications-supported-boards: export BOARDS ?=