diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-21 03:33:04 -0500 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-28 08:22:38 -0500 |
commit | 558e78e3ce844c61ceffe32775dbefacf167b023 (patch) | |
tree | b0e4f2bbbfabb939be8847dc51197fe62e4c3cc2 | |
parent | 0c874100108f03401cb3154801d2671bbad40ad4 (diff) |
kconfig: split some C files out of zconf.y
I want to compile each C file independently instead of including all
of them from zconf.y.
Split out confdata.c, expr.c, symbol.c, and preprocess.c .
These are low-hanging fruits.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r-- | scripts/kconfig/Makefile | 19 | ||||
-rw-r--r-- | scripts/kconfig/confdata.c | 1 | ||||
-rw-r--r-- | scripts/kconfig/expr.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/lkc.h | 1 | ||||
-rw-r--r-- | scripts/kconfig/preprocess.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/symbol.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/zconf.y | 4 |
7 files changed, 16 insertions, 15 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 63b609243d03..d3bd68754750 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -142,13 +142,8 @@ help: | |||
142 | @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' | 142 | @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' |
143 | 143 | ||
144 | # =========================================================================== | 144 | # =========================================================================== |
145 | # Shared Makefile for the various kconfig executables: | ||
146 | # conf: Used for defconfig, oldconfig and related targets | ||
147 | # object files used by all kconfig flavours | 145 | # object files used by all kconfig flavours |
148 | 146 | common-objs := confdata.o expr.o symbol.o preprocess.o zconf.tab.o | |
149 | conf-objs := conf.o zconf.tab.o | ||
150 | |||
151 | hostprogs-y := conf | ||
152 | 147 | ||
153 | targets += zconf.lex.c | 148 | targets += zconf.lex.c |
154 | 149 | ||
@@ -156,9 +151,13 @@ targets += zconf.lex.c | |||
156 | HOSTCFLAGS_zconf.lex.o := -I$(src) | 151 | HOSTCFLAGS_zconf.lex.o := -I$(src) |
157 | HOSTCFLAGS_zconf.tab.o := -I$(src) | 152 | HOSTCFLAGS_zconf.tab.o := -I$(src) |
158 | 153 | ||
154 | # conf: Used for defconfig, oldconfig and related targets | ||
155 | hostprogs-y += conf | ||
156 | conf-objs := conf.o $(common-objs) | ||
157 | |||
159 | # nconf: Used for the nconfig target based on ncurses | 158 | # nconf: Used for the nconfig target based on ncurses |
160 | hostprogs-y += nconf | 159 | hostprogs-y += nconf |
161 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o | 160 | nconf-objs := nconf.o nconf.gui.o $(common-objs) |
162 | 161 | ||
163 | HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) | 162 | HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) |
164 | HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) | 163 | HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) |
@@ -169,7 +168,7 @@ $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg | |||
169 | # mconf: Used for the menuconfig target based on lxdialog | 168 | # mconf: Used for the menuconfig target based on lxdialog |
170 | hostprogs-y += mconf | 169 | hostprogs-y += mconf |
171 | lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o | 170 | lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o |
172 | mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) | 171 | mconf-objs := mconf.o $(addprefix lxdialog/, $(lxdialog)) $(common-objs) |
173 | 172 | ||
174 | HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) | 173 | HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) |
175 | $(foreach f, mconf.o $(lxdialog), \ | 174 | $(foreach f, mconf.o $(lxdialog), \ |
@@ -181,7 +180,7 @@ $(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg | |||
181 | # qconf: Used for the xconfig target based on Qt | 180 | # qconf: Used for the xconfig target based on Qt |
182 | hostprogs-y += qconf | 181 | hostprogs-y += qconf |
183 | qconf-cxxobjs := qconf.o | 182 | qconf-cxxobjs := qconf.o |
184 | qconf-objs := zconf.tab.o | 183 | qconf-objs := $(common-objs) |
185 | 184 | ||
186 | HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) | 185 | HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) |
187 | HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) | 186 | HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) |
@@ -196,7 +195,7 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg | |||
196 | 195 | ||
197 | # gconf: Used for the gconfig target based on GTK+ | 196 | # gconf: Used for the gconfig target based on GTK+ |
198 | hostprogs-y += gconf | 197 | hostprogs-y += gconf |
199 | gconf-objs := gconf.o zconf.tab.o | 198 | gconf-objs := gconf.o $(common-objs) |
200 | 199 | ||
201 | HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) | 200 | HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) |
202 | HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) | 201 | HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 83f78e5c137e..08ba146a83c5 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <ctype.h> | 7 | #include <ctype.h> |
8 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <fcntl.h> | 9 | #include <fcntl.h> |
10 | #include <limits.h> | ||
10 | #include <stdarg.h> | 11 | #include <stdarg.h> |
11 | #include <stdio.h> | 12 | #include <stdio.h> |
12 | #include <stdlib.h> | 13 | #include <stdlib.h> |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 3ff8c92c86ba..77ffff3a053c 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | 3 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <ctype.h> | ||
7 | #include <errno.h> | ||
6 | #include <stdio.h> | 8 | #include <stdio.h> |
7 | #include <stdlib.h> | 9 | #include <stdlib.h> |
8 | #include <string.h> | 10 | #include <string.h> |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 4ff33cd099cd..160a9312e11a 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -108,6 +108,7 @@ const char *str_get(struct gstr *gs); | |||
108 | /* symbol.c */ | 108 | /* symbol.c */ |
109 | void sym_clear_all_valid(void); | 109 | void sym_clear_all_valid(void); |
110 | struct symbol *sym_choice_default(struct symbol *sym); | 110 | struct symbol *sym_choice_default(struct symbol *sym); |
111 | struct property *sym_get_range_prop(struct symbol *sym); | ||
111 | const char *sym_get_string_default(struct symbol *sym); | 112 | const char *sym_get_string_default(struct symbol *sym); |
112 | struct symbol *sym_check_deps(struct symbol *sym); | 113 | struct symbol *sym_check_deps(struct symbol *sym); |
113 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); | 114 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); |
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c index b028a48b0e76..592dfbfa9fb3 100644 --- a/scripts/kconfig/preprocess.c +++ b/scripts/kconfig/preprocess.c | |||
@@ -2,6 +2,7 @@ | |||
2 | // | 2 | // |
3 | // Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com> | 3 | // Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com> |
4 | 4 | ||
5 | #include <ctype.h> | ||
5 | #include <stdarg.h> | 6 | #include <stdarg.h> |
6 | #include <stdbool.h> | 7 | #include <stdbool.h> |
7 | #include <stdio.h> | 8 | #include <stdio.h> |
@@ -9,6 +10,7 @@ | |||
9 | #include <string.h> | 10 | #include <string.h> |
10 | 11 | ||
11 | #include "list.h" | 12 | #include "list.h" |
13 | #include "lkc.h" | ||
12 | 14 | ||
13 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | 15 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
14 | 16 | ||
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index d1457836e92a..1f9266dadedf 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -86,7 +86,7 @@ static struct property *sym_get_default_prop(struct symbol *sym) | |||
86 | return NULL; | 86 | return NULL; |
87 | } | 87 | } |
88 | 88 | ||
89 | static struct property *sym_get_range_prop(struct symbol *sym) | 89 | struct property *sym_get_range_prop(struct symbol *sym) |
90 | { | 90 | { |
91 | struct property *prop; | 91 | struct property *prop; |
92 | 92 | ||
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 0d590cb07b71..a990f46f3825 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -731,8 +731,4 @@ void zconfdump(FILE *out) | |||
731 | 731 | ||
732 | #include "zconf.lex.c" | 732 | #include "zconf.lex.c" |
733 | #include "util.c" | 733 | #include "util.c" |
734 | #include "confdata.c" | ||
735 | #include "expr.c" | ||
736 | #include "symbol.c" | ||
737 | #include "menu.c" | 734 | #include "menu.c" |
738 | #include "preprocess.c" | ||