summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-04-23 01:41:50 (GMT)
committerAlexey Neyman <stilor@att.net>2017-04-23 01:41:50 (GMT)
commit105e4b59b7989e9898795273e4064791fdfa056c (patch)
tree49624ed07ced50f36c20ac97d4390f23715d83da
parent2c0fb226419507583a736818346a7d6f07eba983 (diff)
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 <stilor@att.net>
-rw-r--r--.gitignore2
-rwxr-xr-xbootstrap3
-rw-r--r--config/binutils.in4
-rw-r--r--config/cc.in2
-rw-r--r--config/companion_tools.in2
-rw-r--r--config/config.mk89
-rw-r--r--config/debug.in2
-rw-r--r--config/kernel.in4
-rw-r--r--config/libc.in4
-rw-r--r--config/target.in4
-rwxr-xr-xmaintainer/gen-kconfig.sh (renamed from scripts/gen_in_frags.sh)49
11 files changed, 50 insertions, 115 deletions
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/scripts/gen_in_frags.sh b/maintainer/gen-kconfig.sh
index 9fbb871..4cb6567 100755
--- a/scripts/gen_in_frags.sh
+++ b/maintainer/gen-kconfig.sh
@@ -1,15 +1,21 @@
-#!/bin/sh
+#!/bin/bash
+
set -e
-# This scripts generates either a choice or a menuconfig
-# with the specified entries.
+# 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_in_frags.sh choice <out-file> <label> <config-prefix> <base-dir> <conditionals> entry [entry...]
+# gen_choice <out-file> <label> <config-prefix> <base-dir> \
+# <conditionals> entry [entry...]
#
# generate a menuconfig:
-# gen_in_frags.sh menu <out-file> <label> <config-prefix> <base-dir> entry [entry...]
+# gen_menu <out-file> <label> <config-prefix> <base-dir> \
+# entry [entry...]
#
# where:
# out-file
@@ -41,7 +47,17 @@ set -e
# linux cygwin mingw32 solaris...
# ...
#
-#------------------------------------------------------------------------------
+
+# Helper: find the base names of all *.in files in a given directory
+get_components() {
+ local dir="${1}"
+ local f b
+
+ for f in ${dir}/*.in; do
+ b=${f#${dir}/}
+ echo ${b%.in}
+ done
+}
# Generate a choice
# See above for usage
@@ -51,7 +67,6 @@ gen_choice() {
local cfg_prefix="${3}"
local base_dir="${4}"
local cond="${5}"
- shift 5
local file entry _entry
# Generate the part-1
@@ -63,7 +78,7 @@ gen_choice() {
printf ' bool\n'
printf ' prompt "%s"\n' "${label}"
printf '\n'
- for entry in "${@}"; do
+ for entry in `get_components ${base_dir}`; do
file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf 'config %s_%s\n' "${cfg_prefix}" "${_entry}"
@@ -82,7 +97,7 @@ gen_choice() {
done
printf 'endchoice\n'
- for entry in "${@}"; do
+ for entry in `get_components ${base_dir}`; do
file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf '\n'
@@ -105,7 +120,7 @@ gen_choice() {
exec >"${out_file}.2"
printf '# %s second part options\n' "${label}"
printf '# Generated file, do not edit!!!\n'
- for entry in "${@}"; do
+ for entry in `get_components ${base_dir}`; do
file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
if [ -f "${file}.2" ]; then
@@ -125,7 +140,6 @@ gen_menu() {
local label="${2}"
local cfg_prefix="${3}"
local base_dir="${4}"
- shift 4
local file entry _entry
# Generate the menuconfig
@@ -133,7 +147,7 @@ gen_menu() {
printf '# %s menu\n' "${label}"
printf '# Generated file, do not edit!!!\n'
printf '\n'
- for entry in "${@}"; do
+ for entry in `get_components ${base_dir}`; do
file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}"
@@ -156,6 +170,11 @@ gen_menu() {
done
}
-type="${1}"
-shift
-"gen_${type}" "${@}"
+mkdir -p config/gen
+gen_choice config/gen/arch.in "Target Architecture" "ARCH" "config/arch" "Y"
+gen_choice config/gen/kernel.in "Target OS" "KERNEL" "config/kernel" "Y"
+gen_choice config/gen/cc.in "Compiler" "CC" "config/cc" "N"
+gen_choice config/gen/binutils.in "Binutils" "BINUTILS" "config/binutils" "N"
+gen_choice config/gen/libc.in "C library" "LIBC" "config/libc" "Y"
+gen_menu config/gen/debug.in "Debug facilities" "DEBUG" "config/debug"
+gen_menu config/gen/companion_tools.in "Companion tools" "COMP_TOOLS" "config/companion_tools"