You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
5.1 KiB

# ===========================================================================
# crosstool-NG genererated config files
# These targets are used from top-level makefile
# List all config files, wether sourced or generated
# The top-level config file to be used be configurators
# We need it to savedefconfig in scripts/
export KCONFIG_TOP = config/
# Build the list of all source config files
STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f \( -name '*.in' -o -name '*.in.2' \) 2>/dev/null))
# ... and how to access them:
# 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)))
# Build the list of generated config files
GEN_CONFIG_FILES = config.gen/ \
config.gen/ \
config.gen/ \
config.gen/ \
config.gen/ \
# ... 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 (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/ \
# Helper entry for the configurators
PHONY += config_files
# Where to access to the source config files from
@$(ECHO) " LN config"
$(SILENT)ln -s $(CT_LIB_DIR)/config config
# Where to store the generated config files into
@$(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/,%,$(ARCH_CONFIG_FILES))
KERNELS = $(patsubst config/kernel/,%,$(KERNEL_CONFIG_FILES))
CCS = $(patsubst config/cc/,%,$(CC_CONFIG_FILES))
BINUTILSS = $(patsubst config/binutils/,%,$(BINUTILS_CONFIG_FILES))
LIBCS = $(patsubst config/libc/,%,$(LIBC_CONFIG_FILES))
DEBUGS = $(patsubst config/debug/,%,$(DEBUG_CONFIG_FILES))
# The rules for the generated config files
# WARNING! If a .in file disapears between two runs, that will NOT be detected!
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/ choice "$@" "Target Architecture" "ARCH" "config/arch" "Y" $(ARCHS)
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/ choice "$@" "Target OS" "KERNEL" "config/kernel" "Y" $(KERNELS)
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/ choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS)
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/ choice "$@" "Binutils" "BINUTILS" "config/binutils" "N" $(BINUTILSS)
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/ choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS)
config.gen/ $(DEBUG_CONFIG_FILES)
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/ menu "$@" "Debug facilities" "DEBUG" "config/debug" $(DEBUGS)
# Cleaning up the mess...
@$(ECHO) " CLEAN config"
$(SILENT)rm -f config 2>/dev/null || true
@$(ECHO) " CLEAN config.gen"
$(SILENT)rm -rf config.gen