-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Makefile.include: default to RIOTBOARD when BOARD not in BOARDSDIR #12972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Makefile.include
Outdated
# 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, I didn't use a warning or info here since a lot of the code using info-boards-supported
expects a clean output, only the boardslist (e.g. compile_and_test_for_board
).
@cladmi might have good advice on this one. |
Makefile.include
Outdated
@@ -95,6 +95,20 @@ __DIRECTORY_VARIABLES += \ | |||
|
|||
BOARDSDIR := $(abspath $(BOARDSDIR)) | |||
|
|||
# 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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the wildcard,this does not check for a directory, see what was done with ALLBOARDS
should be $(wildcard $(BOARDSDIR)/$(BOARD)/.)
I think.
However it's better to use wildcard than the old $(shell test -d)
.
This was moved before the global goals
separate handling, so the handling does not seem correct for global targets.
A test with an external board (different name) should show this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By this do you mean that it could ignore the external-boards? This is true, if calling for example info-board
with and an external BOARDSDIR
and BOARDS
set to an internal board, then all BOARDS
in the external BOARDSDIR
would be ignored, is this what you meant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes as it is done too early, it would overwrite BOARDSDIR
for the multiple boards case. And so make all the handling done in makefiles/info-global.inc.mk
and boards.inc.mk
useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed and fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick overview, looks good. I'll try to test it asap.
I tested this PR and it works as intended.
With this PR:
I'll let build system experts discuss the syntax introduces by this PR ;) |
Maybe @kaspar030 or @smlng might take a look at that? |
f70a7da
to
2102184
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general. I'll test in the coming days.
ifneq ($(RIOTBOARD),$(BOARDSDIR)) | ||
# The specified board $(BOARD) was not found in $(BOARDSDIR) fallback to RIOTBOARD) | ||
BOARDSDIR = $(RIOTBOARD) | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endif | |
else | |
ifeq (,$(wildcard $(BOARDSDIR)/$(BOARD)/.)) | |
$(error The specified board $(BOARD) does not exist.) | |
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was on purpose. If the first statement is fulfilled the second one will never be evaluated if else
is used, but I want it to be evaluated in any case since BOARDSDIR
value will have changed to RIOTBOARD
, I can think of other ways of evaluating the conditional but it always ends in evaluating something twice. I could change it to:
ifeq (,$(wildcard $(BOARDSDIR)/$(BOARD)/.))
ifneq ($(RIOTBOARD),$(BOARDSDIR))
ifeq (,$(wildcard $(RIOTBOARD)/$(BOARD)/.))
$(error The specified board $(BOARD) is not in RIOTBOARD or BOARDSDIR)
else
# The specified board $(BOARD) was not found in $(BOARDSDIR) but in $(RIOTBOARD)
BOARDSDIR = $(RIOTBOARD)
endif
else
$(error The specified board $(BOARD) is not in RIOTBOARD)
endif
endif
or something like that if you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, ok I see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments were addressed and the code looks good now. It was tested by @dylad.
ACK, please squash.
f809f92
to
33dbf9d
Compare
@aabadie I guess we are good to go here? |
Contribution description
#12183 defined
BOARDSDIR
as a new variable to allow setting external directories where to set aBOARD
.But when
BOARDSDIR
is set to an external directory it wont seeBOARDS
that are not inBORDSDIR
, so noBOARD
inRIOTBOARD
.This PR wants to use
RIOTBOARD
as a fallback forBOARDSDIR
when theBOARD
is not found in the external directory. The handling is replicated ininfo-global.inc.mk
so info-boards-supported would seeBOARDS
inBOARDSDIR
andRIOTBOARD
.Testing procedure
samr21-xpro
(this fails in master)BOARDSDIR=/home/ BOARD=samr21-xpro make -C examples/hello-world/
BOARDSDIR=/home/ BOARD=samr21-xpro make -C examples/hello-world
Issues/PRs references