1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #12972 from fjmolinas/pr_boardsdir_riotboard

Makefile.include: default to RIOTBOARD when BOARD not in BOARDSDIR
This commit is contained in:
Alexandre Abadie 2019-12-31 10:51:27 +01:00 committed by GitHub
commit 68210feb54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 5 deletions

View File

@ -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
@ -263,9 +277,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

View File

@ -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)

View File

@ -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

View File

@ -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