config: hide arch and kernel selection when used as a backend
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Mar 29 12:06:58 2010 +0200 (2010-03-29)
changeset 186889f16f038b92
parent 1867 dc39960ecfd2
child 1869 619a87a01562
config: hide arch and kernel selection when used as a backend

When used as a backend, it is the responsibility of the upper-layer build
system to set the target architecture and kernel.
config/config.mk
config/global/ct-behave.in
     1.1 --- a/config/config.mk	Mon Mar 29 10:03:29 2010 +0200
     1.2 +++ b/config/config.mk	Mon Mar 29 12:06:58 2010 +0200
     1.3 @@ -66,7 +66,8 @@
     1.4  # $2 : name for the entries family (eg. Architecture, kernel...)
     1.5  # $3 : prefix for the choice entries (eg. ARCH, KERNEL...)
     1.6  # $4 : base directory containing config files
     1.7 -# $5 : list of config entries (eg. for architectures: "alpha arm ia64"...,
     1.8 +# $5 : generate backend conditionals if Y, don't if anything else
     1.9 +# $6 : list of config entries (eg. for architectures: "alpha arm ia64"...,
    1.10  #      and for kernels: "bare-metal linux"...)
    1.11  # Example to build the kernels generated config file:
    1.12  # $(call build_gen_choice_in,config.gen/kernel.in,Target OS,KERNEL,config/kernel,$(KERNELS))
    1.13 @@ -79,7 +80,7 @@
    1.14  	  echo "    bool";                                                      \
    1.15  	  echo "    prompt \"$(2)\"";                                           \
    1.16  	  echo "";                                                              \
    1.17 -	  for entry in $(5); do                                                 \
    1.18 +	  for entry in $(6); do                                                 \
    1.19  	    file="$(4)/$${entry}.in";                                           \
    1.20  	    _entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;');        \
    1.21  	    echo "config $(3)_$${_entry}";                                      \
    1.22 @@ -89,10 +90,13 @@
    1.23  	    if [ -n "$${dep_val}" ]; then                                       \
    1.24  	      echo "    $${dep_val#\# }";                                       \
    1.25  	    fi;                                                                 \
    1.26 +	    if [ "$(5)" = "Y" ]; then                                           \
    1.27 +	      echo "    depends on BACKEND_$(3) = \"$${_entry}\" || ! BACKEND"; \
    1.28 +	    fi;                                                                 \
    1.29  	    echo "";                                                            \
    1.30  	  done;                                                                 \
    1.31  	  echo "endchoice";                                                     \
    1.32 -	  for entry in $(5); do                                                 \
    1.33 +	  for entry in $(6); do                                                 \
    1.34  	    file="$(4)/$${entry}.in";                                           \
    1.35  	    _entry=$$(echo "$${entry}" |$(sed) -r -s -e 's/[-.+]/_/g;');        \
    1.36  	    echo "";                                                            \
    1.37 @@ -145,16 +149,16 @@
    1.38  # The rules for the generated config files
    1.39  
    1.40  config.gen/arch.in: $(ARCH_CONFIG_FILES)
    1.41 -	$(call build_gen_choice_in,$@,Target Architecture,ARCH,config/arch,$(ARCHS))
    1.42 +	$(call build_gen_choice_in,$@,Target Architecture,ARCH,config/arch,Y,$(ARCHS))
    1.43  
    1.44  config.gen/kernel.in: $(KERNEL_CONFIG_FILES)
    1.45 -	$(call build_gen_choice_in,$@,Target OS,KERNEL,config/kernel,$(KERNELS))
    1.46 +	$(call build_gen_choice_in,$@,Target OS,KERNEL,config/kernel,Y,$(KERNELS))
    1.47  
    1.48  config.gen/cc.in: $(CC_CONFIG_FILES)
    1.49 -	$(call build_gen_choice_in,$@,C compiler,CC,config/cc,$(CCS))
    1.50 +	$(call build_gen_choice_in,$@,C compiler,CC,config/cc,,$(CCS))
    1.51  
    1.52  config.gen/libc.in: $(LIBC_CONFIG_FILES)
    1.53 -	$(call build_gen_choice_in,$@,C library,LIBC,config/libc,$(LIBCS))
    1.54 +	$(call build_gen_choice_in,$@,C library,LIBC,config/libc,,$(LIBCS))
    1.55  
    1.56  config.gen/debug.in: $(DEBUG_CONFIG_FILES)
    1.57  	$(call build_gen_menu_in,$@,Debug,DEBUG,config/debug,$(DEBUGS))
     2.1 --- a/config/global/ct-behave.in	Mon Mar 29 10:03:29 2010 +0200
     2.2 +++ b/config/global/ct-behave.in	Mon Mar 29 12:06:58 2010 +0200
     2.3 @@ -11,6 +11,22 @@
     2.4      default y if IS_A_BACKEND =  "y" || IS_A_BACKEND =  "Y"
     2.5      default n if IS_A_BACKEND != "y" && IS_A_BACKEND != "Y"
     2.6  
     2.7 +config BACKEND_ARCH
     2.8 +    string
     2.9 +    option env="CT_BACKEND_ARCH"
    2.10 +
    2.11 +if BACKEND && BACKEND_ARCH = ""
    2.12 +comment "ERROR !!! Backend architecture is NOT set !"
    2.13 +endif
    2.14 +
    2.15 +config BACKEND_KERNEL
    2.16 +    string
    2.17 +    option env="CT_BACKEND_KERNEL"
    2.18 +
    2.19 +if BACKEND && BACKEND_KERNEL = ""
    2.20 +comment "ERROR !!! Backend kernel is NOT set !"
    2.21 +endif
    2.22 +
    2.23  config OBSOLETE
    2.24      bool
    2.25      prompt "Use obsolete features"