1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Makefile.include: introduce TEST_KCONFIG switch

This switch allows to test the module dependency modelling during the
Kconfig migration. When set, it will use the symbols prefixed with
CONFIG_MOD_ defined by Kconfig as the list of modules to compile.
This commit is contained in:
Leandro Lanzieri 2020-07-27 17:52:48 +02:00
parent e76387911c
commit 01454188e8
No known key found for this signature in database
GPG Key ID: 13559905E2EBEAA5
2 changed files with 24 additions and 5 deletions

View File

@ -212,6 +212,11 @@ include $(RIOTMAKE)/scan-build.inc.mk
export RIOTBUILD_CONFIG_HEADER_C = $(BINDIR)/riotbuild/riotbuild.h
# When testing Kconfig's module modelling we need to run Kconfig
ifeq (1,$(TEST_KCONFIG))
SHOULD_RUN_KCONFIG = 1
endif
# Include Kconfig functionalities
include $(RIOTMAKE)/kconfig.mk
@ -361,11 +366,18 @@ include $(RIOTBASE)/Makefile.features
include $(RIOTMAKE)/pseudomodules.inc.mk
include $(RIOTMAKE)/defaultmodules.inc.mk
# handle removal of default modules
USEMODULE += $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE))
# For testing, use TEST_KCONFIG as a switch between Makefile.dep and Kconfig
ifeq (1,$(TEST_KCONFIG))
$(info === [ATTENTION] Testing Kconfig dependency modelling ===)
KCONFIG_MODULES := $(call lowercase,$(patsubst CONFIG_MOD_%,%,$(filter CONFIG_MOD_%,$(.VARIABLES))))
USEMODULE := $(KCONFIG_MODULES)
else
# handle removal of default modules
USEMODULE += $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE))
# process dependencies
include $(RIOTMAKE)/dependency_resolution.inc.mk
# process dependencies
include $(RIOTMAKE)/dependency_resolution.inc.mk
endif
# Include Board and CPU configuration
INCLUDES += $(addprefix -I,$(wildcard $(BOARDDIR)/include))

View File

@ -98,6 +98,12 @@ menuconfig: $(MENUCONFIG) $(KCONFIG_OUT_CONFIG)
$(Q)KCONFIG_CONFIG=$(KCONFIG_OUT_CONFIG) $(MENUCONFIG) $(KCONFIG)
$(MAKE) $(KCONFIG_GENERATED_AUTOCONF_HEADER_C)
# Variable used to conditionally depend on KCONFIG_GENERATED_DEPDENDENCIES
# When testing Kconfig module modelling this file is not needed
ifneq (1, $(TEST_KCONFIG))
GENERATED_DEPENDENCIES_DEP = $(KCONFIG_GENERATED_DEPENDENCIES)
endif
# These rules are not included when only calling `make clean` in
# order to keep the $(BINDIR) directory clean.
ifneq (clean, $(MAKECMDGOALS))
@ -106,6 +112,7 @@ ifneq (clean, $(MAKECMDGOALS))
# defining symbols like 'MODULE_<MODULE_NAME>' or PKG_<PACKAGE_NAME> which
# default to 'y'. Then, every module and package Kconfig menu will depend on
# that symbol being set to show its options.
# Do nothing when testing Kconfig module dependency modelling.
$(KCONFIG_GENERATED_DEPENDENCIES): FORCE | $(GENERATED_DIR)
$(Q)printf "%s " $(USEMODULE_W_PREFIX) $(USEPKG_W_PREFIX) \
| awk 'BEGIN {RS=" "}{ gsub("-", "_", $$0); \
@ -115,7 +122,7 @@ $(KCONFIG_GENERATED_DEPENDENCIES): FORCE | $(GENERATED_DIR)
# Generates a .config file by merging multiple sources specified in
# MERGE_SOURCES. This will also generate KCONFIG_OUT_DEP with the list of used
# Kconfig files.
$(KCONFIG_OUT_CONFIG): $(KCONFIG_GENERATED_DEPENDENCIES) $(GENCONFIG) $(MERGE_SOURCES) | $(GENERATED_DIR)
$(KCONFIG_OUT_CONFIG): $(GENERATED_DEPENDENCIES_DEP) $(GENCONFIG) $(MERGE_SOURCES) | $(GENERATED_DIR)
$(Q) $(GENCONFIG) \
--config-out=$(KCONFIG_OUT_CONFIG) \
--file-list $(KCONFIG_OUT_DEP) \