Browse Source

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>
dev-linux
Alexey Neyman 6 years ago
parent
commit
105e4b59b7
  1. 2
      .gitignore
  2. 3
      bootstrap
  3. 4
      config/binutils.in
  4. 2
      config/cc.in
  5. 2
      config/companion_tools.in
  6. 89
      config/config.mk
  7. 2
      config/debug.in
  8. 4
      config/kernel.in
  9. 4
      config/libc.in
  10. 4
      config/target.in
  11. 49
      maintainer/gen-kconfig.sh

2
.gitignore vendored

@ -9,7 +9,7 @@ config.status
!ct-ng.in
paths.*
!paths.in
config.gen/
config/gen/
.config
# Temporaries

3
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"

4
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

2
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

2
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

89
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

2
config/debug.in

@ -1,3 +1,3 @@
menu "Debug facilities"
source "config.gen/debug.in"
source "config/gen/debug.in"
endmenu

4
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

4
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

4
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

49
scripts/gen_in_frags.sh → 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"
Loading…
Cancel
Save