scripts/addToolsVersion: properly handle .in vs. .in.2
While most components have their version in the .in file, some
have it in the .in.2 (eg. elf2flt).
Currently, to handle this case, we indiscriminately munge both files,
but this is wrong: in the elf2flt case, if we add a binutils version,
we do not want it to be added to elf2flt, and conversely.
So, for each tool, we need to explicitly know what file to munge.
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
5 #-----------------------------------------------------------
6 # List all config files, wether sourced or generated
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
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
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))
30 # Build the list of generated config files
31 GEN_CONFIG_FILES = config.gen/arch.in \
32 config.gen/kernel.in \
34 config.gen/binutils.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
47 # Helper entry for the configurators
49 config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
51 # Where to access to the source config files from
54 $(SILENT)ln -s $(CT_LIB_DIR)/config config
56 # Where to store the generated config files into
58 @$(ECHO) " MKDIR config.gen"
59 $(SILENT)mkdir -p config.gen
61 #-----------------------------------------------------------
62 # Build list of per-component-type items to easily build generated files
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))
71 #-----------------------------------------------------------
72 # The rules for the generated config files
74 # WARNING! If a .in file disapears between two runs, that will NOT be detected!
76 config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2)
78 $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target Architecture" "ARCH" "config/arch" "Y" $(ARCHS)
80 config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2)
82 $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target OS" "KERNEL" "config/kernel" "Y" $(KERNELS)
84 config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2)
86 $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS)
88 config.gen/binutils.in: $(CC_BINUTILS_FILES) $(CC_BINUTILS_FILES_2)
90 $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Binutils" "BINUTILS" "config/binutils" "N" $(BINUTILSS)
92 config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2)
94 $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS)
96 config.gen/debug.in: $(DEBUG_CONFIG_FILES)
98 $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Debug facilities" "DEBUG" "config/debug" $(DEBUGS)
100 #-----------------------------------------------------------
101 # Cleaning up the mess...
104 @$(ECHO) " CLEAN config"
105 $(SILENT)rm -f config 2>/dev/null || true
106 @$(ECHO) " CLEAN config.gen"
107 $(SILENT)rm -rf config.gen