kconfig: fix 'invalid option' for help option
PATCH 1/3 kconfig: fix 'invalid option' for help option
scripts/kconfig/conf supports -? option to show the help message. This is not wired up to Makefile, so nobody would notice this, but it also shows 'invalid option' message.
$ ./scripts/kconfig/conf -?
./scripts/kconfig/conf: invalid option -- '?'
Usage: ./scripts/kconfig/conf [-s] [option] <kconfig-file>
[option] is _one_ of the following:
--listnewconfig List new options
--helpnewconfig List new options and help text
--oldaskconfig Start a new configuration using a line-oriented program
...The reason is the '?' is missing in the short option list passed to getopt_long().
While I fixed this issue, I also changed the option '?' to 'h'. I prefer -h (or --help, if a long option is also desired).
---
scripts/kconfig/conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/conf.c +2 -2
@@ -494,7 +494,7 @@ int main(int ac, char **av) tty_stdio =isatty (0 ) &&isatty (1 ); -while ((opt =getopt_long (ac, av,"s" , long_opts,NULL )) !=-1 ) { +while ((opt =getopt_long (ac, av,"hs" , long_opts,NULL )) !=-1 ) {if (opt =='s' ) {conf_set_message_callback (NULL );continue ;
@@ -550,7 +550,7 @@ int main(int ac, char **av)case yes2modconfig:case mod2yesconfig:break ; -case '?' : +case 'h' :conf_usage (progname);exit (1 );break ;
Signature · 1 line
2.27.0
PATCH 2/3 kconfig: omit --oldaskconfig option for 'make config'
scripts/kconfig/conf.c line 39 defines the default of input_mode as oldaskconfig. Hence, 'make config' works in the same way even without the --oldaskconfig option given. Note this in the help message.
This will be helpful to unify build rules in Makefile in the next commit.
---
scripts/kconfig/Makefile | 2 +- scripts/kconfig/conf.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/Makefile +1 -1
@@ -29,7 +29,7 @@ menuconfig: $(obj)/mconf $(Q)$< $(silent) $(Kconfig) config: $(obj)/conf - $(Q)$< $(silent) --oldaskconfig $(Kconfig) + $(Q)$< $(silent) $(Kconfig) nconfig: $(obj)/nconf $(Q)$< $(silent) $(Kconfig)
scripts/kconfig/conf.c +1 -0
@@ -483,6 +483,7 @@ static void conf_usage(const char *progname)printf (" --randconfig New config with random answer to all options\n" );printf (" --yes2modconfig Change answers from yes to mod if possible\n" );printf (" --mod2yesconfig Change answers from mod to yes if possible\n" ); +printf (" (If none of the above is given, --oldaskconfig is the default)\n" ); }int main (int ac,char **av)
Signature · 1 line
2.27.0
PATCH 3/3 kconfig: unify rule of config, menuconfig, nconfig, gconfig, xconfig
In reply to Masahiro YamadaUnify the similar build rules.
This supports 'make build_config', which builds scripts/kconfig/conf but does not invoke it.
---
scripts/kconfig/Makefile | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-)
scripts/kconfig/Makefile +13 -22
@@ -3,9 +3,6 @@ # Kernel configuration targets # These targets are used from top-level makefile -PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \ - build_menuconfig build_nconfig build_gconfig build_xconfig - ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) else
@@ -19,29 +16,23 @@ endif # We need this, in case the user has it in its environment unexport CONFIG_ -xconfig: $(obj)/qconf - $(Q)$< $(silent) $(Kconfig) - -gconfig: $(obj)/gconf - $(Q)$< $(silent) $(Kconfig) - -menuconfig: $(obj)/mconf - $(Q)$< $(silent) $(Kconfig) - -config: $(obj)/conf - $(Q)$< $(silent) $(Kconfig) - -nconfig: $(obj)/nconf - $(Q)$< $(silent) $(Kconfig) - -build_menuconfig: $(obj)/mconf +config-prog := conf +menuconfig-prog := mconf +nconfig-prog := nconf +gconfig-prog := gconf +xconfig-prog := qconf -build_nconfig: $(obj)/nconf +define config_rule +PHONY += $(1) build_$(1) +$(1): $(obj)/$($(1)-prog) + $(Q)$$< $(silent) $(Kconfig) -build_gconfig: $(obj)/gconf +build_$(1): $(obj)/$($(1)-prog) +endef -build_xconfig: $(obj)/qconf +$(foreach c, config menuconfig nconfig gconfig xconfig, $(eval $(call config_rule,$(c)))) +PHONY += localmodconfig localyesconfig localyesconfig localmodconfig: $(obj)/conf $(Q)$(PERL) $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)if [ -f .config ]; then \
Signature · 1 line
2.27.0