Generate the choice menu for C libraries, the same way arch and kernels are generated.
/trunk/kconfig/kconfig.mk | 10 8 2 0 ++++++--
/trunk/scripts/build/libc/glibc.sh | 2 1 1 0 +-
/trunk/config/libc/glibc.in | 22 6 16 0 +++++-------------
/trunk/config/libc/uClibc.in | 7 6 1 0 +++++-
/trunk/config/libc/eglibc.in | 12 11 1 0 +++++++++-
/trunk/config/libc.in | 53 4 49 0 +++-----------------------------------------
6 files changed, 36 insertions(+), 70 deletions(-)
1 # ===========================================================================
2 # crosstool-NG configuration targets
3 # These targets are used from top-level makefile
5 # Derive the project version from, well, the project version:
6 export PROJECTVERSION=$(CT_VERSION)
8 KCONFIG_TOP = config/config.in
9 obj = $(CT_TOP_DIR)/kconfig
10 PHONY += clean help oldconfig menuconfig config defoldconfig
12 # Darwin (MacOS-X) does not have proper libintl support
13 ifeq ($(shell uname -s),Darwin)
17 ifneq ($(KBUILD_NO_NLS),)
18 CFLAGS += -DKBUILD_NO_NLS
21 # Build a list of all config files
22 ARCH_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/arch/*.in)
23 KERNEL_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/kernel/*.in)
24 LIBC_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/libc/*.in)
25 DEBUG_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/debug/*.in)
26 TOOL_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/tools/*.in)
28 STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
29 GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/arch.in \
30 $(CT_TOP_DIR)/config.gen/kernel.in \
31 $(CT_TOP_DIR)/config.gen/libc.in \
32 $(CT_TOP_DIR)/config.gen/tools.in \
33 $(CT_TOP_DIR)/config.gen/debug.in
35 CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
38 ARCHS = $(patsubst $(CT_LIB_DIR)/config/arch/%.in,%,$(ARCH_CONFIG_FILES))
39 KERNELS = $(patsubst $(CT_LIB_DIR)/config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
40 LIBCS = $(patsubst $(CT_LIB_DIR)/config/libc/%.in,%,$(LIBC_CONFIG_FILES))
41 DEBUGS = $(patsubst $(CT_LIB_DIR)/config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
42 TOOLS = $(patsubst $(CT_LIB_DIR)/config/tools/%.in,%,$(TOOL_CONFIG_FILES))
44 $(GEN_CONFIG_FILES): $(CT_TOP_DIR)/config.gen \
45 $(CT_LIB_DIR)/kconfig/kconfig.mk
47 $(CT_TOP_DIR)/config.gen: $(KCONFIG_TOP)
48 @mkdir -p $(CT_TOP_DIR)/config.gen
50 # Function build_gen_choice_in:
51 # $1 : destination file
52 # $2 : name for the entries family (eg. Architecture, kernel...)
53 # $3 : prefix for the choice entries (eg. ARCH, KERNEL...)
54 # $4 : base directory containing config files
55 # $5 : list of config entries (eg. for architectures: "alpha arm ia64"...,
56 # and for kernels: "bare-metal linux"...)
57 # Example to build the kernels generated config file:
58 # $(call build_gen_choice_in,config.gen/kernel.in,Target OS,KERNEL,config/kernel,$(KERNELS))
59 define build_gen_choice_in
61 @(echo "# $(2) menu"; \
62 echo "# Generated file, do not edit!!!"; \
66 echo " prompt \"$(2)\""; \
68 for entry in $(5); do \
69 file="$(4)/$${entry}.in"; \
70 _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
71 echo "config $(3)_$${_entry}"; \
73 printf " prompt \"$${entry}"; \
74 if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
75 echo " (EXPERIMENTAL)\""; \
76 echo " depends on EXPERIMENTAL"; \
83 for entry in $(5); do \
84 file="$(4)/$${entry}.in"; \
85 _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
87 echo "if $(3)_$${_entry}"; \
89 echo " default \"$${entry}\" if $(3)_$${_entry}"; \
90 echo "source $${file}"; \
96 $(CT_TOP_DIR)/config.gen/arch.in: $(ARCH_CONFIG_FILES)
97 $(call build_gen_choice_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Target Architecture,ARCH,config/arch,$(ARCHS))
99 $(CT_TOP_DIR)/config.gen/kernel.in: $(KERNEL_CONFIG_FILES)
100 $(call build_gen_choice_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Target OS,KERNEL,config/kernel,$(KERNELS))
102 $(CT_TOP_DIR)/config.gen/libc.in: $(LIBC_CONFIG_FILES)
103 $(call build_gen_choice_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),C library,LIBC,config/libc,$(LIBCS))
105 # Function build_gen_menu_in:
106 # $1 : destination file
107 # $2 : name of entries family (eg. Tools, Debug...)
108 # $3 : prefix for the menu entries (eg. TOOL, DEBUG)
109 # $4 : base directory containing config files
110 # $5 : list of config entries (eg. for tools: "libelf sstrip"..., and for
111 # debug: "dmalloc duma gdb"...)
112 # Example to build the tools generated config file:
113 # $(call build_gen_menu_in,config.gen/tools.in,Tools,TOOL,config/tools,$(TOOLS))
114 define build_gen_menu_in
116 @(echo "# $(2) facilities menu"; \
117 echo "# Generated file, do not edit!!!"; \
119 for entry in $(5); do \
120 file="$(4)/$${entry}.in"; \
121 _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
122 echo "menuconfig $(3)_$${_entry}"; \
124 printf " prompt \"$${entry}"; \
125 if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
126 echo " (EXPERIMENTAL)\""; \
127 echo " depends on EXPERIMENTAL"; \
131 echo "if $(3)_$${_entry}"; \
132 echo "source $${file}"; \
139 $(CT_TOP_DIR)/config.gen/tools.in: $(TOOL_CONFIG_FILES)
140 $(call build_gen_menu_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Tools,TOOL,config/tools,$(TOOLS))
142 $(CT_TOP_DIR)/config.gen/debug.in: $(DEBUG_CONFIG_FILES)
143 $(call build_gen_menu_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Debug,DEBUG,config/debug,$(DEBUGS))
145 config menuconfig oldconfig defoldconfig: $(KCONFIG_TOP)
148 @ln -sf $(CT_LIB_DIR)/config config
150 menuconfig: $(CONFIG_FILES) $(obj)/mconf
151 @$(obj)/mconf $(KCONFIG_TOP)
153 config: $(CONFIG_FILES) $(obj)/conf
154 @$(obj)/conf $(KCONFIG_TOP)
156 oldconfig: $(CONFIG_FILES) $(obj)/conf
157 @$(obj)/conf -s $(KCONFIG_TOP)
159 defoldconfig: $(CONFIG_FILES) $(obj)/conf
160 @yes "" |$(obj)/conf -s $(KCONFIG_TOP)
162 # Help text used by make help
164 @echo ' config - Update current config using a line-oriented program'
165 @echo ' menuconfig - Update current config using a menu based program'
166 @echo ' oldconfig - Update current config using a provided .config as base'
167 @echo ' build log piped into stdin'
171 SHIPPED := $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
173 $(obj)/conf $(obj)/mconf: $(obj)
178 HEADERS = $(CT_LIB_DIR)/kconfig/expr.h \
179 $(CT_LIB_DIR)/kconfig/lkc.h \
180 $(CT_LIB_DIR)/kconfig/lkc_proto.h
182 FILES = $(CT_LIB_DIR)/kconfig/confdata.c \
183 $(CT_LIB_DIR)/kconfig/expr.c \
184 $(CT_LIB_DIR)/kconfig/menu.c \
185 $(CT_LIB_DIR)/kconfig/symbol.c \
186 $(CT_LIB_DIR)/kconfig/util.c
188 $(obj)/mconf: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c \
189 $(HEADERS) $(FILES) \
190 $(CT_LIB_DIR)/kconfig/kconfig.mk
191 @echo ' LD kconfig/mconf'
192 @$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
193 $(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ccflags) \
194 $(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ldflags $(HOST_CC))
196 $(obj)/conf: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c \
197 $(HEADERS) $(FILES) \
198 $(CT_LIB_DIR)/kconfig/kconfig.mk
199 @echo ' LD kconfig/conf'
200 @$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
203 @rm -f $(CT_TOP_DIR)/kconfig/{,m}conf
204 @rmdir --ignore-fail-on-non-empty $(CT_TOP_DIR)/kconfig 2>/dev/null || true
205 @rm -f $(CT_TOP_DIR)/config 2>/dev/null || true
206 @rm -rf $(CT_TOP_DIR)/config.gen