Skip to content

Commit 0a1f00a

Browse files
committed
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>
1 parent 1cba0c3 commit 0a1f00a

6 files changed

Lines changed: 62 additions & 32 deletions

File tree

‎scripts/kconfig/Makefile‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,31 @@ else
1111
Kconfig := Kconfig
1212
endif
1313

14+
ifeq ($(quiet),silent_)
15+
silent := -s
16+
endif
17+
1418
# We need this, in case the user has it in its environment
1519
unexport CONFIG_
1620

1721
xconfig: $(obj)/qconf
18-
$< $(Kconfig)
22+
$< $(silent) $(Kconfig)
1923

2024
gconfig: $(obj)/gconf
21-
$< $(Kconfig)
25+
$< $(silent) $(Kconfig)
2226

2327
menuconfig: $(obj)/mconf
24-
$< $(Kconfig)
28+
$< $(silent) $(Kconfig)
2529

2630
config: $(obj)/conf
27-
$< --oldaskconfig $(Kconfig)
31+
$< $(silent) --oldaskconfig $(Kconfig)
2832

2933
nconfig: $(obj)/nconf
30-
$< $(Kconfig)
34+
$< $(silent) $(Kconfig)
3135

3236
silentoldconfig: $(obj)/conf
3337
$(Q)mkdir -p include/config include/generated
34-
$< --$@ $(Kconfig)
38+
$< $(silent) --$@ $(Kconfig)
3539

3640
localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
3741
$(Q)mkdir -p include/config include/generated
@@ -40,18 +44,18 @@ localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
4044
cmp -s .tmp.config .config || \
4145
(mv -f .config .config.old.1; \
4246
mv -f .tmp.config .config; \
43-
$(obj)/conf --silentoldconfig $(Kconfig); \
47+
$(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
4448
mv -f .config.old.1 .config.old) \
4549
else \
4650
mv -f .tmp.config .config; \
47-
$(obj)/conf --silentoldconfig $(Kconfig); \
51+
$(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
4852
fi
4953
$(Q)rm -f .tmp.config
5054

5155
# Create new linux.pot file
5256
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
5357
update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
54-
$(Q)echo " GEN config.pot"
58+
$(Q)$(kecho) " GEN config.pot"
5559
$(Q)xgettext --default-domain=linux \
5660
--add-comments --keyword=_ --keyword=N_ \
5761
--from-code=UTF-8 \
@@ -62,11 +66,11 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
6266
$(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
6367
$(srctree)/arch/*/um/Kconfig`; \
6468
do \
65-
echo " GEN $$i"; \
69+
$(kecho) " GEN $$i"; \
6670
$(obj)/kxgettext $$i \
6771
>> $(obj)/config.pot; \
6872
done )
69-
$(Q)echo " GEN linux.pot"
73+
$(Q)$(kecho) " GEN linux.pot"
7074
$(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
7175
--output $(obj)/linux.pot
7276
$(Q)rm -f $(obj)/config.pot
@@ -77,7 +81,7 @@ simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
7781
PHONY += $(simple-targets)
7882

7983
$(simple-targets): $(obj)/conf
80-
$< --$@ $(Kconfig)
84+
$< $(silent) --$@ $(Kconfig)
8185

8286
PHONY += oldnoconfig savedefconfig defconfig
8387

@@ -87,18 +91,18 @@ PHONY += oldnoconfig savedefconfig defconfig
8791
oldnoconfig: olddefconfig
8892

8993
savedefconfig: $(obj)/conf
90-
$< --$@=defconfig $(Kconfig)
94+
$< $(silent) --$@=defconfig $(Kconfig)
9195

9296
defconfig: $(obj)/conf
9397
ifeq ($(KBUILD_DEFCONFIG),)
94-
$< --defconfig $(Kconfig)
98+
$< $(silent) --defconfig $(Kconfig)
9599
else
96-
@echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
97-
$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
100+
@$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
101+
$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
98102
endif
99103

100104
%_defconfig: $(obj)/conf
101-
$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
105+
$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
102106

103107
configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
104108

@@ -215,7 +219,7 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
215219

216220
# QT needs some extra effort...
217221
$(obj)/.tmp_qtcheck:
218-
@set -e; echo " CHECK qt"; dir=""; pkg=""; \
222+
@set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \
219223
if ! pkg-config --exists QtCore 2> /dev/null; then \
220224
echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
221225
pkg-config --exists qt 2> /dev/null && pkg=qt; \

‎scripts/kconfig/conf.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static struct option long_opts[] = {
471471
static void conf_usage(const char *progname)
472472
{
473473

474-
printf("Usage: %s [option] <kconfig-file>\n", progname);
474+
printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
475475
printf("[option] is _one_ of the following:\n");
476476
printf(" --listnewconfig List new options\n");
477477
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
@@ -501,7 +501,11 @@ int main(int ac, char **av)
501501

502502
tty_stdio = isatty(0) && isatty(1) && isatty(2);
503503

504-
while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
504+
while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
505+
if (opt == 's') {
506+
conf_set_message_callback(NULL);
507+
continue;
508+
}
505509
input_mode = (enum input_mode)opt;
506510
switch (opt) {
507511
case silentoldconfig:

‎scripts/kconfig/gconf.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,9 +1474,12 @@ int main(int ac, char *av[])
14741474
case 'a':
14751475
//showAll = 1;
14761476
break;
1477+
case 's':
1478+
conf_set_message_callback(NULL);
1479+
break;
14771480
case 'h':
14781481
case '?':
1479-
printf("%s <config>\n", av[0]);
1482+
printf("%s [-s] <config>\n", av[0]);
14801483
exit(0);
14811484
}
14821485
name = av[2];

‎scripts/kconfig/mconf.c‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ static int child_count;
279279
static int single_menu_mode;
280280
static int show_all_options;
281281
static int save_and_exit;
282+
static int silent;
282283

283284
static void conf(struct menu *menu, struct menu *active_menu);
284285
static void conf_choice(struct menu *menu);
@@ -777,10 +778,12 @@ static void conf_message_callback(const char *fmt, va_list ap)
777778
char buf[PATH_MAX+1];
778779

779780
vsnprintf(buf, sizeof(buf), fmt, ap);
780-
if (save_and_exit)
781-
printf("%s", buf);
782-
else
781+
if (save_and_exit) {
782+
if (!silent)
783+
printf("%s", buf);
784+
} else {
783785
show_textbox(NULL, buf, 6, 60);
786+
}
784787
}
785788

786789
static void show_help(struct menu *menu)
@@ -977,16 +980,18 @@ static int handle_exit(void)
977980
}
978981
/* fall through */
979982
case -1:
980-
printf(_("\n\n"
981-
"*** End of the configuration.\n"
982-
"*** Execute 'make' to start the build or try 'make help'."
983-
"\n\n"));
983+
if (!silent)
984+
printf(_("\n\n"
985+
"*** End of the configuration.\n"
986+
"*** Execute 'make' to start the build or try 'make help'."
987+
"\n\n"));
984988
res = 0;
985989
break;
986990
default:
987-
fprintf(stderr, _("\n\n"
988-
"Your configuration changes were NOT saved."
989-
"\n\n"));
991+
if (!silent)
992+
fprintf(stderr, _("\n\n"
993+
"Your configuration changes were NOT saved."
994+
"\n\n"));
990995
if (res != KEY_ESC)
991996
res = 0;
992997
}
@@ -1010,6 +1015,12 @@ int main(int ac, char **av)
10101015

10111016
signal(SIGINT, sig_handler);
10121017

1018+
if (ac > 1 && strcmp(av[1], "-s") == 0) {
1019+
silent = 1;
1020+
/* Silence conf_read() until the real callback is set up */
1021+
conf_set_message_callback(NULL);
1022+
av++;
1023+
}
10131024
conf_parse(av[1]);
10141025
conf_read(NULL);
10151026

‎scripts/kconfig/nconf.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,11 @@ int main(int ac, char **av)
14821482
bindtextdomain(PACKAGE, LOCALEDIR);
14831483
textdomain(PACKAGE);
14841484

1485+
if (ac > 1 && strcmp(av[1], "-s") == 0) {
1486+
/* Silence conf_read() until the real callback is set up */
1487+
conf_set_message_callback(NULL);
1488+
av++;
1489+
}
14851490
conf_parse(av[1]);
14861491
conf_read(NULL);
14871492

‎scripts/kconfig/qconf.cc‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ static const char *progname;
17461746

17471747
static void usage(void)
17481748
{
1749-
printf(_("%s <config>\n"), progname);
1749+
printf(_("%s [-s] <config>\n"), progname);
17501750
exit(0);
17511751
}
17521752

@@ -1762,6 +1762,9 @@ int main(int ac, char** av)
17621762
configApp = new QApplication(ac, av);
17631763
if (ac > 1 && av[1][0] == '-') {
17641764
switch (av[1][1]) {
1765+
case 's':
1766+
conf_set_message_callback(NULL);
1767+
break;
17651768
case 'h':
17661769
case '?':
17671770
usage();

0 commit comments

Comments
 (0)