2007-02-24 11:00:05 +00:00
|
|
|
# ===========================================================================
|
2007-07-02 19:40:54 +00:00
|
|
|
# crosstool-NG configuration targets
|
2007-02-24 11:00:05 +00:00
|
|
|
# These targets are used from top-level makefile
|
|
|
|
|
2007-06-01 16:55:33 +00:00
|
|
|
# Derive the project version from, well, the project version:
|
|
|
|
export PROJECTVERSION=$(CT_VERSION)
|
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
KCONFIG_TOP = config/config.in
|
2007-07-01 19:04:20 +00:00
|
|
|
obj = $(CT_TOP_DIR)/kconfig
|
2008-10-13 20:36:37 +00:00
|
|
|
PHONY += clean help oldconfig menuconfig defoldconfig
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2007-03-12 18:59:31 +00:00
|
|
|
# Darwin (MacOS-X) does not have proper libintl support
|
|
|
|
ifeq ($(shell uname -s),Darwin)
|
|
|
|
KBUILD_NO_NLS:=1
|
|
|
|
endif
|
|
|
|
|
2007-03-11 16:14:06 +00:00
|
|
|
ifneq ($(KBUILD_NO_NLS),)
|
|
|
|
CFLAGS += -DKBUILD_NO_NLS
|
|
|
|
endif
|
|
|
|
|
2007-05-17 22:10:48 +00:00
|
|
|
# Build a list of all config files
|
2008-10-09 17:40:15 +00:00
|
|
|
ARCH_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/arch/*.in)
|
2008-10-13 11:23:51 +00:00
|
|
|
KERNEL_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/kernel/*.in)
|
2008-10-13 16:58:52 +00:00
|
|
|
CC_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/cc/*.in)
|
2008-10-13 11:23:51 +00:00
|
|
|
LIBC_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/libc/*.in)
|
2008-10-09 17:40:15 +00:00
|
|
|
DEBUG_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/debug/*.in)
|
2008-10-13 11:23:51 +00:00
|
|
|
TOOL_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/tools/*.in)
|
2007-05-17 22:10:48 +00:00
|
|
|
|
2007-07-01 19:04:20 +00:00
|
|
|
STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
|
2008-10-10 14:30:44 +00:00
|
|
|
GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/arch.in \
|
|
|
|
$(CT_TOP_DIR)/config.gen/kernel.in \
|
2008-10-13 16:58:52 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen/cc.in \
|
2008-10-13 11:23:51 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen/libc.in \
|
2008-10-10 14:30:44 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen/tools.in \
|
|
|
|
$(CT_TOP_DIR)/config.gen/debug.in
|
2007-05-13 19:03:49 +00:00
|
|
|
|
2007-07-01 19:04:20 +00:00
|
|
|
CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
|
|
|
|
|
2008-09-16 17:39:40 +00:00
|
|
|
# Build list of items
|
2008-10-05 15:32:00 +00:00
|
|
|
ARCHS = $(patsubst $(CT_LIB_DIR)/config/arch/%.in,%,$(ARCH_CONFIG_FILES))
|
2008-10-09 17:40:15 +00:00
|
|
|
KERNELS = $(patsubst $(CT_LIB_DIR)/config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
|
2008-10-13 16:58:52 +00:00
|
|
|
CCS = $(patsubst $(CT_LIB_DIR)/config/cc/%.in,%,$(CC_CONFIG_FILES))
|
2008-10-13 11:23:51 +00:00
|
|
|
LIBCS = $(patsubst $(CT_LIB_DIR)/config/libc/%.in,%,$(LIBC_CONFIG_FILES))
|
2008-10-10 14:30:44 +00:00
|
|
|
DEBUGS = $(patsubst $(CT_LIB_DIR)/config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
|
|
|
|
TOOLS = $(patsubst $(CT_LIB_DIR)/config/tools/%.in,%,$(TOOL_CONFIG_FILES))
|
2008-09-16 17:39:40 +00:00
|
|
|
|
|
|
|
$(GEN_CONFIG_FILES): $(CT_TOP_DIR)/config.gen \
|
|
|
|
$(CT_LIB_DIR)/kconfig/kconfig.mk
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-09-29 20:51:16 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen: $(KCONFIG_TOP)
|
2007-07-01 19:04:20 +00:00
|
|
|
@mkdir -p $(CT_TOP_DIR)/config.gen
|
|
|
|
|
2008-10-09 17:40:15 +00:00
|
|
|
# Function build_gen_choice_in:
|
|
|
|
# $1 : destination file
|
|
|
|
# $2 : name for the entries family (eg. Architecture, kernel...)
|
|
|
|
# $3 : prefix for the choice entries (eg. ARCH, KERNEL...)
|
|
|
|
# $4 : base directory containing config files
|
|
|
|
# $5 : list of config entries (eg. for architectures: "alpha arm ia64"...,
|
|
|
|
# and for kernels: "bare-metal linux"...)
|
|
|
|
# Example to build the kernels generated config file:
|
2008-10-12 11:22:46 +00:00
|
|
|
# $(call build_gen_choice_in,config.gen/kernel.in,Target OS,KERNEL,config/kernel,$(KERNELS))
|
2008-10-09 17:40:15 +00:00
|
|
|
define build_gen_choice_in
|
|
|
|
@echo ' IN $(1)'
|
2008-10-12 11:22:46 +00:00
|
|
|
@(echo "# $(2) menu"; \
|
|
|
|
echo "# Generated file, do not edit!!!"; \
|
|
|
|
echo ""; \
|
|
|
|
echo "choice"; \
|
|
|
|
echo " bool"; \
|
|
|
|
echo " prompt \"$(2)\""; \
|
|
|
|
echo ""; \
|
|
|
|
for entry in $(5); do \
|
|
|
|
file="$(4)/$${entry}.in"; \
|
|
|
|
_entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
|
|
|
|
echo "config $(3)_$${_entry}"; \
|
|
|
|
echo " bool"; \
|
|
|
|
printf " prompt \"$${entry}"; \
|
|
|
|
if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
|
|
|
|
echo " (EXPERIMENTAL)\""; \
|
|
|
|
echo " depends on EXPERIMENTAL"; \
|
|
|
|
else \
|
|
|
|
echo "\""; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
echo ""; \
|
|
|
|
echo "endchoice"; \
|
|
|
|
for entry in $(5); do \
|
|
|
|
file="$(4)/$${entry}.in"; \
|
|
|
|
_entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
|
|
|
|
echo ""; \
|
|
|
|
echo "if $(3)_$${_entry}"; \
|
|
|
|
echo "config $(3)"; \
|
|
|
|
echo " default \"$${entry}\" if $(3)_$${_entry}"; \
|
|
|
|
echo "source $${file}"; \
|
|
|
|
echo "endif"; \
|
|
|
|
done; \
|
2008-10-09 17:40:15 +00:00
|
|
|
) >$(1)
|
|
|
|
endef
|
2008-09-16 17:39:40 +00:00
|
|
|
|
2008-10-09 17:40:15 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen/arch.in: $(ARCH_CONFIG_FILES)
|
2008-10-12 11:22:46 +00:00
|
|
|
$(call build_gen_choice_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Target Architecture,ARCH,config/arch,$(ARCHS))
|
2008-10-09 17:40:15 +00:00
|
|
|
|
|
|
|
$(CT_TOP_DIR)/config.gen/kernel.in: $(KERNEL_CONFIG_FILES)
|
2008-10-12 11:22:46 +00:00
|
|
|
$(call build_gen_choice_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Target OS,KERNEL,config/kernel,$(KERNELS))
|
2008-09-16 17:39:40 +00:00
|
|
|
|
2008-10-13 16:58:52 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen/cc.in: $(CC_CONFIG_FILES)
|
|
|
|
$(call build_gen_choice_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),C compiler,CC,config/cc,$(CCS))
|
|
|
|
|
2008-10-13 11:23:51 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen/libc.in: $(LIBC_CONFIG_FILES)
|
|
|
|
$(call build_gen_choice_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),C library,LIBC,config/libc,$(LIBCS))
|
|
|
|
|
2008-10-10 14:30:44 +00:00
|
|
|
# Function build_gen_menu_in:
|
|
|
|
# $1 : destination file
|
|
|
|
# $2 : name of entries family (eg. Tools, Debug...)
|
|
|
|
# $3 : prefix for the menu entries (eg. TOOL, DEBUG)
|
|
|
|
# $4 : base directory containing config files
|
|
|
|
# $5 : list of config entries (eg. for tools: "libelf sstrip"..., and for
|
|
|
|
# debug: "dmalloc duma gdb"...)
|
|
|
|
# Example to build the tools generated config file:
|
|
|
|
# $(call build_gen_menu_in,config.gen/tools.in,Tools,TOOL,config/tools,$(TOOLS))
|
|
|
|
define build_gen_menu_in
|
|
|
|
@echo ' IN $(1)'
|
|
|
|
@(echo "# $(2) facilities menu"; \
|
2008-09-16 17:39:40 +00:00
|
|
|
echo "# Generated file, do not edit!!!"; \
|
2008-10-10 14:30:44 +00:00
|
|
|
echo ""; \
|
|
|
|
for entry in $(5); do \
|
|
|
|
file="$(4)/$${entry}.in"; \
|
|
|
|
_entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
|
|
|
|
echo "menuconfig $(3)_$${_entry}"; \
|
|
|
|
echo " bool"; \
|
|
|
|
printf " prompt \"$${entry}"; \
|
|
|
|
if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
|
|
|
|
echo " (EXPERIMENTAL)\""; \
|
|
|
|
echo " depends on EXPERIMENTAL"; \
|
|
|
|
else \
|
|
|
|
echo "\""; \
|
|
|
|
fi; \
|
|
|
|
echo "if $(3)_$${_entry}"; \
|
|
|
|
echo "source $${file}"; \
|
|
|
|
echo "endif"; \
|
|
|
|
echo ""; \
|
2008-09-16 17:39:40 +00:00
|
|
|
done; \
|
2008-10-10 14:30:44 +00:00
|
|
|
) >$(1)
|
|
|
|
endef
|
2008-09-16 17:39:40 +00:00
|
|
|
|
2008-10-10 14:30:44 +00:00
|
|
|
$(CT_TOP_DIR)/config.gen/tools.in: $(TOOL_CONFIG_FILES)
|
|
|
|
$(call build_gen_menu_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Tools,TOOL,config/tools,$(TOOLS))
|
|
|
|
|
|
|
|
$(CT_TOP_DIR)/config.gen/debug.in: $(DEBUG_CONFIG_FILES)
|
|
|
|
$(call build_gen_menu_in,$(patsubst $(CT_TOP_DIR)/%,%,$@),Debug,DEBUG,config/debug,$(DEBUGS))
|
2008-09-16 17:39:40 +00:00
|
|
|
|
2008-10-13 20:36:37 +00:00
|
|
|
menuconfig oldconfig defoldconfig: $(KCONFIG_TOP)
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
$(KCONFIG_TOP):
|
2007-09-08 10:32:53 +00:00
|
|
|
@ln -sf $(CT_LIB_DIR)/config config
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-09-16 17:39:40 +00:00
|
|
|
menuconfig: $(CONFIG_FILES) $(obj)/mconf
|
|
|
|
@$(obj)/mconf $(KCONFIG_TOP)
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2008-09-16 17:39:40 +00:00
|
|
|
oldconfig: $(CONFIG_FILES) $(obj)/conf
|
|
|
|
@$(obj)/conf -s $(KCONFIG_TOP)
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2008-09-16 17:39:40 +00:00
|
|
|
defoldconfig: $(CONFIG_FILES) $(obj)/conf
|
|
|
|
@yes "" |$(obj)/conf -s $(KCONFIG_TOP)
|
2007-06-16 18:01:59 +00:00
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
# Help text used by make help
|
2007-06-17 16:24:23 +00:00
|
|
|
help-config::
|
2007-08-15 14:59:37 +00:00
|
|
|
@echo ' menuconfig - Update current config using a menu based program'
|
|
|
|
@echo ' oldconfig - Update current config using a provided .config as base'
|
|
|
|
@echo ' build log piped into stdin'
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
# Cheesy build
|
|
|
|
|
2007-07-22 17:44:27 +00:00
|
|
|
SHIPPED := $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2008-09-16 17:39:40 +00:00
|
|
|
$(obj)/conf $(obj)/mconf: $(obj)
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
$(obj):
|
|
|
|
@mkdir -p $(obj)
|
|
|
|
|
2008-08-30 15:23:12 +00:00
|
|
|
HEADERS = $(CT_LIB_DIR)/kconfig/expr.h \
|
|
|
|
$(CT_LIB_DIR)/kconfig/lkc.h \
|
|
|
|
$(CT_LIB_DIR)/kconfig/lkc_proto.h
|
|
|
|
|
|
|
|
FILES = $(CT_LIB_DIR)/kconfig/confdata.c \
|
|
|
|
$(CT_LIB_DIR)/kconfig/expr.c \
|
|
|
|
$(CT_LIB_DIR)/kconfig/menu.c \
|
|
|
|
$(CT_LIB_DIR)/kconfig/symbol.c \
|
|
|
|
$(CT_LIB_DIR)/kconfig/util.c
|
|
|
|
|
2008-09-16 17:39:40 +00:00
|
|
|
$(obj)/mconf: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c \
|
|
|
|
$(HEADERS) $(FILES) \
|
|
|
|
$(CT_LIB_DIR)/kconfig/kconfig.mk
|
2008-09-28 08:14:33 +00:00
|
|
|
@echo ' LD kconfig/mconf'
|
2007-07-01 19:04:20 +00:00
|
|
|
@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
|
2007-09-12 17:35:07 +00:00
|
|
|
$(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ccflags) \
|
|
|
|
$(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ldflags $(HOST_CC))
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2008-09-16 17:39:40 +00:00
|
|
|
$(obj)/conf: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c \
|
|
|
|
$(HEADERS) $(FILES) \
|
|
|
|
$(CT_LIB_DIR)/kconfig/kconfig.mk
|
2008-09-28 08:14:33 +00:00
|
|
|
@echo ' LD kconfig/conf'
|
2007-07-01 19:04:20 +00:00
|
|
|
@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
clean::
|
2007-07-01 19:04:20 +00:00
|
|
|
@rm -f $(CT_TOP_DIR)/kconfig/{,m}conf
|
2007-07-15 08:37:22 +00:00
|
|
|
@rmdir --ignore-fail-on-non-empty $(CT_TOP_DIR)/kconfig 2>/dev/null || true
|
2007-07-22 17:44:27 +00:00
|
|
|
@rm -f $(CT_TOP_DIR)/config 2>/dev/null || true
|
2007-07-01 19:04:20 +00:00
|
|
|
@rm -rf $(CT_TOP_DIR)/config.gen
|