Skip to content

Commit ec873a4

Browse files
committed
kbuild: refactor the check for missing config files
This commit refactors the check for missing configuration files, making it easier to add more files to the list. The format of the error message has been slightly changed, as follows: [Before] ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it. [After] *** *** ERROR: Kernel configuration is invalid. The following files are missing: *** - include/generated/autoconf.h *** - include/config/auto.conf *** Run "make oldconfig && make prepare" on kernel source to fix it. *** Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> Tested-by: Miguel Ojeda <[email protected]>
1 parent 5390d99 commit ec873a4

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Makefile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -781,17 +781,22 @@ $(KCONFIG_CONFIG):
781781
else # !may-sync-config
782782
# External modules and some install targets need include/generated/autoconf.h
783783
# and include/config/auto.conf but do not care if they are up-to-date.
784-
# Use auto.conf to trigger the test
784+
# Use auto.conf to show the error message
785+
786+
checked-configs := include/generated/autoconf.h include/config/auto.conf
787+
missing-configs := $(filter-out $(wildcard $(checked-configs)), $(checked-configs))
788+
789+
ifdef missing-configs
785790
PHONY += include/config/auto.conf
786791

787792
include/config/auto.conf:
788-
@test -e include/generated/autoconf.h -a -e $@ || ( \
789-
echo >&2; \
790-
echo >&2 " ERROR: Kernel configuration is invalid."; \
791-
echo >&2 " include/generated/autoconf.h or $@ are missing.";\
792-
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
793-
echo >&2 ; \
794-
/bin/false)
793+
@echo >&2 '***'
794+
@echo >&2 '*** ERROR: Kernel configuration is invalid. The following files are missing:'
795+
@printf >&2 '*** - %s\n' $(missing-configs)
796+
@echo >&2 '*** Run "make oldconfig && make prepare" on kernel source to fix it.'
797+
@echo >&2 '***'
798+
@/bin/false
799+
endif
795800

796801
endif # may-sync-config
797802
endif # need-config

0 commit comments

Comments
 (0)