lkml.org 
[lkml]   [2021]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kconfig: split menu.c out of parser.y
Date
Compile menu.c as an independent compilation unit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

scripts/kconfig/Makefile | 4 ++--
scripts/kconfig/internal.h | 9 +++++++++
scripts/kconfig/menu.c | 1 +
scripts/kconfig/parser.y | 5 ++---
4 files changed, 14 insertions(+), 5 deletions(-)
create mode 100644 scripts/kconfig/internal.h

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 1d1a7f83ee8d..5a215880b268 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -143,8 +143,8 @@ help:

# ===========================================================================
# object files used by all kconfig flavours
-common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
- symbol.o util.o
+common-objs := confdata.o expr.o lexer.lex.o menu.o parser.tab.o \
+ preprocess.o symbol.o util.o

$(obj)/lexer.lex.o: $(obj)/parser.tab.h
HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
diff --git a/scripts/kconfig/internal.h b/scripts/kconfig/internal.h
new file mode 100644
index 000000000000..2f7298c21b64
--- /dev/null
+++ b/scripts/kconfig/internal.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef INTERNAL_H
+#define INTERNAL_H
+
+struct menu;
+
+extern struct menu *current_menu, *current_entry;
+
+#endif /* INTERNAL_H */
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 8b2108b74821..606ba8a63c24 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -9,6 +9,7 @@
#include <string.h>

#include "lkc.h"
+#include "internal.h"

static const char nohelp_text[] = "There is no help available for this option.";

diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
index e90889edf5b3..2af7ce4e1531 100644
--- a/scripts/kconfig/parser.y
+++ b/scripts/kconfig/parser.y
@@ -12,6 +12,7 @@
#include <stdbool.h>

#include "lkc.h"
+#include "internal.h"

#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)

@@ -28,7 +29,7 @@ static bool zconf_endtoken(const char *tokenname,

struct symbol *symbol_hash[SYMBOL_HASHSIZE];

-static struct menu *current_menu, *current_entry;
+struct menu *current_menu, *current_entry;

%}

@@ -713,5 +714,3 @@ void zconfdump(FILE *out)
}
}
}
-
-#include "menu.c"
--
2.27.0
\
 
 \ /
  Last update: 2021-04-13 17:10    [W:0.045 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site