config/config.mk
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Tue Jul 31 22:27:29 2012 +0200 (2012-07-31)
changeset 3018 7776e8369284
parent 2537 95d470b5a6a9
child 3123 6a5946fbc728
permissions -rw-r--r--
complibs/cloog: create missing m4 dir

Because we now patch configure.in and configure, the Makefile quicks
in a re-build rule as the source files are now more recent than the
bundled generated files, and that fails because the m4 directory
is missing, although on some systems where aclocal is not installed,
the re-build rule does nothing (except a warning).

Always create tht directory.

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