Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif
-include $(BOARDDIR)/Makefile.dep

# include cpu dependencies
-include $(RIOTCPU)/$(CPU)/Makefile.dep
-include $(CPUDIR)/Makefile.dep

# include external modules dependencies
# processed before RIOT ones to be evaluated before the 'default' rules.
Expand Down
18 changes: 17 additions & 1 deletion Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,23 @@ ifeq (,$(CPU))
$(error $(BOARD): CPU must be defined by board / board_common Makefile.features)
endif

include $(RIOTCPU)/$(CPU)/Makefile.features
CPUSDIRS := $(EXTERNAL_CPU_DIRS) $(RIOTCPU)

# Take the first folder in $(CPUSDIRS) that contains a folder named $(CPU)
CPUDIR := $(word 1,$(foreach dir,$(CPUSDIRS),$(wildcard $(dir)/$(CPU)/.)))
# Sanitize folder
CPUDIR := $(abspath $(CPUDIR))

# Also provide CPUSDIR for compatibility and for accessing common folders
# (e.g. include $(CPUSDIR)/common/external_common/Makefile.dep)
CPUSDIR := $(dir $(CPUDIR))

ifeq (,$(CPUDIR))
$(info Folders searched for the cpu: $(CPUSDIRS))
$(error The specified cpu $(CPU) does not exist.)
endif

include $(CPUDIR)/Makefile.features

# Provide CPU as a feature to allow listing all boards with a CPU
FEATURES_PROVIDED += cpu_$(CPU)
Expand Down
11 changes: 9 additions & 2 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ include $(RIOT_MAKEFILES_GLOBAL_PRE)
# set undefined variables
RIOTBASE ?= $(_riotbase)
RIOTCPU ?= $(RIOTBASE)/cpu
EXTERNAL_CPU_DIRS ?=
# Deprecated to set RIOTBOARD, use EXTERNAL_BOARD_DIRS
RIOTBOARD ?= $(RIOTBASE)/boards
EXTERNAL_BOARD_DIRS ?=
Expand Down Expand Up @@ -106,6 +107,9 @@ ifeq ($(INSIDE_DOCKER),0)
ifeq ($(origin EXTERNAL_PKG_DIRS),command line)
$(error EXTERNAL_PKG_DIRS must be passed as environment variable, and not as command line argument)
endif
ifeq ($(origin EXTERNAL_CPU_DIRS),command line)
$(error EXTERNAL_CPU_DIRS must be passed as environment variable, and not as command line argument)
endif
endif

# Deprecation of configuring 'RIOTBOARD'
Expand Down Expand Up @@ -152,6 +156,9 @@ EXTERNAL_MODULE_DIRS := $(foreach dir,\
EXTERNAL_PKG_DIRS := $(foreach dir,\
$(EXTERNAL_PKG_DIRS),\
$(abspath $(dir)))
EXTERNAL_CPU_DIRS := $(foreach dir,\
$(EXTERNAL_CPU_DIRS),\
$(abspath $(dir)))

# Ensure that all directories are set and don't contain spaces.
ifneq (, $(filter-out 1, $(foreach v,$(__DIRECTORY_VARIABLES),$(words $($(v))))))
Expand Down Expand Up @@ -425,8 +432,8 @@ include $(RIOTMAKE)/boot/riotboot_dfu-util.mk
# Include Board and CPU configuration
INCLUDES += $(addprefix -I,$(wildcard $(BOARDDIR)/include))
include $(BOARDDIR)/Makefile.include
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
include $(RIOTCPU)/$(CPU)/Makefile.include
INCLUDES += -I$(CPUDIR)/include
include $(CPUDIR)/Makefile.include

# include global Makefile.include for `boards` modules
include $(RIOTBASE)/boards/Makefile.include
Expand Down
2 changes: 1 addition & 1 deletion makefiles/application.inc.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MODULE = $(APPLICATION_MODULE)

DIRS += $(RIOTCPU)/$(CPU) $(BOARDDIR)
DIRS += $(CPUDIR) $(BOARDDIR)
DIRS += $(RIOTBASE)/boards
DIRS += $(RIOTBASE)/core $(RIOTBASE)/core/lib $(RIOTBASE)/drivers $(RIOTBASE)/sys

Expand Down
2 changes: 1 addition & 1 deletion makefiles/defaultmodules_regular.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ DEFAULT_MODULE += board board_common_init \
-include $(BOARDDIR)/Makefile.default

# Include potentially added default modules by the CPU
-include $(RIOTCPU)/$(CPU)/Makefile.default
-include $(CPUDIR)/Makefile.default
1 change: 1 addition & 0 deletions makefiles/dependency_resolution.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ else

# Detect provided / used / optional features that do not exist
include $(RIOTMAKE)/features_existing.inc.mk
-include $(EXTERNAL_CPU_DIRS)/features_existing.inc.mk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be converted to an iterator, should this approach be chosen.

FEATURES_NONEXISTING := $(sort $(filter-out $(FEATURES_EXISTING),$(FEATURES_PROVIDED)))
ifneq (,$(FEATURES_NONEXISTING))
$(error "The following non-existing features are provided by the board $(BOARD): $(FEATURES_NONEXISTING)")
Expand Down
1 change: 1 addition & 0 deletions makefiles/info.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ info-build:
@echo 'RIOTBASE: $(RIOTBASE)'
@echo 'BOARDDIR: $(BOARDDIR)'
@echo 'EXTERNAL_BOARD_DIRS:$(EXTERNAL_BOARD_DIRS)'
@echo 'EXTERNAL_CPU_DIRS:$(EXTERNAL_CPU_DIRS)'
@echo 'RIOTCPU: $(RIOTCPU)'
@echo 'RIOTPKG: $(RIOTPKG)'
@echo ''
Expand Down
3 changes: 3 additions & 0 deletions makefiles/vars.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export RIOTBOARD # This folder is the base of the riot boards.
export BOARDSDIR # This is the folder containing the board dir
export EXTERNAL_BOARD_DIRS # List of folders containing external board dirs
export BOARDDIR # This folder contains the board
export CPUSDIR # This is the folder containing the CPU dir
export EXTERNAL_CPU_DIRS # list of folders containing external CPU dirs
export CPUDIR # This folder contains the CPU
export RIOTPKG # For overriding RIOT's pkg directory
export RIOTTOOLS # Location of host machine tools
export RIOTPROJECT # Top level git root of the project being built, or PWD if not a git repository
Expand Down
Loading