makefiles/kconfig.mk: include KCONFIG_OUT_CONFIG always

This allows to include KCONFIG_OUT_CONFIG file in Makefile
unconditionally, which means that `make clean all` is allowed when using
Kconfig.

For this, the recipe for `clean` is guarded with `MAKE_RESTARTS` so
the BINDIR folder is not removed once Make restarts scanning the files.
This commit is contained in:
Leandro Lanzieri 2020-07-30 14:46:01 +02:00
parent 7e4b3d0f40
commit 6a5c7744cb
No known key found for this signature in database
GPG Key ID: 13559905E2EBEAA5
2 changed files with 11 additions and 11 deletions

View File

@ -678,9 +678,11 @@ pkg-build-%: $(BUILDDEPS)
$(QQ)"$(MAKE)" -C $(RIOTPKG)/$*
clean:
ifndef MAKE_RESTARTS
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i clean ; done
-@rm -rf $(BINDIR)
-@rm -rf $(SCANBUILD_OUTPUTDIR)
endif
# Remove intermediates, but keep the .elf, .hex and .map etc.
clean-intermediates:

View File

@ -38,17 +38,10 @@ KCONFIG_MERGED_CONFIG = $(GENERATED_DIR)/merged.config
# configuration symbols to the build system.
KCONFIG_OUT_CONFIG = $(GENERATED_DIR)/out.config
# Include configuration symbols if available, only when not cleaning. This
# allows to check for Kconfig symbols in makefiles.
# Make tries to 'remake' all included files
# (see https://www.gnu.org/software/make/manual/html_node/Remaking-Makefiles.html).
# So if this file was included even when 'clean' is called, make would enter a
# loop, as it always is out-of-date.
# This has the side effect of requiring a Kconfig user to run 'clean' on a
# separate call (e.g. 'make clean && make all'), to get the symbols correctly.
ifneq ($(CLEAN),clean)
-include $(KCONFIG_OUT_CONFIG)
endif
# Include configuration symbols if available. This allows to check for Kconfig
# symbols in makefiles. Make tries to 'remake' all included files (see
# https://www.gnu.org/software/make/manual/html_node/Remaking-Makefiles.html).
-include $(KCONFIG_OUT_CONFIG)
# Flag that indicates that the configuration has been edited
KCONFIG_EDITED_CONFIG = $(GENERATED_DIR)/.editedconfig
@ -128,6 +121,9 @@ $(KCONFIG_MERGED_CONFIG): $(MERGECONFIG) $(KCONFIG_GENERATED_DEPENDENCIES) FORCE
# Build a header file with all the Kconfig configurations. genconfig will avoid
# any unnecessary rewrites of the header file if no configurations changed.
# The rule is not included when only `make clean` is called in order to keep the
# $(BINDIR) folder clean
ifneq (clean,$(MAKECMDGOALS))
$(KCONFIG_OUT_CONFIG) $(KCONFIG_GENERATED_AUTOCONF_HEADER_C) &: $(KCONFIG_GENERATED_DEPENDENCIES) $(GENCONFIG) $(KCONFIG_MERGED_CONFIG) FORCE
$(Q) \
KCONFIG_CONFIG=$(KCONFIG_MERGED_CONFIG) $(GENCONFIG) \
@ -136,3 +132,5 @@ $(KCONFIG_OUT_CONFIG) $(KCONFIG_GENERATED_AUTOCONF_HEADER_C) &: $(KCONFIG_GENERA
$(if $(KCONFIG_SYNC_DEPS),--sync-deps $(KCONFIG_SYNC_DIR)) \
$(KCONFIG)
endif
endif