kconfig/kconfig.mk
changeset 261 4b8cba298bf3
parent 260 0b0769e5a2ab
child 276 835178a32fc1
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/kconfig/kconfig.mk	Sun Jul 15 09:09:04 2007 +0000
     1.3 @@ -0,0 +1,103 @@
     1.4 +# ===========================================================================
     1.5 +# crosstool-NG configuration targets
     1.6 +# These targets are used from top-level makefile
     1.7 +
     1.8 +# Derive the project version from, well, the project version:
     1.9 +export PROJECTVERSION=$(CT_VERSION)
    1.10 +
    1.11 +KCONFIG_TOP = config/config.in
    1.12 +obj = $(CT_TOP_DIR)/kconfig
    1.13 +PHONY += clean help oldconfig menuconfig config defoldconfig
    1.14 +
    1.15 +# Darwin (MacOS-X) does not have proper libintl support
    1.16 +ifeq ($(shell uname -s),Darwin)
    1.17 +KBUILD_NO_NLS:=1
    1.18 +endif
    1.19 +
    1.20 +ifneq ($(KBUILD_NO_NLS),)
    1.21 +CFLAGS += -DKBUILD_NO_NLS
    1.22 +endif
    1.23 +
    1.24 +# Build a list of all config files
    1.25 +DEBUG_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/debug -type f -name '*.in')
    1.26 +TOOLS_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/tools -type f -name '*.in')
    1.27 +
    1.28 +STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
    1.29 +GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/debug.in	\
    1.30 +				 $(CT_TOP_DIR)/config.gen/tools.in
    1.31 +
    1.32 +CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
    1.33 +
    1.34 +$(GEN_CONFIG_FILES):: $(CT_TOP_DIR)/config.gen
    1.35 +
    1.36 +$(CT_TOP_DIR)/config.gen:
    1.37 +	@mkdir -p $(CT_TOP_DIR)/config.gen
    1.38 +
    1.39 +$(CT_TOP_DIR)/config.gen/debug.in:: $(DEBUG_CONFIG_FILES)
    1.40 +	@echo "# Debug facilities menu" >$@
    1.41 +	@echo "# Generated file, do not edit!!!" >>$@
    1.42 +	@echo "menu \"Debug facilities\"" >>$@
    1.43 +	@for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/debug/*.in)); do \
    1.44 +	     echo "source $${f}";                                                               \
    1.45 +	 done >>$@
    1.46 +	@echo "endmenu" >>$@
    1.47 +
    1.48 +$(CT_TOP_DIR)/config.gen/tools.in:: $(TOOLS_CONFIG_FILES)
    1.49 +	@echo "# Tools facilities menu" >$@
    1.50 +	@echo "# Generated file, do not edit!!!" >>$@
    1.51 +	@echo "menu \"Tools facilities\"" >>$@
    1.52 +	@for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/tools/*.in)); do \
    1.53 +	     echo "source $${f}";                                                               \
    1.54 +	 done >>$@
    1.55 +	@echo "endmenu" >>$@
    1.56 +
    1.57 +config menuconfig oldconfig defoldconfig:: $(KCONFIG_TOP)
    1.58 +
    1.59 +$(KCONFIG_TOP):
    1.60 +	@ln -s $(CT_LIB_DIR)/config config
    1.61 +
    1.62 +menuconfig:: $(obj)/mconf $(CONFIG_FILES)
    1.63 +	@$< $(KCONFIG_TOP)
    1.64 +
    1.65 +config:: $(obj)/conf $(CONFIG_FILES)
    1.66 +	@$< $(KCONFIG_TOP)
    1.67 +
    1.68 +oldconfig:: $(obj)/conf $(CONFIG_FILES)
    1.69 +	@$< -s $(KCONFIG_TOP)
    1.70 +
    1.71 +defoldconfig:: $(obj)/conf $(CONFIG_FILES)
    1.72 +	@yes "" |$< -s $(KCONFIG_TOP) >/dev/null
    1.73 +
    1.74 +# Help text used by make help
    1.75 +help-config::
    1.76 +	@echo  '  config         - Update current config using a line-oriented program'
    1.77 +	@echo  '  menuconfig     - Update current config using a menu based program'
    1.78 +	@echo  '  oldconfig      - Update current config using a provided .config as base'
    1.79 +
    1.80 +# Cheesy build
    1.81 +
    1.82 +SHIPPED = $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
    1.83 +
    1.84 +%.c: %.c_shipped
    1.85 +	@ln -s $(notdir $<) $@
    1.86 +
    1.87 +$(obj)/conf $(obj)/mconf:: $(obj)
    1.88 +
    1.89 +$(obj):
    1.90 +	@mkdir -p $(obj)
    1.91 +
    1.92 +$(obj)/mconf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c
    1.93 +	@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
    1.94 +		-lcurses "-DCURSES_LOC=<ncurses.h>"
    1.95 +
    1.96 +$(obj)/conf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c
    1.97 +	@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
    1.98 +
    1.99 +clean::
   1.100 +	@rm -f $(CT_TOP_DIR)/kconfig/{,m}conf
   1.101 +	@rmdir --ignore-fail-on-non-empty $(CT_TOP_DIR)/kconfig 2>/dev/null || true
   1.102 +	@rm -f $(CT_TOP_DIR)/config
   1.103 +	@rm -rf $(CT_TOP_DIR)/config.gen
   1.104 +
   1.105 +distclean::
   1.106 +	@rm -f $(CT_TOP_DIR)/config