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