1.1 --- a/kconfig/Makefile Sun Jun 17 16:24:23 2007 +0000
1.2 +++ b/kconfig/Makefile Mon Jul 02 17:52:15 2007 +0000
1.3 @@ -6,9 +6,8 @@
1.4 export PROJECTVERSION=$(CT_VERSION)
1.5
1.6 KCONFIG_TOP = config/config.in
1.7 -obj = ./kconfig
1.8 -PHONY += clean help oldconfig menuconfig config silentoldconfig \
1.9 - randconfig allyesconfig allnoconfig allmodconfig defconfig
1.10 +obj = $(CT_TOP_DIR)/kconfig
1.11 +PHONY += clean help oldconfig menuconfig config defoldconfig
1.12
1.13 # Darwin (MacOS-X) does not have proper libintl support
1.14 ifeq ($(shell uname -s),Darwin)
1.15 @@ -20,14 +19,21 @@
1.16 endif
1.17
1.18 # Build a list of all config files
1.19 -CONFIG_FILES = $(filter-out %debug.in,$(shell find $(CT_TOP_DIR)/config -type f -name '*.in'))
1.20 -DEBUG_CONFIG_FILES = $(shell find $(CT_TOP_DIR)/config/debug -type f -name '*.in')
1.21 -TOOLS_CONFIG_FILES = $(shell find $(CT_TOP_DIR)/config/tools -type f -name '*.in')
1.22 +DEBUG_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/debug -type f -name '*.in')
1.23 +TOOLS_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/tools -type f -name '*.in')
1.24
1.25 -GEN_CONFIG_FILES=$(CT_TOP_DIR)/config/debug.in \
1.26 - $(CT_TOP_DIR)/config/tools.in
1.27 +STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
1.28 +GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/debug.in \
1.29 + $(CT_TOP_DIR)/config.gen/tools.in
1.30
1.31 -$(CT_TOP_DIR)/config/debug.in: $(DEBUG_CONFIG_FILES)
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 @@ -36,7 +42,7 @@
1.44 done >>$@
1.45 @echo "endmenu" >>$@
1.46
1.47 -$(CT_TOP_DIR)/config/tools.in: $(TOOLS_CONFIG_FILES)
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 @@ -45,16 +51,21 @@
1.53 done >>$@
1.54 @echo "endmenu" >>$@
1.55
1.56 -menuconfig: $(obj)/mconf $(GEN_CONFIG_FILES)
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 $(GEN_CONFIG_FILES)
1.66 +config:: $(obj)/conf $(CONFIG_FILES)
1.67 @$< $(KCONFIG_TOP)
1.68
1.69 -oldconfig: $(obj)/conf $(GEN_CONFIG_FILES)
1.70 +oldconfig:: $(obj)/conf $(CONFIG_FILES)
1.71 @$< -s $(KCONFIG_TOP)
1.72
1.73 -defoldconfig:$(obj)/conf $(GEN_CONFIG_FILES)
1.74 +defoldconfig:: $(obj)/conf $(CONFIG_FILES)
1.75 @yes "" |$< -s $(KCONFIG_TOP) >/dev/null
1.76
1.77 # Help text used by make help
1.78 @@ -65,18 +76,27 @@
1.79
1.80 # Cheesy build
1.81
1.82 -SHIPPED = kconfig/zconf.tab.c kconfig/lex.zconf.c kconfig/zconf.hash.c
1.83 +SHIPPED = $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
1.84
1.85 %.c: %.c_shipped
1.86 @ln -s $(notdir $<) $@
1.87
1.88 -kconfig/mconf: $(SHIPPED) kconfig/mconf.c
1.89 - @$(HOST_CC) $(CFLAGS) -o $@ kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
1.90 +$(obj)/conf $(obj)/mconf:: $(obj)
1.91 +
1.92 +$(obj):
1.93 + @mkdir -p $(obj)
1.94 +
1.95 +$(obj)/mconf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c
1.96 + @$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
1.97 -lcurses "-DCURSES_LOC=<ncurses.h>"
1.98
1.99 -kconfig/conf: $(SHIPPED) kconfig/conf.c
1.100 - @$(HOST_CC) $(CFLAGS) -o $@ kconfig/{conf.c,zconf.tab.c}
1.101 +$(obj)/conf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c
1.102 + @$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
1.103
1.104 clean::
1.105 - @rm -f $(wildcard kconfig/*zconf*.c) kconfig/{conf,mconf}
1.106 - @rm -f $(GEN_CONFIG_FILES)
1.107 + @rm -f $(CT_TOP_DIR)/kconfig/{,m}conf
1.108 + @rm -rf $(CT_TOP_DIR)/config.gen
1.109 +
1.110 +distclean::
1.111 + @rm -f $(CT_TOP_DIR)/config
1.112 + @[ $(CT_LIB_DIR) = $(CT_TOP_DIR) ] || rm -rf $(CT_TOP_DIR)/kconfig