From 43ca5b409558d6eea50c99384b76980ebaf5f52d Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Tue, 8 Jun 2010 23:26:54 +0200 Subject: 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. diff --git a/config/cc.in b/config/cc.in index 8869f03..4afa278 100644 --- a/config/cc.in +++ b/config/cc.in @@ -115,4 +115,6 @@ config CC_LANG_OTHERS endif # ! BARE_METAL +source "config.gen/cc.in.2" + endmenu diff --git a/config/config.mk b/config/config.mk index c0247b1..434e463 100644 --- a/config/config.mk +++ b/config/config.mk @@ -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) diff --git a/config/kernel.in b/config/kernel.in index 6dd9c6c..630eae6 100644 --- a/config/kernel.in +++ b/config/kernel.in @@ -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 diff --git a/config/libc.in b/config/libc.in index de6955e..74bdd1a 100644 --- a/config/libc.in +++ b/config/libc.in @@ -63,6 +63,8 @@ config THREADS_NONE endchoice +source "config.gen/libc.in.2" + endif # ! LIBC_none endmenu diff --git a/config/target.in b/config/target.in index 0a3e1bb..c66ddc2 100644 --- a/config/target.in +++ b/config/target.in @@ -311,4 +311,6 @@ config TARGET_LDFLAGS Leave blank if you don't know better. +source "config.gen/arch.in.2" + endmenu -- cgit v0.10.2-6-g49f6