1 From 5e2355bf017b3347b29126a0eeb866558334f704 Mon Sep 17 00:00:00 2001
2 From: Stefan Reinauer <stefan.reinauer@coreboot.org>
3 Date: Fri, 3 Apr 2015 20:01:38 +0200
4 Subject: [PATCH] kconfig: Add wildcard support for "source"
6 Kconfig's include directive "source" does not support
7 wildcards (e.g. source src/mainboard/*/Kconfig) which
8 makes automatic inclusion of all boards a tedious task
9 and prevents us from implementing "drop in" boards.
11 In our Makefile.mk files we already include mainboard
12 directories per wildcard, so let's add the infrastructure
13 to do the same with Kconfig.
15 v2: change from wordexp to glob for better portability.
17 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
18 Signed-off-by: Patrick Georgi <pgeorgi@google.com>
20 util/kconfig/lexer.l | 27 +++++++++++++++++++++++++++
21 util/kconfig/lkc.h | 1 +
22 util/kconfig/parser.y | 2 +-
23 3 files changed, 29 insertions(+), 1 deletion(-)
25 Index: kconfig/lexer.l
26 ===================================================================
27 --- kconfig.orig/lexer.l
37 @@ -439,6 +440,32 @@ void zconf_nextfile(const char *name)
41 +void zconf_nextfiles(const char *wildcard)
47 + if (glob(wildcard, 0, NULL, &g) != 0) {
50 + if (g.gl_pathv == NULL) {
55 + /* working through files backwards, since
56 + * we're first pushing them on a stack
57 + * before actually handling them.
59 + for (i = g.gl_pathc; i > 0; i--) {
60 + w = &g.gl_pathv[i - 1];
67 static void zconf_endfile(void)
69 struct buffer *parent;
71 ===================================================================
72 --- kconfig.orig/lkc.h
74 @@ -36,6 +36,7 @@ void zconf_starthelp(void);
75 FILE *zconf_fopen(const char *name);
76 void zconf_initscan(const char *name);
77 void zconf_nextfile(const char *name);
78 +void zconf_nextfiles(const char *name);
79 int zconf_lineno(void);
80 const char *zconf_curname(void);
82 Index: kconfig/parser.y
83 ===================================================================
84 --- kconfig.orig/parser.y
86 @@ -358,7 +358,7 @@ menu_option_list:
87 source_stmt: T_SOURCE T_WORD_QUOTE T_EOL
89 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
91 + zconf_nextfiles($2);