Skip to content
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

make: fix FEATURES_REQUIRED and FEATURES_PROVIDED a bit #1879

Merged
merged 3 commits into from
Oct 28, 2014
Merged
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
21 changes: 17 additions & 4 deletions Makefile.buildtests
Original file line number Diff line number Diff line change
Expand Up @@ -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))'
Expand Down Expand Up @@ -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

Expand Down
12 changes: 7 additions & 5 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -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 '-' '_')
Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions Makefile.modules
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion boards/arduino-due/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_spi periph_random
FEATURES_PROVIDED += periph_gpio periph_spi periph_random
2 changes: 1 addition & 1 deletion boards/arduino-mega2560/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED =
FEATURES_PROVIDED +=
2 changes: 1 addition & 1 deletion boards/avsextrem/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver
2 changes: 1 addition & 1 deletion boards/cc2538dk/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_cpuid
2 changes: 1 addition & 1 deletion boards/iot-lab_M3/Makefile.features
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion boards/msb-430h/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver
2 changes: 1 addition & 1 deletion boards/msba2/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver periph_pwm
FEATURES_PROVIDED += transceiver periph_pwm
2 changes: 1 addition & 1 deletion boards/msbiot/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio
2 changes: 1 addition & 1 deletion boards/native/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver periph_cpuid
FEATURES_PROVIDED += transceiver periph_cpuid
2 changes: 1 addition & 1 deletion boards/openmote/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_cpuid
2 changes: 1 addition & 1 deletion boards/pca10000/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid
2 changes: 1 addition & 1 deletion boards/pca10005/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid
2 changes: 1 addition & 1 deletion boards/pttu/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Enable this after fixing https:/RIOT-OS/RIOT/issues/659
#FEATURES_PROVIDED = transceiver
#FEATURES_PROVIDED += transceiver
2 changes: 1 addition & 1 deletion boards/redbee-econotag/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver
2 changes: 1 addition & 1 deletion boards/samr21-xpro/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio
2 changes: 1 addition & 1 deletion boards/stm32f0discovery/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_spi
FEATURES_PROVIDED += periph_gpio periph_spi
2 changes: 1 addition & 1 deletion boards/stm32f3discovery/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio
2 changes: 1 addition & 1 deletion boards/stm32f4discovery/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_spi periph_pwm periph_random
FEATURES_PROVIDED += periph_gpio periph_spi periph_pwm periph_random
2 changes: 1 addition & 1 deletion boards/telosb/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver
2 changes: 1 addition & 1 deletion boards/udoo/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio
FEATURES_PROVIDED += periph_gpio
2 changes: 1 addition & 1 deletion boards/wsn430-v1_3b/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver
2 changes: 1 addition & 1 deletion boards/wsn430-v1_4/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver
2 changes: 1 addition & 1 deletion boards/yunjia-nrf51822/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = periph_gpio periph_random periph_rtt periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_random periph_rtt periph_cpuid
2 changes: 1 addition & 1 deletion boards/z1/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FEATURES_PROVIDED = transceiver
FEATURES_PROVIDED += transceiver
2 changes: 2 additions & 0 deletions examples/default/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ USEMODULE += ps
USEMODULE += vtimer
USEMODULE += defaulttransceiver

FEATURES_OPTIONAL += transceiver

ifneq (,$(filter msb-430,$(BOARD)))
USEMODULE += sht11
endif
Expand Down