* [PATCH 1/2] kconfig: Simplify Makefile
@ 2015-04-08 11:42 Michal Marek
2015-04-08 11:42 ` [PATCH 2/2] kconfig: Do not print status messages in make -s mode Michal Marek
2015-04-09 1:43 ` [PATCH 1/2] kconfig: Simplify Makefile Masahiro Yamada
0 siblings, 2 replies; 7+ messages in thread
From: Michal Marek @ 2015-04-08 11:42 UTC (permalink / raw)
To: linux-kbuild
Use a single rule for targets handled directly by the conf program.
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
scripts/kconfig/Makefile | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index cb2cf54..1f5e453 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -2,7 +2,7 @@
# Kernel configuration targets
# These targets are used from top-level makefile
-PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
+PHONY += xconfig gconfig menuconfig config silentoldconfig update-po-config \
localmodconfig localyesconfig
ifdef KBUILD_KCONFIG
@@ -29,9 +29,6 @@ config: $(obj)/conf
nconfig: $(obj)/nconf
$< $(Kconfig)
-oldconfig: $(obj)/conf
- $< --$@ $(Kconfig)
-
silentoldconfig: $(obj)/conf
$(Q)mkdir -p include/config include/generated
$< --$@ $(Kconfig)
@@ -74,21 +71,20 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
--output $(obj)/linux.pot
$(Q)rm -f $(obj)/config.pot
-PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
+# These targets map 1:1 to the commandline options of 'conf'
+simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
+ alldefconfig randconfig listnewconfig olddefconfig
+PHONY += $(simple-targets)
-allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
+$(simple-targets): $(obj)/conf
$< --$@ $(Kconfig)
-PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig
-
-listnewconfig olddefconfig: $(obj)/conf
- $< --$@ $(Kconfig)
+PHONY += oldnoconfig savedefconfig defconfig
# oldnoconfig is an alias of olddefconfig, because people already are dependent
# on its behavior(sets new symbols to their default value but not 'n') with the
# counter-intuitive name.
-oldnoconfig: $(obj)/conf
- $< --olddefconfig $(Kconfig)
+oldnoconfig: olddefconfig
savedefconfig: $(obj)/conf
$< --$@=defconfig $(Kconfig)
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] kconfig: Do not print status messages in make -s mode
2015-04-08 11:42 [PATCH 1/2] kconfig: Simplify Makefile Michal Marek
@ 2015-04-08 11:42 ` Michal Marek
2015-04-09 12:47 ` Paul Bolle
2015-04-09 1:43 ` [PATCH 1/2] kconfig: Simplify Makefile Masahiro Yamada
1 sibling, 1 reply; 7+ messages in thread
From: Michal Marek @ 2015-04-08 11:42 UTC (permalink / raw)
To: linux-kbuild
Add an -s option to the conf, mconf, qconf and gconf frontends and pass
it when make -s is used. Also, use $(kecho) instead of @echo in the
Makefile.
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
scripts/kconfig/Makefile | 38 +++++++++++++++++++++-----------------
scripts/kconfig/conf.c | 8 ++++++--
scripts/kconfig/gconf.c | 5 ++++-
scripts/kconfig/mconf.c | 29 +++++++++++++++++++----------
scripts/kconfig/qconf.cc | 5 ++++-
5 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 1f5e453..75e3aed 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -11,27 +11,31 @@ else
Kconfig := Kconfig
endif
+ifeq ($(quiet),silent_)
+silent := -s
+endif
+
# We need this, in case the user has it in its environment
unexport CONFIG_
xconfig: $(obj)/qconf
- $< $(Kconfig)
+ $< $(silent) $(Kconfig)
gconfig: $(obj)/gconf
- $< $(Kconfig)
+ $< $(silent) $(Kconfig)
menuconfig: $(obj)/mconf
- $< $(Kconfig)
+ $< $(silent) $(Kconfig)
config: $(obj)/conf
- $< --oldaskconfig $(Kconfig)
+ $< $(silent) --oldaskconfig $(Kconfig)
nconfig: $(obj)/nconf
$< $(Kconfig)
silentoldconfig: $(obj)/conf
$(Q)mkdir -p include/config include/generated
- $< --$@ $(Kconfig)
+ $< $(silent) --$@ $(Kconfig)
localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
$(Q)mkdir -p include/config include/generated
@@ -40,18 +44,18 @@ localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
cmp -s .tmp.config .config || \
(mv -f .config .config.old.1; \
mv -f .tmp.config .config; \
- $(obj)/conf --silentoldconfig $(Kconfig); \
+ $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
mv -f .config.old.1 .config.old) \
else \
mv -f .tmp.config .config; \
- $(obj)/conf --silentoldconfig $(Kconfig); \
+ $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
fi
$(Q)rm -f .tmp.config
# Create new linux.pot file
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
- $(Q)echo " GEN config.pot"
+ $(Q)$(kecho) " GEN config.pot"
$(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \
@@ -62,11 +66,11 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
$(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
$(srctree)/arch/*/um/Kconfig`; \
do \
- echo " GEN $$i"; \
+ $(kecho) " GEN $$i"; \
$(obj)/kxgettext $$i \
>> $(obj)/config.pot; \
done )
- $(Q)echo " GEN linux.pot"
+ $(Q)$(kecho) " GEN linux.pot"
$(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
--output $(obj)/linux.pot
$(Q)rm -f $(obj)/config.pot
@@ -77,7 +81,7 @@ simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
PHONY += $(simple-targets)
$(simple-targets): $(obj)/conf
- $< --$@ $(Kconfig)
+ $< $(silent) --$@ $(Kconfig)
PHONY += oldnoconfig savedefconfig defconfig
@@ -87,18 +91,18 @@ PHONY += oldnoconfig savedefconfig defconfig
oldnoconfig: olddefconfig
savedefconfig: $(obj)/conf
- $< --$@=defconfig $(Kconfig)
+ $< $(silent) --$@=defconfig $(Kconfig)
defconfig: $(obj)/conf
ifeq ($(KBUILD_DEFCONFIG),)
- $< --defconfig $(Kconfig)
+ $< $(silent) --defconfig $(Kconfig)
else
- @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
- $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
+ @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
+ $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
endif
%_defconfig: $(obj)/conf
- $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
+ $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
@@ -215,7 +219,7 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
# QT needs some extra effort...
$(obj)/.tmp_qtcheck:
- @set -e; echo " CHECK qt"; dir=""; pkg=""; \
+ @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \
if ! pkg-config --exists QtCore 2> /dev/null; then \
echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
pkg-config --exists qt 2> /dev/null && pkg=qt; \
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index fef75fc..6c20431 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -471,7 +471,7 @@ static struct option long_opts[] = {
static void conf_usage(const char *progname)
{
- printf("Usage: %s [option] <kconfig-file>\n", progname);
+ printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
printf("[option] is _one_ of the following:\n");
printf(" --listnewconfig List new options\n");
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
@@ -501,7 +501,11 @@ int main(int ac, char **av)
tty_stdio = isatty(0) && isatty(1) && isatty(2);
- while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
+ while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
+ if (opt == 's') {
+ conf_set_message_callback(NULL);
+ continue;
+ }
input_mode = (enum input_mode)opt;
switch (opt) {
case silentoldconfig:
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 344b9e3..26d208b 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -1474,9 +1474,12 @@ int main(int ac, char *av[])
case 'a':
//showAll = 1;
break;
+ case 's':
+ conf_set_message_callback(NULL);
+ break;
case 'h':
case '?':
- printf("%s <config>\n", av[0]);
+ printf("%s [-s] <config>\n", av[0]);
exit(0);
}
name = av[2];
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 4dd3755..01070f0 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -279,6 +279,7 @@ static int child_count;
static int single_menu_mode;
static int show_all_options;
static int save_and_exit;
+static int silent;
static void conf(struct menu *menu, struct menu *active_menu);
static void conf_choice(struct menu *menu);
@@ -777,10 +778,12 @@ static void conf_message_callback(const char *fmt, va_list ap)
char buf[PATH_MAX+1];
vsnprintf(buf, sizeof(buf), fmt, ap);
- if (save_and_exit)
- printf("%s", buf);
- else
+ if (save_and_exit) {
+ if (!silent)
+ printf("%s", buf);
+ } else {
show_textbox(NULL, buf, 6, 60);
+ }
}
static void show_help(struct menu *menu)
@@ -977,16 +980,18 @@ static int handle_exit(void)
}
/* fall through */
case -1:
- printf(_("\n\n"
- "*** End of the configuration.\n"
- "*** Execute 'make' to start the build or try 'make help'."
- "\n\n"));
+ if (!silent)
+ printf(_("\n\n"
+ "*** End of the configuration.\n"
+ "*** Execute 'make' to start the build or try 'make help'."
+ "\n\n"));
res = 0;
break;
default:
- fprintf(stderr, _("\n\n"
- "Your configuration changes were NOT saved."
- "\n\n"));
+ if (!silent)
+ fprintf(stderr, _("\n\n"
+ "Your configuration changes were NOT saved."
+ "\n\n"));
if (res != KEY_ESC)
res = 0;
}
@@ -1010,6 +1015,10 @@ int main(int ac, char **av)
signal(SIGINT, sig_handler);
+ if (ac > 1 && strcmp(av[1], "-s") == 0) {
+ silent = 1;
+ av++;
+ }
conf_parse(av[1]);
conf_read(NULL);
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9d3b04b..c3bb7fe 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1746,7 +1746,7 @@ static const char *progname;
static void usage(void)
{
- printf(_("%s <config>\n"), progname);
+ printf(_("%s [-s] <config>\n"), progname);
exit(0);
}
@@ -1762,6 +1762,9 @@ int main(int ac, char** av)
configApp = new QApplication(ac, av);
if (ac > 1 && av[1][0] == '-') {
switch (av[1][1]) {
+ case 's':
+ conf_set_message_callback(NULL);
+ break;
case 'h':
case '?':
usage();
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] kconfig: Simplify Makefile
2015-04-08 11:42 [PATCH 1/2] kconfig: Simplify Makefile Michal Marek
2015-04-08 11:42 ` [PATCH 2/2] kconfig: Do not print status messages in make -s mode Michal Marek
@ 2015-04-09 1:43 ` Masahiro Yamada
1 sibling, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2015-04-09 1:43 UTC (permalink / raw)
To: Michal Marek; +Cc: Linux Kbuild mailing list
Hi Michal,
2015-04-08 20:42 GMT+09:00 Michal Marek <mmarek@suse.cz>:
> Use a single rule for targets handled directly by the conf program.
>
> Signed-off-by: Michal Marek <mmarek@suse.cz>
Nice cleanup!
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] kconfig: Do not print status messages in make -s mode
2015-04-08 11:42 ` [PATCH 2/2] kconfig: Do not print status messages in make -s mode Michal Marek
@ 2015-04-09 12:47 ` Paul Bolle
2015-04-09 12:58 ` Michal Marek
0 siblings, 1 reply; 7+ messages in thread
From: Paul Bolle @ 2015-04-09 12:47 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild
On Wed, 2015-04-08 at 13:42 +0200, Michal Marek wrote:
> Add an -s option to the conf, mconf, qconf and gconf frontends and pass
> it when make -s is used.
Basically this suppresses everything except warning and errors,
correct?
I don't actually use nconf. Is it already silent?
> Also, use $(kecho) instead of @echo in the
> Makefile.
(I had to look up $(kecho). I found:
###
# Easy method for doing a status message
kecho := :
quiet_kecho := echo
silent_kecho := :
kecho := $($(quiet)kecho)
I'm not fluent in Makefilese. What does it provide beyond @echo?)
> --- a/scripts/kconfig/conf.c
> +++ b/scripts/kconfig/conf.c
> @@ -471,7 +471,7 @@ static struct option long_opts[] = {
> static void conf_usage(const char *progname)
> {
>
> - printf("Usage: %s [option] <kconfig-file>\n", progname);
> + printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
> printf("[option] is _one_ of the following:\n");
> printf(" --listnewconfig List new options\n");
> printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
> @@ -501,7 +501,11 @@ int main(int ac, char **av)
>
> tty_stdio = isatty(0) && isatty(1) && isatty(2);
>
> - while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
> + while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
> + if (opt == 's') {
> + conf_set_message_callback(NULL);
> + continue;
> + }
> input_mode = (enum input_mode)opt;
> switch (opt) {
> case silentoldconfig:
> diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
> index 344b9e3..26d208b 100644
> --- a/scripts/kconfig/gconf.c
> +++ b/scripts/kconfig/gconf.c
> @@ -1474,9 +1474,12 @@ int main(int ac, char *av[])
> case 'a':
> //showAll = 1;
> break;
> + case 's':
> + conf_set_message_callback(NULL);
> + break;
> case 'h':
> case '?':
> - printf("%s <config>\n", av[0]);
> + printf("%s [-s] <config>\n", av[0]);
> exit(0);
> }
> name = av[2];
> diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
> index 4dd3755..01070f0 100644
> --- a/scripts/kconfig/mconf.c
> +++ b/scripts/kconfig/mconf.c
> @@ -279,6 +279,7 @@ static int child_count;
> static int single_menu_mode;
> static int show_all_options;
> static int save_and_exit;
> +static int silent;
>
> static void conf(struct menu *menu, struct menu *active_menu);
> static void conf_choice(struct menu *menu);
> @@ -777,10 +778,12 @@ static void conf_message_callback(const char *fmt, va_list ap)
> char buf[PATH_MAX+1];
>
> vsnprintf(buf, sizeof(buf), fmt, ap);
> - if (save_and_exit)
> - printf("%s", buf);
> - else
> + if (save_and_exit) {
> + if (!silent)
> + printf("%s", buf);
> + } else {
> show_textbox(NULL, buf, 6, 60);
> + }
> }
>
> static void show_help(struct menu *menu)
The patch adds this :
conf_set_message_callback(NULL);
for conf, gconf, and qconf. That won't work for mconf?
> @@ -977,16 +980,18 @@ static int handle_exit(void)
> }
> /* fall through */
> case -1:
> - printf(_("\n\n"
> - "*** End of the configuration.\n"
> - "*** Execute 'make' to start the build or try 'make help'."
> - "\n\n"));
> + if (!silent)
> + printf(_("\n\n"
> + "*** End of the configuration.\n"
> + "*** Execute 'make' to start the build or try 'make help'."
> + "\n\n"));
> res = 0;
> break;
> default:
> - fprintf(stderr, _("\n\n"
> - "Your configuration changes were NOT saved."
> - "\n\n"));
> + if (!silent)
> + fprintf(stderr, _("\n\n"
> + "Your configuration changes were NOT saved."
> + "\n\n"));
> if (res != KEY_ESC)
> res = 0;
> }
> @@ -1010,6 +1015,10 @@ int main(int ac, char **av)
>
> signal(SIGINT, sig_handler);
>
> + if (ac > 1 && strcmp(av[1], "-s") == 0) {
> + silent = 1;
> + av++;
> + }
> conf_parse(av[1]);
> conf_read(NULL);
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 9d3b04b..c3bb7fe 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -1746,7 +1746,7 @@ static const char *progname;
>
> static void usage(void)
> {
> - printf(_("%s <config>\n"), progname);
> + printf(_("%s [-s] <config>\n"), progname);
> exit(0);
> }
>
> @@ -1762,6 +1762,9 @@ int main(int ac, char** av)
> configApp = new QApplication(ac, av);
> if (ac > 1 && av[1][0] == '-') {
> switch (av[1][1]) {
> + case 's':
> + conf_set_message_callback(NULL);
> + break;
> case 'h':
> case '?':
> usage();
Paul Bolle
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] kconfig: Do not print status messages in make -s mode
2015-04-09 12:47 ` Paul Bolle
@ 2015-04-09 12:58 ` Michal Marek
2015-04-09 14:58 ` Paul Bolle
0 siblings, 1 reply; 7+ messages in thread
From: Michal Marek @ 2015-04-09 12:58 UTC (permalink / raw)
To: Paul Bolle; +Cc: linux-kbuild
On 2015-04-09 14:47, Paul Bolle wrote:
> On Wed, 2015-04-08 at 13:42 +0200, Michal Marek wrote:
>> Add an -s option to the conf, mconf, qconf and gconf frontends and pass
>> it when make -s is used.
>
> Basically this suppresses everything except warning and errors,
> correct?
Yes, that's what make -s is expected to do.
> I don't actually use nconf. Is it already silent?
Yes.
> (I had to look up $(kecho). I found:
> ###
> # Easy method for doing a status message
> kecho := :
> quiet_kecho := echo
> silent_kecho := :
> kecho := $($(quiet)kecho)
>
> I'm not fluent in Makefilese. What does it provide beyond @echo?)
See Documentation/kbuild/makefiles.txt.
> The patch adds this :
> conf_set_message_callback(NULL);
>
> for conf, gconf, and qconf. That won't work for mconf?
Have you tried looking at the mconf code? It sets a message callback to
display ncurses dialogs.
Michal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] kconfig: Do not print status messages in make -s mode
2015-04-09 12:58 ` Michal Marek
@ 2015-04-09 14:58 ` Paul Bolle
2015-04-09 15:46 ` Michal Marek
0 siblings, 1 reply; 7+ messages in thread
From: Paul Bolle @ 2015-04-09 14:58 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild
On Thu, 2015-04-09 at 14:58 +0200, Michal Marek wrote:
> On 2015-04-09 14:47, Paul Bolle wrote:
> > The patch adds this :
> > conf_set_message_callback(NULL);
> >
> > for conf, gconf, and qconf. That won't work for mconf?
>
> Have you tried looking at the mconf code? It sets a message callback to
> display ncurses dialogs.
I see.
mconf sets that callback after it has already done a few things. So
"make -s menuconfig" without a .config will do
main()
conf_read(NULL)
conf_read_simple([...])
conf_message(_("using defaults found in %s"), [...])
conf_message_callback()
and at that point conf_message_callback() still points to
conf_default_message_callback(). This default uses stdout. So I think I
stumbled on a cornercase where one message still can be printed to
stdout. Shocking!
Neither conf nor gconf or qconf (assuming GTK and Qt are silent, that
is) seem to do anything serious before setting that callback, so I don't
expect there to be more messages that can break the silence.
Thanks,
Paul Bolle
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] kconfig: Do not print status messages in make -s mode
2015-04-09 14:58 ` Paul Bolle
@ 2015-04-09 15:46 ` Michal Marek
0 siblings, 0 replies; 7+ messages in thread
From: Michal Marek @ 2015-04-09 15:46 UTC (permalink / raw)
To: Paul Bolle; +Cc: linux-kbuild
On Thu, Apr 09, 2015 at 04:58:04PM +0200, Paul Bolle wrote:
> On Thu, 2015-04-09 at 14:58 +0200, Michal Marek wrote:
> > On 2015-04-09 14:47, Paul Bolle wrote:
> > > The patch adds this :
> > > conf_set_message_callback(NULL);
> > >
> > > for conf, gconf, and qconf. That won't work for mconf?
> >
> > Have you tried looking at the mconf code? It sets a message callback to
> > display ncurses dialogs.
>
> I see.
>
> mconf sets that callback after it has already done a few things. So
> "make -s menuconfig" without a .config will do
> main()
> conf_read(NULL)
> conf_read_simple([...])
> conf_message(_("using defaults found in %s"), [...])
> conf_message_callback()
>
> and at that point conf_message_callback() still points to
> conf_default_message_callback(). This default uses stdout. So I think I
> stumbled on a cornercase where one message still can be printed to
> stdout. Shocking!
Heh, you are right and nconf has the same problem. Here is an updated
version.
Michal
From 0a1f00a1c86421cc07cec87011c7cf4df68ee54b Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Wed, 8 Apr 2015 13:30:42 +0200
Subject: [PATCH v2 2/2] kconfig: Do not print status messages in make -s mode
Add an -s option to the various frontends and pass it when make -s is
used. Also, use $(kecho) instead of @echo in the Makefile.
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
v2: Silence another message when mconf / nconf start with missing
configuration.
---
scripts/kconfig/Makefile | 40 ++++++++++++++++++++++------------------
scripts/kconfig/conf.c | 8 ++++++--
scripts/kconfig/gconf.c | 5 ++++-
scripts/kconfig/mconf.c | 31 +++++++++++++++++++++----------
scripts/kconfig/nconf.c | 5 +++++
scripts/kconfig/qconf.cc | 5 ++++-
6 files changed, 62 insertions(+), 32 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 1f5e453..d9b1fef 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -11,27 +11,31 @@ else
Kconfig := Kconfig
endif
+ifeq ($(quiet),silent_)
+silent := -s
+endif
+
# We need this, in case the user has it in its environment
unexport CONFIG_
xconfig: $(obj)/qconf
- $< $(Kconfig)
+ $< $(silent) $(Kconfig)
gconfig: $(obj)/gconf
- $< $(Kconfig)
+ $< $(silent) $(Kconfig)
menuconfig: $(obj)/mconf
- $< $(Kconfig)
+ $< $(silent) $(Kconfig)
config: $(obj)/conf
- $< --oldaskconfig $(Kconfig)
+ $< $(silent) --oldaskconfig $(Kconfig)
nconfig: $(obj)/nconf
- $< $(Kconfig)
+ $< $(silent) $(Kconfig)
silentoldconfig: $(obj)/conf
$(Q)mkdir -p include/config include/generated
- $< --$@ $(Kconfig)
+ $< $(silent) --$@ $(Kconfig)
localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
$(Q)mkdir -p include/config include/generated
@@ -40,18 +44,18 @@ localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
cmp -s .tmp.config .config || \
(mv -f .config .config.old.1; \
mv -f .tmp.config .config; \
- $(obj)/conf --silentoldconfig $(Kconfig); \
+ $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
mv -f .config.old.1 .config.old) \
else \
mv -f .tmp.config .config; \
- $(obj)/conf --silentoldconfig $(Kconfig); \
+ $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
fi
$(Q)rm -f .tmp.config
# Create new linux.pot file
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
- $(Q)echo " GEN config.pot"
+ $(Q)$(kecho) " GEN config.pot"
$(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \
@@ -62,11 +66,11 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
$(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
$(srctree)/arch/*/um/Kconfig`; \
do \
- echo " GEN $$i"; \
+ $(kecho) " GEN $$i"; \
$(obj)/kxgettext $$i \
>> $(obj)/config.pot; \
done )
- $(Q)echo " GEN linux.pot"
+ $(Q)$(kecho) " GEN linux.pot"
$(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
--output $(obj)/linux.pot
$(Q)rm -f $(obj)/config.pot
@@ -77,7 +81,7 @@ simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
PHONY += $(simple-targets)
$(simple-targets): $(obj)/conf
- $< --$@ $(Kconfig)
+ $< $(silent) --$@ $(Kconfig)
PHONY += oldnoconfig savedefconfig defconfig
@@ -87,18 +91,18 @@ PHONY += oldnoconfig savedefconfig defconfig
oldnoconfig: olddefconfig
savedefconfig: $(obj)/conf
- $< --$@=defconfig $(Kconfig)
+ $< $(silent) --$@=defconfig $(Kconfig)
defconfig: $(obj)/conf
ifeq ($(KBUILD_DEFCONFIG),)
- $< --defconfig $(Kconfig)
+ $< $(silent) --defconfig $(Kconfig)
else
- @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
- $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
+ @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
+ $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
endif
%_defconfig: $(obj)/conf
- $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
+ $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
@@ -215,7 +219,7 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
# QT needs some extra effort...
$(obj)/.tmp_qtcheck:
- @set -e; echo " CHECK qt"; dir=""; pkg=""; \
+ @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \
if ! pkg-config --exists QtCore 2> /dev/null; then \
echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
pkg-config --exists qt 2> /dev/null && pkg=qt; \
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index fef75fc..6c20431 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -471,7 +471,7 @@ static struct option long_opts[] = {
static void conf_usage(const char *progname)
{
- printf("Usage: %s [option] <kconfig-file>\n", progname);
+ printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
printf("[option] is _one_ of the following:\n");
printf(" --listnewconfig List new options\n");
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
@@ -501,7 +501,11 @@ int main(int ac, char **av)
tty_stdio = isatty(0) && isatty(1) && isatty(2);
- while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
+ while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
+ if (opt == 's') {
+ conf_set_message_callback(NULL);
+ continue;
+ }
input_mode = (enum input_mode)opt;
switch (opt) {
case silentoldconfig:
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 344b9e3..26d208b 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -1474,9 +1474,12 @@ int main(int ac, char *av[])
case 'a':
//showAll = 1;
break;
+ case 's':
+ conf_set_message_callback(NULL);
+ break;
case 'h':
case '?':
- printf("%s <config>\n", av[0]);
+ printf("%s [-s] <config>\n", av[0]);
exit(0);
}
name = av[2];
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 4dd3755..315ce2c 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -279,6 +279,7 @@ static int child_count;
static int single_menu_mode;
static int show_all_options;
static int save_and_exit;
+static int silent;
static void conf(struct menu *menu, struct menu *active_menu);
static void conf_choice(struct menu *menu);
@@ -777,10 +778,12 @@ static void conf_message_callback(const char *fmt, va_list ap)
char buf[PATH_MAX+1];
vsnprintf(buf, sizeof(buf), fmt, ap);
- if (save_and_exit)
- printf("%s", buf);
- else
+ if (save_and_exit) {
+ if (!silent)
+ printf("%s", buf);
+ } else {
show_textbox(NULL, buf, 6, 60);
+ }
}
static void show_help(struct menu *menu)
@@ -977,16 +980,18 @@ static int handle_exit(void)
}
/* fall through */
case -1:
- printf(_("\n\n"
- "*** End of the configuration.\n"
- "*** Execute 'make' to start the build or try 'make help'."
- "\n\n"));
+ if (!silent)
+ printf(_("\n\n"
+ "*** End of the configuration.\n"
+ "*** Execute 'make' to start the build or try 'make help'."
+ "\n\n"));
res = 0;
break;
default:
- fprintf(stderr, _("\n\n"
- "Your configuration changes were NOT saved."
- "\n\n"));
+ if (!silent)
+ fprintf(stderr, _("\n\n"
+ "Your configuration changes were NOT saved."
+ "\n\n"));
if (res != KEY_ESC)
res = 0;
}
@@ -1010,6 +1015,12 @@ int main(int ac, char **av)
signal(SIGINT, sig_handler);
+ if (ac > 1 && strcmp(av[1], "-s") == 0) {
+ silent = 1;
+ /* Silence conf_read() until the real callback is set up */
+ conf_set_message_callback(NULL);
+ av++;
+ }
conf_parse(av[1]);
conf_read(NULL);
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 984489e..d42d534 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -1482,6 +1482,11 @@ int main(int ac, char **av)
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ if (ac > 1 && strcmp(av[1], "-s") == 0) {
+ /* Silence conf_read() until the real callback is set up */
+ conf_set_message_callback(NULL);
+ av++;
+ }
conf_parse(av[1]);
conf_read(NULL);
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9d3b04b..c3bb7fe 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1746,7 +1746,7 @@ static const char *progname;
static void usage(void)
{
- printf(_("%s <config>\n"), progname);
+ printf(_("%s [-s] <config>\n"), progname);
exit(0);
}
@@ -1762,6 +1762,9 @@ int main(int ac, char** av)
configApp = new QApplication(ac, av);
if (ac > 1 && av[1][0] == '-') {
switch (av[1][1]) {
+ case 's':
+ conf_set_message_callback(NULL);
+ break;
case 'h':
case '?':
usage();
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-04-09 15:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08 11:42 [PATCH 1/2] kconfig: Simplify Makefile Michal Marek
2015-04-08 11:42 ` [PATCH 2/2] kconfig: Do not print status messages in make -s mode Michal Marek
2015-04-09 12:47 ` Paul Bolle
2015-04-09 12:58 ` Michal Marek
2015-04-09 14:58 ` Paul Bolle
2015-04-09 15:46 ` Michal Marek
2015-04-09 1:43 ` [PATCH 1/2] kconfig: Simplify Makefile Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).