config/config.mk
author Cody Schafer <dev@codyps.com>
Fri May 09 19:13:49 2014 -0700 (2014-05-09)
changeset 3312 4876ff97e039
parent 3123 6a5946fbc728
child 3325 069f43a215cc
permissions -rw-r--r--
cc/gcc: allow CC_EXTRA_CONFIG_ARRAY on baremetal

The final bare-metal compiler is built using the core backend.
Currently the core uses the CC_CORE_EXTRA_CONFIG_ARRAY variable.

While this works as supposed to, this can leave the user puzzled
in the menuconfig, since all he can see is the core options, not
the final options.

Only show the core options if any of the core passes are needed,
and use the final options in the core-backend if we're issuing
the bare-metal compiler.

Signed-off-by: Cody P Schafer <dev@codyps.com>
[yann.morin.1998@free.fr: hide core options if no core pass needed;
use final option in core backend if issuing the bare-metal compiler]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <22181e546ba746202489.1399688067@localhost>
Patchwork-Id: 347586
     1 # ===========================================================================
     2 # crosstool-NG genererated config files
     3 # These targets are used from top-level makefile
     4 
     5 #-----------------------------------------------------------
     6 # List all config files, wether sourced or generated
     7 
     8 # The top-level config file to be used be configurators
     9 # We need it to savedefconfig in scripts/saveSample.sh
    10 export KCONFIG_TOP = config/config.in
    11 
    12 # Build the list of all source config files
    13 STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f \( -name '*.in' -o -name '*.in.2' \) 2>/dev/null))
    14 # ... and how to access them:
    15 $(STATIC_CONFIG_FILES): config
    16 
    17 # Build a list of per-component-type source config files
    18 ARCH_CONFIG_FILES       = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
    19 ARCH_CONFIG_FILES_2     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in.2))
    20 KERNEL_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
    21 KERNEL_CONFIG_FILES_2   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))
    22 CC_CONFIG_FILES         = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
    23 CC_CONFIG_FILES_2       = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))
    24 BINUTILS_CONFIG_FILES   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/binutils/*.in))
    25 BINUTILS_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/binutils/*.in.2))
    26 LIBC_CONFIG_FILES       = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
    27 LIBC_CONFIG_FILES_2     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))
    28 DEBUG_CONFIG_FILES      = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
    29 
    30 # Build the list of generated config files
    31 GEN_CONFIG_FILES = config.gen/arch.in     \
    32                    config.gen/kernel.in   \
    33                    config.gen/cc.in       \
    34                    config.gen/binutils.in \
    35                    config.gen/libc.in     \
    36                    config.gen/debug.in
    37 # ... and how to access them:
    38 # Generated files depends on the gen_in_frags script because it has the
    39 # functions needed to build the genrated files, and thus they might need
    40 # re-generation if it changes.
    41 # They also depends on config.mk (this file) because it has the dependency
    42 # rules, and thus they might need re-generation if the deps change.
    43 $(GEN_CONFIG_FILES): config.gen                             \
    44                      $(CT_LIB_DIR)/scripts/gen_in_frags.sh  \
    45                      $(CT_LIB_DIR)/config/config.mk
    46 
    47 # Helper entry for the configurators
    48 PHONY += config_files
    49 config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
    50 
    51 # Where to access to the source config files from
    52 config:
    53 	@$(ECHO) "  LN    config"
    54 	$(SILENT)ln -s $(CT_LIB_DIR)/config config
    55 
    56 # Where to store the generated config files into
    57 config.gen:
    58 	@$(ECHO) "  MKDIR config.gen"
    59 	$(SILENT)mkdir -p config.gen
    60 
    61 #-----------------------------------------------------------
    62 # Build list of per-component-type items to easily build generated files
    63 
    64 ARCHS     = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES))
    65 KERNELS   = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
    66 CCS       = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES))
    67 BINUTILSS = $(patsubst config/binutils/%.in,%,$(BINUTILS_CONFIG_FILES))
    68 LIBCS     = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES))
    69 DEBUGS    = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
    70 
    71 #-----------------------------------------------------------
    72 # The rules for the generated config files
    73 
    74 # WARNING! If a .in file disapears between two runs, that will NOT be detected!
    75 
    76 config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2)
    77 	@$(ECHO) '  IN    $(@)'
    78 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target Architecture" "ARCH" "config/arch" "Y" $(ARCHS)
    79 
    80 config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2)
    81 	@$(ECHO) '  IN    $(@)'
    82 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target OS" "KERNEL" "config/kernel" "Y" $(KERNELS)
    83 
    84 config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2)
    85 	@$(ECHO) '  IN    $(@)'
    86 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS)
    87 
    88 config.gen/binutils.in: $(CC_BINUTILS_FILES) $(CC_BINUTILS_FILES_2)
    89 	@$(ECHO) '  IN    $(@)'
    90 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Binutils" "BINUTILS" "config/binutils" "N" $(BINUTILSS)
    91 
    92 config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2)
    93 	@$(ECHO) '  IN    $(@)'
    94 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS)
    95 
    96 config.gen/debug.in: $(DEBUG_CONFIG_FILES)
    97 	@$(ECHO) '  IN    $(@)'
    98 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Debug facilities" "DEBUG" "config/debug" $(DEBUGS)
    99 
   100 #-----------------------------------------------------------
   101 # Cleaning up the mess...
   102 
   103 clean::
   104 	@$(ECHO) "  CLEAN config"
   105 	$(SILENT)rm -f config 2>/dev/null || true
   106 	@$(ECHO) "  CLEAN config.gen"
   107 	$(SILENT)rm -rf config.gen