config: add support for a second part of the generated choices

Some components have configuration options that can depend on
generic options, so they should go below those.

uClibc for example:
- has its own options (wchar...)
- uses the generic options (threads...)
- if linuxthreads chosen, offers two impls

So we need to be able to split the components options in 2,
one part that is above the generic options, and one part that
ends up below the generic options.
This commit is contained in:
Yann E. MORIN" 2010-06-08 23:26:54 +02:00
parent 3c351b899d
commit 43ca5b4095
5 changed files with 38 additions and 10 deletions

View File

@ -115,4 +115,6 @@ config CC_LANG_OTHERS
endif # ! BARE_METAL
source "config.gen/cc.in.2"
endmenu

View File

@ -9,16 +9,20 @@
KCONFIG_TOP = config/config.in
# Build the list of all source config files
STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f -name '*.in' 2>/dev/null))
STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f \( -name '*.in' -o -name '*.in.2' \) 2>/dev/null))
# ... and how to access them:
$(STATIC_CONFIG_FILES): config
# Build a list of per-component-type source config files
ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
ARCH_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in.2))
KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))
CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
CC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))
LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
LIBC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))
DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
# Build the list of generated config files
GEN_CONFIG_FILES = config.gen/arch.in \
@ -117,6 +121,20 @@ define build_gen_choice_in
echo "source \"$${file}\""; \
done; \
) >$(1)
$(SILENT)(echo "# $(2) second part options"; \
echo "# Generated file, do not edit!!!"; \
for entry in $(6); do \
file="$(4)/$${entry}.in"; \
_entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;'); \
if [ -f "$${file}.2" ]; then \
echo ""; \
echo "if $(3)_$${_entry}"; \
echo "comment \"$${entry} other options\""; \
echo "source \"$${file}.2\""; \
echo "endif"; \
fi; \
done; \
) >$(1).2
endef
# The function 'build_gen_menu_in' builds a menuconfig for each component in
@ -154,16 +172,18 @@ endef
#-----------------------------------------------------------
# The rules for the generated config files
config.gen/arch.in: $(ARCH_CONFIG_FILES)
# WARNING! If a .in file disapears between two runs, that will NOT be detected!
config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2)
$(call build_gen_choice_in,$@,Target Architecture,ARCH,config/arch,Y,$(ARCHS))
config.gen/kernel.in: $(KERNEL_CONFIG_FILES)
config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2)
$(call build_gen_choice_in,$@,Target OS,KERNEL,config/kernel,Y,$(KERNELS))
config.gen/cc.in: $(CC_CONFIG_FILES)
config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2)
$(call build_gen_choice_in,$@,C compiler,CC,config/cc,,$(CCS))
config.gen/libc.in: $(LIBC_CONFIG_FILES)
config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2)
$(call build_gen_choice_in,$@,C library,LIBC,config/libc,Y,$(LIBCS))
config.gen/debug.in: $(DEBUG_CONFIG_FILES)

View File

@ -36,4 +36,6 @@ config SHARED_LIBS
You might not want shared libraries if you're building for a target that
don't support it (maybe some nommu targets, for example, or bare metal).
source "config.gen/kernel.in.2"
endmenu

View File

@ -63,6 +63,8 @@ config THREADS_NONE
endchoice
source "config.gen/libc.in.2"
endif # ! LIBC_none
endmenu

View File

@ -311,4 +311,6 @@ config TARGET_LDFLAGS
Leave blank if you don't know better.
source "config.gen/arch.in.2"
endmenu