[PATCH] kbuild: turn auto.conf.cmd into a mandatory include file
From: Masahiro Yamada
Date: Sat May 11 2019 - 22:24:08 EST
syncconfig is responsible for keeping auto.conf up-to-date, so if it
fails for any reason, the build must be terminated immediately.
However, since commit 9390dff66a52 ("kbuild: invoke syncconfig if
include/config/auto.conf.cmd is missing"), Kbuild continues running
even after syncconfig fails.
You can confirm this by intentionally making syncconfig error out:
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 08ba146..307b9de 100644
@@ -1023,6 +1023,9 @@ int conf_write_autoconf(int overwrite)
FILE *out, *tristate, *out_h;
+ if (overwrite)
+ return 1;
if (!overwrite && is_present(autoconf_name))
Then, syncconfig fails, but Make would not stop:
$ make -s mrproper allyesconfig defconfig
scripts/kconfig/conf --syncconfig Kconfig
*** Error during sync of the configuration.
make: *** [scripts/kconfig/Makefile;69: syncconfig] Error 1
make: *** [Makefile;557: syncconfig] Error 2
make: *** [include/config/auto.conf.cmd] Deleting file 'include/config/tristate.conf'
make: Failed to remake makefile 'include/config/auto.conf'.
[ continue running ... ]
The reason is in the behavior of the pattern rule with multi-targets.
%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
GNU Make knows this rule is responsible for making all the three target
files simultaneously. As far as exampled, the target in question when
this rule is invoked is auto.conf.cmd probably because it is included
(line 654) below the inclusion of auto.conf (line 603).
The inclusion of auto.conf is mandatory, while that of auto.conf.cmd
is optional. GNU Make does not care about the failure during updating
optional include files.
I filed this issue (https://savannah.gnu.org/bugs/?56301) in case this
behavior could be improved somehow. Anyway, it is quite easy to fix
Given that auto.conf is already a mandatory include file, there is no
reason to stick auto.conf.cmd optional. Make it mandatory as well.
Fixes: 9390dff66a52 ("kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing")
Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 3b93010..9542165 100644
@@ -651,7 +651,7 @@ ifeq ($(may-sync-config),1)
# Read in dependencies to all Kconfig* files, make sure to run syncconfig if
# changes are detected. This should be included after arch/$(SRCARCH)/Makefile
# because some architectures define CROSS_COMPILE there.
@echo >&2 '***'