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

makefiles/kconfig: fix dependencies for out.config target

Kconfig.dep depends on FORCE, so it is always generated when compiling
with Kconfig under normal conditions. Whan TEST_KCONFIG=1 is set, this
file is no longer a dependency for out.config. So when cleaning the
'bin' directory, out.config has no direct dependencies that force its
rebuilding (the generated directory is order only). This causes the file
not to be produced when calling `TEST_KCONFIG=1 make clean all`.

This PR changes the dependency on the 'generated' directory to a direct
dependency when `CLEAN` is set and leaves it as order-only when not.
This allows to generate out.config only when needed by not depending on
FORCE.
This commit is contained in:
Leandro Lanzieri 2020-09-23 09:37:10 +02:00
parent dc5631e8e3
commit 4fbbb94bff
No known key found for this signature in database
GPG Key ID: 13559905E2EBEAA5

View File

@ -126,10 +126,23 @@ $(KCONFIG_GENERATED_DEPENDENCIES): FORCE | $(GENERATED_DIR)
printf "config %s\n\tbool\n\tdefault y\n", toupper($$0)}' \
| $(LAZYSPONGE) $(LAZYSPONGE_FLAGS) $@
# When the 'clean' target is called, the files inside GENERATED_DIR should be
# regenerated. For that, we conditionally change GENERATED_DIR from an 'order
# only' requisite to a normal one.
#
# - When clean is called, Make will look at the modification time of the folder
# and will regenerate the files accordingly.
# - When clean is not called Make will ensure that the folder exists, without
# paying attention to the modification date.
#
# This allows use to generate the files only when needed, instead of using
# FORCE.
GENERATED_DIR_DEP := $(if $(CLEAN),,|) $(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): $(GENERATED_DEPENDENCIES_DEP) $(GENCONFIG) $(MERGE_SOURCES) | $(GENERATED_DIR)
$(KCONFIG_OUT_CONFIG): $(GENERATED_DEPENDENCIES_DEP) $(GENCONFIG) $(MERGE_SOURCES) $(GENERATED_DIR_DEP)
$(Q) $(GENCONFIG) \
--config-out=$(KCONFIG_OUT_CONFIG) \
--file-list $(KCONFIG_OUT_DEP) \
@ -144,7 +157,7 @@ endif # eq (clean, $(MAKECMDGOALS))
# compilation.
#
# This will generate the 'dummy' header files needed for incremental builds.
$(KCONFIG_GENERATED_AUTOCONF_HEADER_C): $(KCONFIG_OUT_CONFIG)
$(KCONFIG_GENERATED_AUTOCONF_HEADER_C): $(KCONFIG_OUT_CONFIG) $(GENERATED_DIR_DEP)
$(Q) $(GENCONFIG) \
--header-path $(KCONFIG_GENERATED_AUTOCONF_HEADER_C) \
--sync-deps $(KCONFIG_SYNC_DIR) \