make: allow drivers to implement features

This change allows drivers (or any module for that matter) to provide
features. This is e.g. useful if a board does not have a transceiver,
but your application uses `USEMODULE += some_driver`, which implements
the transceiver interface.

The line `FEATURES_PROVIDED += some_feature` should go to the guarded
block in `{sys,drivers}/Makefile.include`.
This commit is contained in:
René Kijewski 2014-10-26 23:36:05 +01:00
parent 938d7d441b
commit 765c88d08a
26 changed files with 31 additions and 29 deletions

View File

@ -173,7 +173,7 @@ info-build:
@echo ' $(or $(sort $(filter-out $(FEATURES_OPTIONAL), $(FEATURES_REQUIRED))), -none-)'
@echo 'FEATURES_OPTIONAL (strictly "nice to have"):'
@echo ' $(or $(sort $(FEATURES_OPTIONAL)), -none-)'
@echo 'FEATURES_PROVIDED (by the board):'
@echo 'FEATURES_PROVIDED (by the board or USEMODULE'"'"'d drivers):'
@echo ' $(or $(sort $(FEATURES_PROVIDED)), -none-)'
@echo 'FEATURES_MISSING (incl. optional features):'
@echo ' $(or $(sort $(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))), -none-)'
@ -229,7 +229,7 @@ ifneq (, $(filter info-boards-supported info-boards-features-missing info-build,
FEATURES_PROVIDED_BAK := $(FEATURES_PROVIDED)
define board_missing_features
FEATURES_PROVIDED :=
FEATURES_PROVIDED := $(FEATURES_PROVIDED_BAK)
-include $${RIOTBOARD}/${1}/Makefile.features
FEATURES_MISSING := $$(filter-out $$(FEATURES_PROVIDED), $$(FEATURES_REQUIRED))

View File

@ -77,9 +77,6 @@ ifeq ($(strip $(MCU)),)
MCU = $(CPU)
endif
# import list of provided features
-include $(RIOTBOARD)/$(BOARD)/Makefile.features
# if you want to publish the board into the sources as an uppercase #define
BOARDDEF := $(shell echo $(BOARD) | tr 'a-z' 'A-Z' | tr '-' '_')
CPUDEF := $(shell echo $(CPU) | tr 'a-z' 'A-Z' | tr '-' '_')
@ -205,10 +202,15 @@ objdump:
# Extra make goals for testing and comparing changes.
include $(RIOTBASE)/Makefile.buildtests
# import list of provided features
-include $(RIOTBOARD)/$(BOARD)/Makefile.features
# Export variables used throughout the whole make system:
include $(RIOTBASE)/Makefile.vars
# Warn if the selected board and drivers don't provide all needed featues:
ifneq (, $(filter all, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
EXPECT_ERRORS :=
# Test if there where dependencies against a module in DISABLE_MODULE.

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_spi periph_random
FEATURES_PROVIDED += periph_gpio periph_spi periph_random

View File

@ -1 +1 @@
FEATURES_PROVIDED =
FEATURES_PROVIDED +=

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_cpuid

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver periph_gpio periph_uart periph_spi periph_i2c periph_rtt
FEATURES_PROVIDED += transceiver periph_gpio periph_uart periph_spi periph_i2c periph_rtt

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver periph_pwm
FEATURES_PROVIDED += transceiver periph_pwm

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver periph_cpuid
FEATURES_PROVIDED += transceiver periph_cpuid

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_cpuid

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid

View File

@ -1,2 +1,2 @@
# Enable this after fixing https://github.com/RIOT-OS/RIOT/issues/659
#FEATURES_PROVIDED = transceiver
#FEATURES_PROVIDED += transceiver

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_spi
FEATURES_PROVIDED += periph_gpio periph_spi

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_spi periph_pwm periph_random
FEATURES_PROVIDED += periph_gpio periph_spi periph_pwm periph_random

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver

View File

@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid

View File

@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver