Autogenerate the architecture selection choice menu.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jun 27 13:58:53 2008 +0000 (2008-06-27)
changeset 62887802cb25a0f
parent 627 17a57be570a5
child 629 5a01c5cb8516
Autogenerate the architecture selection choice menu.
Update architectures definition files accordingly.
Update documentation accordingly.
Use makefile syntax when listing arch/, tools/ and debug/ config files.

/trunk/kconfig/kconfig.mk | 32 29 3 0 +++++++++++++++--
/trunk/docs/overview.txt | 75 67 8 0 +++++++++++++++++++++++++++++++++++----
/trunk/config/target.in | 94 16 78 0 ++++++++-----------------------------------------
/trunk/arch/arm/config.in | 6 5 1 0 +++
/trunk/arch/powerpc/config.in | 2 2 0 0 +
/trunk/arch/ia64/config.in | 4 4 0 0 ++
/trunk/arch/alpha/config.in | 2 1 1 0
/trunk/arch/x86/config.in | 3 3 0 0 ++
/trunk/arch/mips/config.in | 5 5 0 0 +++
/trunk/arch/sh/config.in | 4 3 1 0 ++
/trunk/arch/x86_64/config.in | 3 3 0 0 ++
11 files changed, 138 insertions(+), 92 deletions(-)
arch/alpha/config.in
arch/alpha/experimental
arch/arm/config.in
arch/ia64/config.in
arch/ia64/experimental
arch/mips/config.in
arch/powerpc/config.in
arch/powerpc/experimental
arch/sh/config.in
arch/sh/experimental
arch/x86/config.in
arch/x86_64/config.in
config/target.in
docs/overview.txt
kconfig/kconfig.mk
     1.1 --- a/arch/alpha/config.in	Fri Jun 27 11:19:12 2008 +0000
     1.2 +++ b/arch/alpha/config.in	Fri Jun 27 13:58:53 2008 +0000
     1.3 @@ -1,6 +1,6 @@
     1.4  # Alpha specific configuration file
     1.5  
     1.6 -comment "Alpha specific configuration"
     1.7 +config ARCH_alpha
     1.8  
     1.9  choice
    1.10      bool
     2.1 --- a/arch/arm/config.in	Fri Jun 27 11:19:12 2008 +0000
     2.2 +++ b/arch/arm/config.in	Fri Jun 27 13:58:53 2008 +0000
     2.3 @@ -1,4 +1,8 @@
     2.4 -comment "ARM specific options"
     2.5 +# ARM specific configuration file
     2.6 +
     2.7 +config ARCH_arm
     2.8 +    select ARCH_SUPPORTS_BOTH_ENDIAN
     2.9 +    select ARCH_DEFAULT_LE
    2.10  
    2.11  config ARCH_ARM_EABI
    2.12      bool
     3.1 --- a/arch/ia64/config.in	Fri Jun 27 11:19:12 2008 +0000
     3.2 +++ b/arch/ia64/config.in	Fri Jun 27 13:58:53 2008 +0000
     3.3 @@ -0,0 +1,4 @@
     3.4 +# ia64 specific config options
     3.5 +
     3.6 +config ARCH_ia64
     3.7 +    select ARCH_SUPPORTS_BOTH_ENDIAN
     4.1 --- a/arch/mips/config.in	Fri Jun 27 11:19:12 2008 +0000
     4.2 +++ b/arch/mips/config.in	Fri Jun 27 13:58:53 2008 +0000
     4.3 @@ -0,0 +1,5 @@
     4.4 +# MIPS specific config options
     4.5 +
     4.6 +config ARCH_mips
     4.7 +    select ARCH_SUPPORTS_BOTH_ENDIAN
     4.8 +    select ARCH_DEFAULT_BE
     5.1 --- a/arch/powerpc/config.in	Fri Jun 27 11:19:12 2008 +0000
     5.2 +++ b/arch/powerpc/config.in	Fri Jun 27 13:58:53 2008 +0000
     5.3 @@ -1,1 +1,3 @@
     5.4  # powerpc specific configuration file
     5.5 +
     5.6 +config ARCH_powerpc
     6.1 --- a/arch/sh/config.in	Fri Jun 27 11:19:12 2008 +0000
     6.2 +++ b/arch/sh/config.in	Fri Jun 27 13:58:53 2008 +0000
     6.3 @@ -1,6 +1,8 @@
     6.4  # Super-H specific configuration file
     6.5  
     6.6 -comment "Super-H specific configuration"
     6.7 +config ARCH_sh
     6.8 +    select ARCH_SUPPORTS_BOTH_ENDIAN
     6.9 +    select ARCH_DEFAULT_LE
    6.10  
    6.11  choice
    6.12      bool
     7.1 --- a/arch/x86/config.in	Fri Jun 27 11:19:12 2008 +0000
     7.2 +++ b/arch/x86/config.in	Fri Jun 27 13:58:53 2008 +0000
     7.3 @@ -0,0 +1,3 @@
     7.4 +# x86 specific options
     7.5 +
     7.6 +config ARCH_x86
     8.1 --- a/arch/x86_64/config.in	Fri Jun 27 11:19:12 2008 +0000
     8.2 +++ b/arch/x86_64/config.in	Fri Jun 27 13:58:53 2008 +0000
     8.3 @@ -0,0 +1,3 @@
     8.4 +# x86_64 specific options
     8.5 +
     8.6 +config ARCH_x86_64
     9.1 --- a/config/target.in	Fri Jun 27 11:19:12 2008 +0000
     9.2 +++ b/config/target.in	Fri Jun 27 13:58:53 2008 +0000
     9.3 @@ -2,65 +2,29 @@
     9.4  
     9.5  menu "Target options"
     9.6  
     9.7 -comment "General target options"
     9.8 -
     9.9  config ARCH
    9.10      string
    9.11 -    default "alpha"   if ARCH_ALPHA
    9.12 -    default "arm"     if ARCH_ARM
    9.13 -    default "ia64"    if ARCH_IA64
    9.14 -    default "mips"    if ARCH_MIPS
    9.15 -    default "powerpc" if ARCH_PPC
    9.16 -    default "sh"      if ARCH_SH
    9.17 -    default "x86"     if ARCH_x86
    9.18 -    default "x86_64"  if ARCH_x86_64
    9.19 +
    9.20 +# Pre-declare target optimisation variables
    9.21 +config ARCH_ARCH
    9.22 +config ARCH_ABI
    9.23 +config ARCH_CPU
    9.24 +config ARCH_TUNE
    9.25 +config ARCH_FPU
    9.26 +config ARCH_SUPPORTS_BOTH_ENDIAN
    9.27 +config ARCH_DEFAULT_BE
    9.28 +config ARCH_DEFAULT_LE
    9.29 +config ARCH_FLOAT_HW
    9.30 +config ARCH_FLOAT_SW
    9.31 +config TARGET_CFLAGS
    9.32 +
    9.33 +comment "General target options"
    9.34  
    9.35  choice
    9.36      bool
    9.37      prompt "Target architecture:"
    9.38 -    default ARCH_x86
    9.39  
    9.40 -config ARCH_ALPHA
    9.41 -    bool
    9.42 -    prompt "alpha (EXPERIMENTAL)"
    9.43 -    depends on EXPERIMENTAL
    9.44 -
    9.45 -config ARCH_ARM
    9.46 -    bool
    9.47 -    prompt "arm"
    9.48 -    select ARCH_SUPPORTS_BOTH_ENDIAN
    9.49 -    select ARCH_DEFAULT_LE
    9.50 -
    9.51 -config ARCH_IA64
    9.52 -    bool
    9.53 -    prompt "ia64 (EXPERIMENTAL)"
    9.54 -    depends on EXPERIMENTAL
    9.55 -    select ARCH_SUPPORTS_BOTH_ENDIAN
    9.56 -
    9.57 -config ARCH_MIPS
    9.58 -    bool
    9.59 -    prompt "mips"
    9.60 -    select ARCH_SUPPORTS_BOTH_ENDIAN
    9.61 -    select ARCH_DEFAULT_BE
    9.62 -
    9.63 -config ARCH_PPC
    9.64 -    bool
    9.65 -    prompt "powerpc"
    9.66 -
    9.67 -config ARCH_SH
    9.68 -    bool
    9.69 -    prompt "sh (EXPERIMENTAL)"
    9.70 -    depends on EXPERIMENTAL
    9.71 -    select ARCH_SUPPORTS_BOTH_ENDIAN
    9.72 -    select ARCH_DEFAULT_LE
    9.73 -
    9.74 -config ARCH_x86
    9.75 -    bool
    9.76 -    prompt "x86"
    9.77 -
    9.78 -config ARCH_x86_64
    9.79 -    bool
    9.80 -    prompt "x86_64"
    9.81 +source config.gen/arch.in
    9.82  
    9.83  endchoice
    9.84  
    9.85 @@ -93,32 +57,6 @@
    9.86  
    9.87  endchoice
    9.88  
    9.89 -# Include architecture-specific configuration
    9.90 -if ARCH_ALPHA
    9.91 -source config/arch/alpha/config.in
    9.92 -endif
    9.93 -if ARCH_ARM
    9.94 -source config/arch/arm/config.in
    9.95 -endif
    9.96 -if ARCH_IA64
    9.97 -source config/arch/ia64/config.in
    9.98 -endif
    9.99 -if ARCH_MIPS
   9.100 -source config/arch/mips/config.in
   9.101 -endif
   9.102 -if ARCH_PPC
   9.103 -source config/arch/powerpc/config.in
   9.104 -endif
   9.105 -if ARCH_SH
   9.106 -source config/arch/sh/config.in
   9.107 -endif
   9.108 -if ARCH_x86
   9.109 -source config/arch/x86/config.in
   9.110 -endif
   9.111 -if ARCH_x86_64
   9.112 -source config/arch/x86_64/config.in
   9.113 -endif
   9.114 -
   9.115  comment "Target optimisations"
   9.116  
   9.117  config ARCH_ARCH
    10.1 --- a/docs/overview.txt	Fri Jun 27 11:19:12 2008 +0000
    10.2 +++ b/docs/overview.txt	Fri Jun 27 13:58:53 2008 +0000
    10.3 @@ -3,6 +3,34 @@
    10.4  Copyrigth....: (C) 2007 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
    10.5  License......: Creative Commons Attribution Share Alike (CC-by-sa), v2.5
    10.6  
    10.7 +____________________
    10.8 +                   /
    10.9 +Table Of Content  /
   10.10 +_________________/
   10.11 +
   10.12 +
   10.13 +Introduction
   10.14 +History
   10.15 +Installing crosstool-NG
   10.16 +  Install method
   10.17 +  The hacker's way
   10.18 +  Contributed code
   10.19 +Configuring crosstool-NG
   10.20 +  Interesting config options
   10.21 +  Re-building an existing toolchain
   10.22 +Running crosstool-NG
   10.23 +  Stopping and restarting a build
   10.24 +  Testing all toolchains at once
   10.25 +  Overriding the number of // jobs
   10.26 +Using the toolchain
   10.27 +Toolchain types
   10.28 +Internals
   10.29 +  Makefile front-end
   10.30 +  Kconfig parser
   10.31 +  Architecture-specific
   10.32 +  Adding a new version of a component
   10.33 +  Build scripts
   10.34 +
   10.35  ________________
   10.36                 /
   10.37  Introduction  /
   10.38 @@ -492,19 +520,50 @@
   10.39  Architecture-specific |
   10.40  ----------------------+
   10.41  
   10.42 +Note: this chapter is not really well written, and might thus be a little bit
   10.43 +complex to understand. To get a better grasp of what an architecture is, the
   10.44 +reader is kindly encouraged to look at the "arch/" sub-directory, and to the
   10.45 +existing architectures to see how things are laid out.
   10.46 +
   10.47  An architecture is defined by:
   10.48  
   10.49   - a human-readable name, in lower case letters, with numbers as appropriate.
   10.50 -   The underscore is allowed. Eg.: arm, x86_64
   10.51 - - a boolean kconfig option named after the architecture (in capital letters
   10.52 -   if possible) prefixed with "ARCH_". Eg.: ARCH_ARM, ARCH_x86_64
   10.53 +   The underscore is allowed; space and special characters are not.
   10.54 +     Eg.: arm, x86_64
   10.55   - a directory in "arch/" named after the architecture, with the same letters
   10.56     as above. Eg.: arch/arm, arch/x86_64
   10.57 -   This directory contains:
   10.58 -   - a configuration file in kconfig syntax, named "config.in", which may be
   10.59 -     empty. Eg.: arch/arm/config.in
   10.60 +   This directory contains the following files, and only those files:
   10.61 +   - a configuration file in kconfig syntax, named "config.in", which shall
   10.62 +     follow the API defined below.
   10.63 +       Eg.: arch/arm/config.in
   10.64     - a function script in bash-3.0 syntax, named "functions", which shall
   10.65 -     follow the API defined below. Eg.: arch/arm/functions
   10.66 +     follow the API defined below.
   10.67 +       Eg.: arch/arm/functions
   10.68 +   - an optional file, named "experimental" (in lower case!), which, if it
   10.69 +     is present, means that support for this architecture is EXPERIMENTAL.
   10.70 +       Eg.: arch/arm/experimental
   10.71 +
   10.72 +The "config.in" file API:
   10.73 + > the config option "ARCH_%arch%" (where %arch% is to be replaced with the
   10.74 +   actual architecture name).
   10.75 +   That config option must have *neither* a type, *nor* a prompt! Also, it can
   10.76 +   *not* depend on any other config option (EXPERIMENTAL is managed as above).
   10.77 +     Eg.:
   10.78 +       config ARCH_arm
   10.79 +   + optional:
   10.80 +       selects adequate associated config options.
   10.81 +       Eg.:
   10.82 +         config ARCH_arm
   10.83 +           select ARCH_SUPPORTS_BOTH_ENDIAN
   10.84 +           select ARCH_DEFAULT_LE
   10.85 +
   10.86 + > other target-specific options, at your discretion. Note however that to
   10.87 +   avoid name-clashing, such options shall be prefixed with "ARCH_%arch%",
   10.88 +   where %arch% is again replaced by the actual architecture name.
   10.89 +   (Note: due to historical reasons, and lack of time to clean up the code,
   10.90 +    I may have left some config options that do not completely conform to
   10.91 +    this, as the architecture name was written all upper case. However, the
   10.92 +    prefix is unique among architectures, and does not cause harm).
   10.93  
   10.94  The "functions" file API:
   10.95   > the function "CT_DoArchValues"
   10.96 @@ -578,7 +637,7 @@
   10.97         - CT_ARCH_ENDIAN_CFLAG : the gcc switch to choose big or little endian                   ( "-mbig-endian" or "-mlittle-endian" )
   10.98       - default to:
   10.99         see above.
  10.100 -     
  10.101 +
  10.102  Adding a new version of a component |
  10.103  ------------------------------------+
  10.104  
    11.1 --- a/kconfig/kconfig.mk	Fri Jun 27 11:19:12 2008 +0000
    11.2 +++ b/kconfig/kconfig.mk	Fri Jun 27 13:58:53 2008 +0000
    11.3 @@ -19,11 +19,14 @@
    11.4  endif
    11.5  
    11.6  # Build a list of all config files
    11.7 -DEBUG_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/debug -type f -name '*.in')
    11.8 -TOOLS_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/tools -type f -name '*.in')
    11.9 +ARCHS              = $(patsubst $(CT_LIB_DIR)/arch/%,%,$(wildcard $(CT_LIB_DIR)/arch/*))
   11.10 +ARCH_CONFIG_FILE   = $(wildcard $(CT_LIB_DIR)/arch/*/*.in)
   11.11 +DEBUG_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/debug/*.in)
   11.12 +TOOLS_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/tools/*.in)
   11.13  
   11.14  STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
   11.15 -GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/debug.in	\
   11.16 +GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/arch.in	\
   11.17 +				 $(CT_TOP_DIR)/config.gen/debug.in	\
   11.18  				 $(CT_TOP_DIR)/config.gen/tools.in
   11.19  
   11.20  CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
   11.21 @@ -33,6 +36,29 @@
   11.22  $(CT_TOP_DIR)/config.gen:
   11.23  	@mkdir -p $(CT_TOP_DIR)/config.gen
   11.24  
   11.25 +$(CT_TOP_DIR)/config.gen/arch.in:: $(ARCH_CONFIG_FILES)
   11.26 +	@(echo "# Architectures menu";                                              \
   11.27 +	  echo "# Generated file, do not edit!!!";                                  \
   11.28 +	  echo "";                                                                  \
   11.29 +	  for arch in $(ARCHS); do                                                  \
   11.30 +	    echo "config ARCH_$${arch}";                                            \
   11.31 +	    echo "    bool";                                                        \
   11.32 +	    echo -n "    prompt \"$${arch}";                                        \
   11.33 +	    if [ -f $(CT_LIB_DIR)/arch/$${arch}/experimental ]; then                \
   11.34 +	      echo " (EXPERIMENTAL)\"";                                             \
   11.35 +	      echo "    depends on EXPERIMENTAL";                                   \
   11.36 +	    else                                                                    \
   11.37 +	      echo "\"";                                                            \
   11.38 +	    fi;                                                                     \
   11.39 +	    echo "if ARCH_$${arch}";                                                \
   11.40 +	    echo "config ARCH";                                                     \
   11.41 +	    echo "    default \"$${arch}\" if ARCH_$${arch}";                       \
   11.42 +	    echo "source config/arch/$${arch}/config.in";                           \
   11.43 +	    echo "endif";                                                           \
   11.44 +	    echo "";                                                                \
   11.45 +	  done;                                                                     \
   11.46 +	) >$@
   11.47 +
   11.48  $(CT_TOP_DIR)/config.gen/debug.in:: $(DEBUG_CONFIG_FILES)
   11.49  	@echo "# Debug facilities menu" >$@
   11.50  	@echo "# Generated file, do not edit!!!" >>$@