From 105e4b59b7989e9898795273e4064791fdfa056c Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sat, 22 Apr 2017 18:41:50 -0700 Subject: Get rid of config.gen Instead, prepare the files as a part of bootstrap and install them. This avoids rebuilding these files in each working directory; they don't change anyway as they are generated from the same installed source. Signed-off-by: Alexey Neyman diff --git a/.gitignore b/.gitignore index daedcdd..1bdd197 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ config.status !ct-ng.in paths.* !paths.in -config.gen/ +config/gen/ .config # Temporaries diff --git a/bootstrap b/bootstrap index 1260830..ab493dd 100755 --- a/bootstrap +++ b/bootstrap @@ -4,4 +4,7 @@ set -e printf "Running autoconf...\n" autoconf -Wall --force +printf "Generating kconfig files...\n" +./maintainer/gen-kconfig.sh + printf "Done. You may now run:\n ./configure\n" diff --git a/config/binutils.in b/config/binutils.in index 99b8b9f..0c6d5c0 100644 --- a/config/binutils.in +++ b/config/binutils.in @@ -36,7 +36,7 @@ endchoice config BINUTILS string -source "config.gen/binutils.in" -source "config.gen/binutils.in.2" +source "config/gen/binutils.in" +source "config/gen/binutils.in.2" endmenu diff --git a/config/cc.in b/config/cc.in index 5603738..81f168c 100644 --- a/config/cc.in +++ b/config/cc.in @@ -20,7 +20,7 @@ config CC_CORE_PASS_1_NEEDED config CC_CORE_PASS_2_NEEDED bool -source "config.gen/cc.in" +source "config/gen/cc.in" config CC_SUPPORT_CXX bool diff --git a/config/companion_tools.in b/config/companion_tools.in index 5291f46..e5ef3fc 100644 --- a/config/companion_tools.in +++ b/config/companion_tools.in @@ -10,6 +10,6 @@ config COMP_TOOLS_FOR_HOST tools into the final toolchain (rather than just using them to build it). -source "config.gen/companion_tools.in" +source "config/gen/companion_tools.in" endmenu diff --git a/config/config.mk b/config/config.mk index 670ecba..e0ca3d2 100644 --- a/config/config.mk +++ b/config/config.mk @@ -1,9 +1,5 @@ -# =========================================================================== -# crosstool-NG genererated config files -# These targets are used from top-level makefile - #----------------------------------------------------------- -# List all config files, wether sourced or generated +# List all config files # The top-level config file to be used be configurators # We need it to savedefconfig in scripts/saveSample.sh @@ -14,38 +10,6 @@ STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/co # ... and how to access them: $(STATIC_CONFIG_FILES): config -# Build a list of per-component-type source config files -ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/arch/*.in))) -ARCH_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/arch/*.in.2))) -KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/kernel/*.in))) -KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))) -CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/cc/*.in))) -CC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))) -BINUTILS_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/binutils/*.in))) -BINUTILS_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/binutils/*.in.2))) -LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/libc/*.in))) -LIBC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))) -DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/debug/*.in))) -COMP_TOOLS_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/companion_tools/*.in))) - -# Build the list of generated config files -GEN_CONFIG_FILES = config.gen/arch.in \ - config.gen/kernel.in \ - config.gen/cc.in \ - config.gen/binutils.in \ - config.gen/libc.in \ - config.gen/debug.in \ - config.gen/companion_tools.in -# ... and how to access them: -# Generated files depends on the gen_in_frags script because it has the -# functions needed to build the genrated files, and thus they might need -# re-generation if it changes. -# They also depends on config.mk (this file) because it has the dependency -# rules, and thus they might need re-generation if the deps change. -$(GEN_CONFIG_FILES): config.gen \ - $(CT_LIB_DIR)/scripts/gen_in_frags.sh \ - $(CT_LIB_DIR)/config/config.mk - # Helper entry for the configurators PHONY += config_files config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES) @@ -55,60 +19,9 @@ config: @$(CT_ECHO) " LN config" $(SILENT)ln -s $(CT_LIB_DIR)/config config -# Where to store the generated config files into -config.gen: - @$(CT_ECHO) " MKDIR config.gen" - $(SILENT)mkdir -p config.gen - -#----------------------------------------------------------- -# Build list of per-component-type items to easily build generated files - -ARCHS = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES)) -KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES)) -CCS = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES)) -BINUTILSS = $(patsubst config/binutils/%.in,%,$(BINUTILS_CONFIG_FILES)) -LIBCS = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES)) -DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES)) -COMP_TOOLS= $(patsubst config/companion_tools/%.in,%,$(COMP_TOOLS_CONFIG_FILES)) - -#----------------------------------------------------------- -# The rules for the generated config files - -# WARNING! If a .in file disapears between two runs, that will NOT be detected! - -config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target Architecture" "ARCH" "config/arch" "Y" $(ARCHS) - -config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target OS" "KERNEL" "config/kernel" "Y" $(KERNELS) - -config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS) - -config.gen/binutils.in: $(CC_BINUTILS_FILES) $(CC_BINUTILS_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Binutils" "BINUTILS" "config/binutils" "N" $(BINUTILSS) - -config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS) - -config.gen/debug.in: $(DEBUG_CONFIG_FILES) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Debug facilities" "DEBUG" "config/debug" $(DEBUGS) - -config.gen/companion_tools.in: $(COMP_TOOLS_CONFIG_FILES) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Companion tools" "COMP_TOOLS" "config/companion_tools" $(COMP_TOOLS) - #----------------------------------------------------------- # Cleaning up the mess... clean:: @$(CT_ECHO) " CLEAN config" $(SILENT)rm -f config 2>/dev/null || true - @$(CT_ECHO) " CLEAN config.gen" - $(SILENT)rm -rf config.gen diff --git a/config/debug.in b/config/debug.in index 9fd99ef..8fc549b 100644 --- a/config/debug.in +++ b/config/debug.in @@ -1,3 +1,3 @@ menu "Debug facilities" -source "config.gen/debug.in" +source "config/gen/debug.in" endmenu diff --git a/config/kernel.in b/config/kernel.in index 64b69c6..c04f2cb 100644 --- a/config/kernel.in +++ b/config/kernel.in @@ -22,7 +22,7 @@ config KERNEL config KERNEL_VERSION string -source "config.gen/kernel.in" +source "config/gen/kernel.in" comment "Common kernel options" @@ -37,6 +37,6 @@ config SHARED_LIBS You might not want shared libraries if you're building for a target that don't support it (maybe some nommu targets, for example, or bare metal). -source "config.gen/kernel.in.2" +source "config/gen/kernel.in.2" endmenu diff --git a/config/libc.in b/config/libc.in index 0566212..708c3b6 100644 --- a/config/libc.in +++ b/config/libc.in @@ -19,7 +19,7 @@ config LIBC_VERSION So if you want to be able to re-build your toolchain later, you will have to save your C library tarball by yourself. -source "config.gen/libc.in" +source "config/gen/libc.in" config LIBC_SUPPORT_THREADS_ANY bool @@ -123,7 +123,7 @@ config LIBC_XLDD for the native ldd. Please see the help, by running it with '--help' for more explanations. -source "config.gen/libc.in.2" +source "config/gen/libc.in.2" endif # ! LIBC_none diff --git a/config/target.in b/config/target.in index af010c0..7e4e837 100644 --- a/config/target.in +++ b/config/target.in @@ -5,7 +5,7 @@ menu "Target options" config ARCH string -source "config.gen/arch.in" +source "config/gen/arch.in" config ARCH_SUFFIX string @@ -392,6 +392,6 @@ config ARCH_FLOAT default "soft" if ARCH_FLOAT_SW default "softfp" if ARCH_FLOAT_SOFTFP -source "config.gen/arch.in.2" +source "config/gen/arch.in.2" endmenu diff --git a/maintainer/gen-kconfig.sh b/maintainer/gen-kconfig.sh new file mode 100755 index 0000000..4cb6567 --- /dev/null +++ b/maintainer/gen-kconfig.sh @@ -0,0 +1,180 @@ +#!/bin/bash + +set -e + +# Accept overrides from command line if needed +sed=${SED:-sed} +grep=${GREP:-grep} + +# Generate either a choice or a menuconfig with the specified entries. +# +# Usage: +# generate a choice: +# gen_choice