diff --git a/Makefile.buildtests b/Makefile.buildtests index 1c161ef8ef..7037278fe6 100644 --- a/Makefile.buildtests +++ b/Makefile.buildtests @@ -169,8 +169,16 @@ info-build: @echo 'ELFFILE: $(ELFFILE)' @echo 'HEXFILE: $(HEXFILE)' @echo '' - @echo 'FEATURES_REQUIRED: $(sort $(FEATURES_REQUIRED))' - @echo 'FEATURES_PROVIDED: $(sort $(FEATURES_PROVIDED))' + @echo 'FEATURES_REQUIRED (excl. optional features):' + @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 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-)' + @echo 'FEATURES_MISSING (only non-optional features):' + @echo ' $(or $(sort $(filter-out $(FEATURES_OPTIONAL) $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))), -none-)' @echo '' @echo 'CC: $(CC)' @echo -e 'CFLAGS:$(patsubst %, \n\t%, $(CFLAGS))' @@ -215,17 +223,22 @@ info-features-missing: info-boards-features-missing: @for f in $(BOARDS_FEATURES_MISSING); do echo $${f}; done | column -t +FEATURES_REQUIRED += $(FEATURES_OPTIONAL) + ifneq (, $(filter info-boards-supported info-boards-features-missing info-build, $(MAKECMDGOALS))) 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)) ifneq (, $${FEATURES_MISSING}) - BOARDS_WITH_MISSING_FEATURES += ${1} BOARDS_FEATURES_MISSING += "${1} $${FEATURES_MISSING}" + + ifneq (, $$(filter-out $$(FEATURES_OPTIONAL), $$(FEATURES_MISSING))) + BOARDS_WITH_MISSING_FEATURES += ${1} + endif endif endef diff --git a/Makefile.include b/Makefile.include index 5daf23058c..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. @@ -219,9 +221,9 @@ ifneq (, $(filter all, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all))) endif # Test if all feature requirements were met by the selected board. - ifneq (, $(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))) + ifneq (, $(filter-out $(FEATURES_PROVIDED) $(FEATURES_OPTIONAL), $(FEATURES_REQUIRED))) $(shell $(COLOR_ECHO) "$(COLOR_RED)There are unsatisfied feature requirements:$(COLOR_RESET)"\ - "$(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))" 1>&2) + "$(sort $(filter-out $(FEATURES_PROVIDED) $(FEATURES_OPTIONAL), $(FEATURES_REQUIRED)))" 1>&2) EXPECT_ERRORS := 1 endif diff --git a/Makefile.modules b/Makefile.modules index 3728ae6a1d..9411480d58 100644 --- a/Makefile.modules +++ b/Makefile.modules @@ -5,6 +5,7 @@ USEMODULE += $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)) INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/sys/include ED = $(patsubst %,-DMODULE_%,$(subst -,_,$(USEMODULE) $(USEPKG))) +ED += $(patsubst %,-DFEATURE_%,$(subst -,_,$(filter $(FEATURES_PROVIDED), $(FEATURES_REQUIRED)))) EXTDEFINES = $(shell echo $(sort $(ED))|tr 'a-z' 'A-Z') REALMODULES = $(filter-out $(PSEUDOMODULES), $(sort $(USEMODULE))) export BASELIBS += $(REALMODULES:%=$(BINDIR)%.a) 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 diff --git a/examples/default/Makefile b/examples/default/Makefile index 33746afc9c..fa481bfd49 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -36,6 +36,8 @@ USEMODULE += ps USEMODULE += vtimer USEMODULE += defaulttransceiver +FEATURES_OPTIONAL += transceiver + ifneq (,$(filter msb-430,$(BOARD))) USEMODULE += sht11 endif