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

makefiles/dependency_resolution: add outer loop for DEFAULT_MODULE deps #17632

Merged
merged 3 commits into from
Feb 14, 2022
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
11 changes: 11 additions & 0 deletions makefiles/default_modules.deps.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This files contains dependencies for default modules. They are parsed at the
# end of the dependency loop. They MAY inlcude new modules, but this modules
# MUST NOT have dependencies themselfs.

ifneq (,$(filter auto_init_ztimer,$(USEMODULE)))
USEMODULE += ztimer_init
endif

ifneq (,$(filter auto_init_saul,$(USEMODULE)))
USEMODULE += saul_init_devs
endif
5 changes: 0 additions & 5 deletions makefiles/defaultmodules.inc.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
DEFAULT_MODULE += board cpu core core_init core_msg core_panic sys

DEFAULT_MODULE += auto_init

# Initialize all used peripherals by default
DEFAULT_MODULE += periph_init

# Include potentially added default modules by the board
-include $(BOARDDIR)/Makefile.default

Expand Down
16 changes: 14 additions & 2 deletions makefiles/dependency_resolution.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,27 @@ NEW_STATE := $(USEMODULE) $(USEPKG) $(FEATURES_USED)
ifneq ($(OLD_STATE),$(NEW_STATE))
include $(RIOTMAKE)/dependency_resolution.inc.mk
else
# Include late allowing them to have been disabled during dependency resolution
DEFAULT_MODULE += auto_init periph_init
USEMODULE += $(filter-out $(DISABLE_MODULE),auto_init periph_init)

# If module auto_init is not used, silently disable all of its submodules
ifeq (,$(filter auto_init,$(USEMODULE)))
DISABLE_MODULE += auto_init_%
endif

# add default modules again, as $(DEFAULT_MODULE) might have been extended
# during dependency processing
# If module periph_init is not used, silently disable all of its submodules
ifeq (,$(filter periph_init,$(USEMODULE)))
DISABLE_MODULE += periph_init_%
endif

# Add default modules again, as $(DEFAULT_MODULE) might have been extended
# during dependency resolution
USEMODULE += $(filter-out $(DISABLE_MODULE),$(DEFAULT_MODULE))

# Include eventual dependencies for default modules
include $(RIOTMAKE)/default_modules.deps.mk

# Sort and de-duplicate used modules and default modules for readability
USEMODULE := $(sort $(USEMODULE))
DEFAULT_MODULE := $(sort $(DEFAULT_MODULE))
Expand Down
50 changes: 24 additions & 26 deletions makefiles/features_modules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,30 @@ PERIPH_FEATURES := $(filter periph_%,$(FEATURES_USED))
USEMODULE += $(PERIPH_FEATURES)

# Add all USED periph_% init modules unless they are blacklisted
ifneq (,$(filter periph_init, $(USEMODULE)))
PERIPH_IGNORE_MODULES := \
periph_init% \
periph_common \
periph_flexcomm \
periph_gpio_mux \
periph_i2c_hw \
periph_i2c_sw \
periph_rtc_ms \
periph_mcg \
periph_wdog \
periph_flash \
periph_rtc_rtt \
periph_rtt_hw_rtc \
periph_rtt_hw_sys \
periph_clic \
periph_coretimer \
periph_plic \
periph_spi_on_qspi
#
PERIPH_MODULES := $(filter-out $(PERIPH_IGNORE_MODULES),\
$(filter periph_%,$(USEMODULE)))
# Use simple expansion to avoid USEMODULE referencing itself
PERIPH_INIT_MODULES := $(subst periph_,periph_init_,$(PERIPH_MODULES))
DEFAULT_MODULE += $(PERIPH_INIT_MODULES)
endif
PERIPH_IGNORE_MODULES := \
periph_init% \
periph_common \
periph_flexcomm \
periph_gpio_mux \
periph_i2c_hw \
periph_i2c_sw \
periph_rtc_ms \
periph_mcg \
periph_wdog \
periph_flash \
periph_rtc_rtt \
periph_rtt_hw_rtc \
periph_rtt_hw_sys \
periph_clic \
periph_coretimer \
periph_plic \
periph_spi_on_qspi
#
PERIPH_MODULES := $(filter-out $(PERIPH_IGNORE_MODULES),\
$(filter periph_%,$(USEMODULE)))
# Use simple expansion to avoid USEMODULE referencing itself
PERIPH_INIT_MODULES := $(subst periph_,periph_init_,$(PERIPH_MODULES))
DEFAULT_MODULE += $(PERIPH_INIT_MODULES)

# select cpu_check_address pseudomodule if the corresponding feature is used
USEMODULE += $(filter cpu_check_address, $(FEATURES_USED))
Expand Down
9 changes: 1 addition & 8 deletions sys/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ ifneq (,$(filter base64url,$(USEMODULE)))
USEMODULE += base64
endif

ifneq (,$(filter auto_init_saul,$(USEMODULE)))
USEMODULE += saul_init_devs
endif

ifneq (,$(filter csma_sender,$(USEMODULE)))
USEMODULE += random
USEMODULE += xtimer
Expand All @@ -115,15 +111,12 @@ ifneq (,$(filter dhcpv6_client,$(USEMODULE)))
endif

ifneq (,$(filter dhcpv6_relay,$(USEMODULE)))
DEFAULT_MODULE += auto_init_dhcpv6_relay
USEMODULE += event
USEMODULE += sock_async_event
USEMODULE += sock_udp
endif

ifneq (,$(filter auto_init_dhcpv6_relay,$(USEMODULE)))
USEMODULE += dhcpv6_relay
endif

ifneq (,$(filter dns_%,$(USEMODULE)))
USEMODULE += dns
endif
Expand Down
3 changes: 0 additions & 3 deletions sys/ztimer/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ ifneq (,$(filter ztimer,$(USEMODULE)))
USEMODULE += ztimer_core
USEMODULE += ztimer_convert_frac
USEMODULE += ztimer_convert_shift
ifneq (,$(filter auto_init_ztimer,$(USEMODULE)))
USEMODULE += ztimer_init
endif
DEFAULT_MODULE += auto_init_ztimer
DEFAULT_MODULE += ztimer_init
endif
Expand Down
2 changes: 1 addition & 1 deletion tests/gnrc_dhcpv6_relay/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RIOTBASE ?= $(CURDIR)/../..

export TAP ?= tap0

USEMODULE += auto_init_dhcpv6_relay
USEMODULE += dhcpv6_relay
USEMODULE += event_thread
USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_netif_single # Only one interface used and it makes
Expand Down