kconfig/Makefile
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 08 17:56:13 2007 +0000 (2007-07-08)
changeset 218 7feb2fee5add
parent 213 34070d44c3c4
child 260 0b0769e5a2ab
permissions -rw-r--r--
Make distclean work again: don't try to remove a directory twice.
     1 # ===========================================================================
     2 # crosstool-NG configuration targets
     3 # These targets are used from top-level makefile
     4 
     5 # Derive the project version from, well, the project version:
     6 export PROJECTVERSION=$(CT_VERSION)
     7 
     8 KCONFIG_TOP = config/config.in
     9 obj = $(CT_TOP_DIR)/kconfig
    10 PHONY += clean help oldconfig menuconfig config defoldconfig
    11 
    12 # Darwin (MacOS-X) does not have proper libintl support
    13 ifeq ($(shell uname -s),Darwin)
    14 KBUILD_NO_NLS:=1
    15 endif
    16 
    17 ifneq ($(KBUILD_NO_NLS),)
    18 CFLAGS += -DKBUILD_NO_NLS
    19 endif
    20 
    21 # Build a list of all config files
    22 DEBUG_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/debug -type f -name '*.in')
    23 TOOLS_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/tools -type f -name '*.in')
    24 
    25 STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
    26 GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/debug.in	\
    27 				 $(CT_TOP_DIR)/config.gen/tools.in
    28 
    29 CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
    30 
    31 $(GEN_CONFIG_FILES):: $(CT_TOP_DIR)/config.gen
    32 
    33 $(CT_TOP_DIR)/config.gen:
    34 	@mkdir -p $(CT_TOP_DIR)/config.gen
    35 
    36 $(CT_TOP_DIR)/config.gen/debug.in:: $(DEBUG_CONFIG_FILES)
    37 	@echo "# Debug facilities menu" >$@
    38 	@echo "# Generated file, do not edit!!!" >>$@
    39 	@echo "menu \"Debug facilities\"" >>$@
    40 	@for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/debug/*.in)); do \
    41 	     echo "source $${f}";                                                               \
    42 	 done >>$@
    43 	@echo "endmenu" >>$@
    44 
    45 $(CT_TOP_DIR)/config.gen/tools.in:: $(TOOLS_CONFIG_FILES)
    46 	@echo "# Tools facilities menu" >$@
    47 	@echo "# Generated file, do not edit!!!" >>$@
    48 	@echo "menu \"Tools facilities\"" >>$@
    49 	@for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/tools/*.in)); do \
    50 	     echo "source $${f}";                                                               \
    51 	 done >>$@
    52 	@echo "endmenu" >>$@
    53 
    54 config menuconfig oldconfig defoldconfig:: $(KCONFIG_TOP)
    55 
    56 $(KCONFIG_TOP):
    57 	@ln -s $(CT_LIB_DIR)/config config
    58 
    59 menuconfig:: $(obj)/mconf $(CONFIG_FILES)
    60 	@$< $(KCONFIG_TOP)
    61 
    62 config:: $(obj)/conf $(CONFIG_FILES)
    63 	@$< $(KCONFIG_TOP)
    64 
    65 oldconfig:: $(obj)/conf $(CONFIG_FILES)
    66 	@$< -s $(KCONFIG_TOP)
    67 
    68 defoldconfig:: $(obj)/conf $(CONFIG_FILES)
    69 	@yes "" |$< -s $(KCONFIG_TOP) >/dev/null
    70 
    71 # Help text used by make help
    72 help-config::
    73 	@echo  '  config         - Update current config using a line-oriented program'
    74 	@echo  '  menuconfig     - Update current config using a menu based program'
    75 	@echo  '  oldconfig      - Update current config using a provided .config as base'
    76 
    77 # Cheesy build
    78 
    79 SHIPPED = $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
    80 
    81 %.c: %.c_shipped
    82 	@ln -s $(notdir $<) $@
    83 
    84 $(obj)/conf $(obj)/mconf:: $(obj)
    85 
    86 $(obj):
    87 	@mkdir -p $(obj)
    88 
    89 $(obj)/mconf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c
    90 	@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
    91 		-lcurses "-DCURSES_LOC=<ncurses.h>"
    92 
    93 $(obj)/conf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c
    94 	@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
    95 
    96 clean::
    97 	@rm -f $(CT_TOP_DIR)/kconfig/{,m}conf
    98 	@rmdir --ignore-fail-on-non-empty $(CT_TOP_DIR)/kconfig
    99 	@rm -f $(CT_TOP_DIR)/config
   100 	@rm -rf $(CT_TOP_DIR)/config.gen
   101 
   102 distclean::
   103 	@rm -f $(CT_TOP_DIR)/config