From 9279282acb33a1d81b36b567c7f281c2a44f1f8c Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 17 Mar 2020 09:15:08 +0100 Subject: [PATCH] Makefile.dep: filter periph_int modules Co-authored-by: Marian Buschsieweke --- Makefile.dep | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile.dep b/Makefile.dep index dea76221bc..a7a67f9b22 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -1060,29 +1060,37 @@ USEPKG := $(sort $(USEPKG)) ifneq ($(OLD_USEMODULE) $(OLD_USEPKG),$(USEMODULE) $(USEPKG)) include $(RIOTBASE)/Makefile.dep else + # set all USED periph_% init modules as DEFAULT_MODULE ifneq (,$(filter periph_init, $(USEMODULE))) - DEFAULT_MODULE += $(subst periph_,periph_init_,$(filter periph_%,$(USEMODULE))) + # To enable adding periph_% modules through the environment we cant use + # FEATURES_USED since the MODULE might be added directly as USEMODULE + PERIPH_MODULES_NO_INIT = periph_init% periph_common + PERIPH_MODULES = $(filter periph_%,$(USEMODULE)) + PERIPH_INIT_MODULES = $(subst periph_,periph_init_,\ + $(filter-out $(PERIPH_MODULES_NO_INIT),$(PERIPH_MODULES))) + DEFAULT_MODULE += $(PERIPH_INIT_MODULES) + endif + + # add periph_init_% modules to USEMODULE unless disabled + ifneq (,$(filter periph_init, $(USEMODULE))) + USEMODULE += $(filter $(PERIPH_INIT_MODULES),\ + $(filter-out $(DISABLE_MODULE),$(DEFAULT_MODULE))) endif # Add auto_init_% DEFAULT_MODULES. This is done after the recursive cach since # none of these modules can trigger dependency resolution. - DEFAULT_MODULE := $(sort $(DEFAULT_MODULE)) ifneq (,$(filter auto_init,$(USEMODULE))) USEMODULE += $(filter auto_init_%,$(filter-out $(DISABLE_MODULE),$(DEFAULT_MODULE))) endif - # Add auto_init_periph_% to DEFAULT_MODULES. This is done after the recursive - # cach since none of these modules can trigger dependency resolution. - ifneq (,$(filter periph_init,$(USEMODULE))) - USEMODULE += $(filter periph_init_%,$(filter-out $(DISABLE_MODULE),$(DEFAULT_MODULE))) - endif - # Add test_utils_interactive_sync_shell ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE))) USEMODULE += $(filter test_utils_interactive_sync_%, \ $(filter-out $(DISABLE_MODULE),$(DEFAULT_MODULE))) endif + # Sort and remove duplicates + DEFAULT_MODULE := $(sort $(DEFAULT_MODULE)) USEMODULE := $(sort $(USEMODULE)) endif