config/config.mk
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 03 22:57:25 2012 +0100 (2012-01-03)
changeset 2936 2dfea349d307
parent 2529 7e191964d8f2
child 2981 80151a249b85
permissions -rw-r--r--
cc/gcc: build core compilers for canadian

Currently, we rely on an existing external cross-compiler targetting
the target, to build the C library.

This can pause quite a few problems if that compiler is different from
the one we are building, because it could introduce some ABI issues.

This patch removes this dependency, by building the core compilers
as we do for standard cross, and also by building the binutils and
gcc, for running on the build machine.

This means we no longer need to offer the cross-sompiler selection in
the menuconfig.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     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 KCONFIG_TOP = config/config.in
    10 
    11 # Build the list of all source config files
    12 STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f \( -name '*.in' -o -name '*.in.2' \) 2>/dev/null))
    13 # ... and how to access them:
    14 $(STATIC_CONFIG_FILES): config
    15 
    16 # Build a list of per-component-type source config files
    17 ARCH_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
    18 ARCH_CONFIG_FILES_2   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in.2))
    19 KERNEL_CONFIG_FILES   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
    20 KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))
    21 CC_CONFIG_FILES       = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
    22 CC_CONFIG_FILES_2     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))
    23 LIBC_CONFIG_FILES     = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
    24 LIBC_CONFIG_FILES_2   = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))
    25 DEBUG_CONFIG_FILES    = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
    26 
    27 # Build the list of generated config files
    28 GEN_CONFIG_FILES = config.gen/arch.in     \
    29                    config.gen/kernel.in   \
    30                    config.gen/cc.in       \
    31                    config.gen/libc.in     \
    32                    config.gen/debug.in
    33 # ... and how to access them:
    34 # Generated files depends on the gen_in_frags script because it has the
    35 # functions needed to build the genrated files, and thus they might need
    36 # re-generation if it changes.
    37 # They also depends on config.mk (this file) because it has the dependency
    38 # rules, and thus they might need re-generation if the deps change.
    39 $(GEN_CONFIG_FILES): config.gen                             \
    40                      $(CT_LIB_DIR)/scripts/gen_in_frags.sh  \
    41                      $(CT_LIB_DIR)/config/config.mk
    42 
    43 # Helper entry for the configurators
    44 PHONY += config_files
    45 config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
    46 
    47 # Where to access to the source config files from
    48 config:
    49 	@$(ECHO) "  LN    config"
    50 	$(SILENT)ln -s $(CT_LIB_DIR)/config config
    51 
    52 # Where to store the generated config files into
    53 config.gen:
    54 	@$(ECHO) "  MKDIR config.gen"
    55 	$(SILENT)mkdir -p config.gen
    56 
    57 #-----------------------------------------------------------
    58 # Build list of per-component-type items to easily build generated files
    59 
    60 ARCHS   = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES))
    61 KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
    62 CCS     = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES))
    63 LIBCS   = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES))
    64 DEBUGS  = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
    65 
    66 #-----------------------------------------------------------
    67 # The rules for the generated config files
    68 
    69 # WARNING! If a .in file disapears between two runs, that will NOT be detected!
    70 
    71 config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2)
    72 	@$(ECHO) '  IN    $(@)'
    73 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target Architecture" "ARCH" "config/arch" "Y" $(ARCHS)
    74 
    75 config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2)
    76 	@$(ECHO) '  IN    $(@)'
    77 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target OS" "KERNEL" "config/kernel" "Y" $(KERNELS)
    78 
    79 config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2)
    80 	@$(ECHO) '  IN    $(@)'
    81 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS)
    82 
    83 config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2)
    84 	@$(ECHO) '  IN    $(@)'
    85 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS)
    86 
    87 config.gen/debug.in: $(DEBUG_CONFIG_FILES)
    88 	@$(ECHO) '  IN    $(@)'
    89 	$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Debug facilities" "DEBUG" "config/debug" $(DEBUGS)
    90 
    91 #-----------------------------------------------------------
    92 # Cleaning up the mess...
    93 
    94 clean::
    95 	@$(ECHO) "  CLEAN config"
    96 	$(SILENT)rm -f config 2>/dev/null || true
    97 	@$(ECHO) "  CLEAN config.gen"
    98 	$(SILENT)rm -rf config.gen