config: add support for a second part of the generated choices
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jun 08 23:26:54 2010 +0200 (2010-06-08)
changeset 19762d90ec981ba3
parent 1975 1dfb2713112b
child 1977 d11009b668dd
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.
config/cc.in
config/config.mk
config/kernel.in
config/libc.in
config/target.in
     1.1 --- a/config/cc.in	Sun May 30 18:19:05 2010 +0200
     1.2 +++ b/config/cc.in	Tue Jun 08 23:26:54 2010 +0200
     1.3 @@ -115,4 +115,6 @@
     1.4  
     1.5  endif # ! BARE_METAL
     1.6  
     1.7 +source "config.gen/cc.in.2"
     1.8 +
     1.9  endmenu
     2.1 --- a/config/config.mk	Sun May 30 18:19:05 2010 +0200
     2.2 +++ b/config/config.mk	Tue Jun 08 23:26:54 2010 +0200
     2.3 @@ -9,16 +9,20 @@
     2.4  KCONFIG_TOP = config/config.in
     2.5  
     2.6  # Build the list of all source config files
     2.7 -STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f -name '*.in' 2>/dev/null))
     2.8 +STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f \( -name '*.in' -o -name '*.in.2' \) 2>/dev/null))
     2.9  # ... and how to access them:
    2.10  $(STATIC_CONFIG_FILES): config
    2.11  
    2.12  # Build a list of per-component-type source config files
    2.13 -ARCH_CONFIG_FILES   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
    2.14 -KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
    2.15 -CC_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
    2.16 -LIBC_CONFIG_FILES   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
    2.17 -DEBUG_CONFIG_FILES  = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
    2.18 +ARCH_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
    2.19 +ARCH_CONFIG_FILES_2   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in.2))
    2.20 +KERNEL_CONFIG_FILES   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
    2.21 +KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))
    2.22 +CC_CONFIG_FILES       = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
    2.23 +CC_CONFIG_FILES_2     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))
    2.24 +LIBC_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
    2.25 +LIBC_CONFIG_FILES_2   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))
    2.26 +DEBUG_CONFIG_FILES    = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
    2.27  
    2.28  # Build the list of generated config files
    2.29  GEN_CONFIG_FILES = config.gen/arch.in     \
    2.30 @@ -117,6 +121,20 @@
    2.31  	    echo "source \"$${file}\"";                                         \
    2.32  	  done;                                                                 \
    2.33  	 ) >$(1)
    2.34 +	$(SILENT)(echo "# $(2) second part options";                            \
    2.35 +	  echo "# Generated file, do not edit!!!";                              \
    2.36 +	  for entry in $(6); do                                                 \
    2.37 +	    file="$(4)/$${entry}.in";                                           \
    2.38 +	    _entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;');        \
    2.39 +	    if [ -f "$${file}.2" ]; then                                        \
    2.40 +	      echo "";                                                          \
    2.41 +	      echo "if $(3)_$${_entry}";                                        \
    2.42 +	      echo "comment \"$${entry} other options\"";                       \
    2.43 +	      echo "source \"$${file}.2\"";                                     \
    2.44 +	      echo "endif";                                                     \
    2.45 +	    fi;                                                                 \
    2.46 +	  done;                                                                 \
    2.47 +	 ) >$(1).2
    2.48  endef
    2.49  
    2.50  # The function 'build_gen_menu_in' builds a menuconfig for each component in
    2.51 @@ -154,16 +172,18 @@
    2.52  #-----------------------------------------------------------
    2.53  # The rules for the generated config files
    2.54  
    2.55 -config.gen/arch.in: $(ARCH_CONFIG_FILES)
    2.56 +# WARNING! If a .in file disapears between two runs, that will NOT be detected!
    2.57 +
    2.58 +config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2)
    2.59  	$(call build_gen_choice_in,$@,Target Architecture,ARCH,config/arch,Y,$(ARCHS))
    2.60  
    2.61 -config.gen/kernel.in: $(KERNEL_CONFIG_FILES)
    2.62 +config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2)
    2.63  	$(call build_gen_choice_in,$@,Target OS,KERNEL,config/kernel,Y,$(KERNELS))
    2.64  
    2.65 -config.gen/cc.in: $(CC_CONFIG_FILES)
    2.66 +config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2)
    2.67  	$(call build_gen_choice_in,$@,C compiler,CC,config/cc,,$(CCS))
    2.68  
    2.69 -config.gen/libc.in: $(LIBC_CONFIG_FILES)
    2.70 +config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2)
    2.71  	$(call build_gen_choice_in,$@,C library,LIBC,config/libc,Y,$(LIBCS))
    2.72  
    2.73  config.gen/debug.in: $(DEBUG_CONFIG_FILES)
     3.1 --- a/config/kernel.in	Sun May 30 18:19:05 2010 +0200
     3.2 +++ b/config/kernel.in	Tue Jun 08 23:26:54 2010 +0200
     3.3 @@ -36,4 +36,6 @@
     3.4        You might not want shared libraries if you're building for a target that
     3.5        don't support it (maybe some nommu targets, for example, or bare metal).
     3.6  
     3.7 +source "config.gen/kernel.in.2"
     3.8 +
     3.9  endmenu
     4.1 --- a/config/libc.in	Sun May 30 18:19:05 2010 +0200
     4.2 +++ b/config/libc.in	Tue Jun 08 23:26:54 2010 +0200
     4.3 @@ -63,6 +63,8 @@
     4.4  
     4.5  endchoice
     4.6  
     4.7 +source "config.gen/libc.in.2"
     4.8 +
     4.9  endif # ! LIBC_none
    4.10  
    4.11  endmenu
     5.1 --- a/config/target.in	Sun May 30 18:19:05 2010 +0200
     5.2 +++ b/config/target.in	Tue Jun 08 23:26:54 2010 +0200
     5.3 @@ -311,4 +311,6 @@
     5.4        
     5.5        Leave blank if you don't know better.
     5.6  
     5.7 +source "config.gen/arch.in.2"
     5.8 +
     5.9  endmenu