From 765c88d08abe71259f3810356d01c96597a3b657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Sun, 26 Oct 2014 23:36:05 +0100 Subject: [PATCH] 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`. --- Makefile.buildtests | 4 ++-- Makefile.include | 8 +++++--- boards/arduino-due/Makefile.features | 2 +- boards/arduino-mega2560/Makefile.features | 2 +- boards/avsextrem/Makefile.features | 2 +- boards/cc2538dk/Makefile.features | 2 +- boards/iot-lab_M3/Makefile.features | 2 +- boards/msb-430h/Makefile.features | 2 +- boards/msba2/Makefile.features | 2 +- boards/msbiot/Makefile.features | 2 +- boards/native/Makefile.features | 2 +- boards/openmote/Makefile.features | 2 +- boards/pca10000/Makefile.features | 2 +- boards/pca10005/Makefile.features | 2 +- boards/pttu/Makefile.features | 2 +- boards/redbee-econotag/Makefile.features | 2 +- boards/samr21-xpro/Makefile.features | 2 +- boards/stm32f0discovery/Makefile.features | 2 +- boards/stm32f3discovery/Makefile.features | 2 +- boards/stm32f4discovery/Makefile.features | 2 +- boards/telosb/Makefile.features | 2 +- boards/udoo/Makefile.features | 2 +- boards/wsn430-v1_3b/Makefile.features | 2 +- boards/wsn430-v1_4/Makefile.features | 2 +- boards/yunjia-nrf51822/Makefile.features | 2 +- boards/z1/Makefile.features | 2 +- 26 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Makefile.buildtests b/Makefile.buildtests index fde12f6974..7037278fe6 100644 --- a/Makefile.buildtests +++ b/Makefile.buildtests @@ -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)) diff --git a/Makefile.include b/Makefile.include index 16a34ee622..1144efbd5a 100644 --- a/Makefile.include +++ b/Makefile.include @@ -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. diff --git a/boards/arduino-due/Makefile.features b/boards/arduino-due/Makefile.features index 9b7846ee4a..9be17cbb4b 100644 --- a/boards/arduino-due/Makefile.features +++ b/boards/arduino-due/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_spi periph_random +FEATURES_PROVIDED += periph_gpio periph_spi periph_random diff --git a/boards/arduino-mega2560/Makefile.features b/boards/arduino-mega2560/Makefile.features index 177003f9fc..a1c6779345 100644 --- a/boards/arduino-mega2560/Makefile.features +++ b/boards/arduino-mega2560/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = +FEATURES_PROVIDED += diff --git a/boards/avsextrem/Makefile.features b/boards/avsextrem/Makefile.features index 762734b956..af23a974c8 100644 --- a/boards/avsextrem/Makefile.features +++ b/boards/avsextrem/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver +FEATURES_PROVIDED += transceiver diff --git a/boards/cc2538dk/Makefile.features b/boards/cc2538dk/Makefile.features index 42f40abd5f..68545ecde2 100644 --- a/boards/cc2538dk/Makefile.features +++ b/boards/cc2538dk/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_random periph_cpuid +FEATURES_PROVIDED += periph_gpio periph_random periph_cpuid diff --git a/boards/iot-lab_M3/Makefile.features b/boards/iot-lab_M3/Makefile.features index 0c2220101c..dc1292029c 100644 --- a/boards/iot-lab_M3/Makefile.features +++ b/boards/iot-lab_M3/Makefile.features @@ -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 diff --git a/boards/msb-430h/Makefile.features b/boards/msb-430h/Makefile.features index 762734b956..af23a974c8 100644 --- a/boards/msb-430h/Makefile.features +++ b/boards/msb-430h/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver +FEATURES_PROVIDED += transceiver diff --git a/boards/msba2/Makefile.features b/boards/msba2/Makefile.features index 75b005a0cb..8876943e34 100644 --- a/boards/msba2/Makefile.features +++ b/boards/msba2/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver periph_pwm +FEATURES_PROVIDED += transceiver periph_pwm diff --git a/boards/msbiot/Makefile.features b/boards/msbiot/Makefile.features index 0f33fa5629..12b64e8090 100644 --- a/boards/msbiot/Makefile.features +++ b/boards/msbiot/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio +FEATURES_PROVIDED += periph_gpio diff --git a/boards/native/Makefile.features b/boards/native/Makefile.features index 91747cc078..7cd83d3843 100644 --- a/boards/native/Makefile.features +++ b/boards/native/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver periph_cpuid +FEATURES_PROVIDED += transceiver periph_cpuid diff --git a/boards/openmote/Makefile.features b/boards/openmote/Makefile.features index 42f40abd5f..68545ecde2 100644 --- a/boards/openmote/Makefile.features +++ b/boards/openmote/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_random periph_cpuid +FEATURES_PROVIDED += periph_gpio periph_random periph_cpuid diff --git a/boards/pca10000/Makefile.features b/boards/pca10000/Makefile.features index c21f92a56a..ec97f16d19 100644 --- a/boards/pca10000/Makefile.features +++ b/boards/pca10000/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid +FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid diff --git a/boards/pca10005/Makefile.features b/boards/pca10005/Makefile.features index c21f92a56a..ec97f16d19 100644 --- a/boards/pca10005/Makefile.features +++ b/boards/pca10005/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid +FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid diff --git a/boards/pttu/Makefile.features b/boards/pttu/Makefile.features index bb7f2c751d..9efa2cc57f 100644 --- a/boards/pttu/Makefile.features +++ b/boards/pttu/Makefile.features @@ -1,2 +1,2 @@ # Enable this after fixing https://github.com/RIOT-OS/RIOT/issues/659 -#FEATURES_PROVIDED = transceiver +#FEATURES_PROVIDED += transceiver diff --git a/boards/redbee-econotag/Makefile.features b/boards/redbee-econotag/Makefile.features index 762734b956..af23a974c8 100644 --- a/boards/redbee-econotag/Makefile.features +++ b/boards/redbee-econotag/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver +FEATURES_PROVIDED += transceiver diff --git a/boards/samr21-xpro/Makefile.features b/boards/samr21-xpro/Makefile.features index 0f33fa5629..12b64e8090 100644 --- a/boards/samr21-xpro/Makefile.features +++ b/boards/samr21-xpro/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio +FEATURES_PROVIDED += periph_gpio diff --git a/boards/stm32f0discovery/Makefile.features b/boards/stm32f0discovery/Makefile.features index 9ac4a53d6b..026c14e2be 100644 --- a/boards/stm32f0discovery/Makefile.features +++ b/boards/stm32f0discovery/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_spi +FEATURES_PROVIDED += periph_gpio periph_spi diff --git a/boards/stm32f3discovery/Makefile.features b/boards/stm32f3discovery/Makefile.features index 0f33fa5629..12b64e8090 100644 --- a/boards/stm32f3discovery/Makefile.features +++ b/boards/stm32f3discovery/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio +FEATURES_PROVIDED += periph_gpio diff --git a/boards/stm32f4discovery/Makefile.features b/boards/stm32f4discovery/Makefile.features index 548a0f3f4c..a7ee3b28fe 100644 --- a/boards/stm32f4discovery/Makefile.features +++ b/boards/stm32f4discovery/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_spi periph_pwm periph_random +FEATURES_PROVIDED += periph_gpio periph_spi periph_pwm periph_random diff --git a/boards/telosb/Makefile.features b/boards/telosb/Makefile.features index 762734b956..af23a974c8 100644 --- a/boards/telosb/Makefile.features +++ b/boards/telosb/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver +FEATURES_PROVIDED += transceiver diff --git a/boards/udoo/Makefile.features b/boards/udoo/Makefile.features index 0f33fa5629..12b64e8090 100644 --- a/boards/udoo/Makefile.features +++ b/boards/udoo/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio +FEATURES_PROVIDED += periph_gpio diff --git a/boards/wsn430-v1_3b/Makefile.features b/boards/wsn430-v1_3b/Makefile.features index 762734b956..af23a974c8 100644 --- a/boards/wsn430-v1_3b/Makefile.features +++ b/boards/wsn430-v1_3b/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver +FEATURES_PROVIDED += transceiver diff --git a/boards/wsn430-v1_4/Makefile.features b/boards/wsn430-v1_4/Makefile.features index 762734b956..af23a974c8 100644 --- a/boards/wsn430-v1_4/Makefile.features +++ b/boards/wsn430-v1_4/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver +FEATURES_PROVIDED += transceiver diff --git a/boards/yunjia-nrf51822/Makefile.features b/boards/yunjia-nrf51822/Makefile.features index c21f92a56a..ec97f16d19 100644 --- a/boards/yunjia-nrf51822/Makefile.features +++ b/boards/yunjia-nrf51822/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid +FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid diff --git a/boards/z1/Makefile.features b/boards/z1/Makefile.features index 762734b956..af23a974c8 100644 --- a/boards/z1/Makefile.features +++ b/boards/z1/Makefile.features @@ -1 +1 @@ -FEATURES_PROVIDED = transceiver +FEATURES_PROVIDED += transceiver