1# ===========================================================================
2# Kernel configuration targets
3# These targets are used from top-level makefile
4
5KCONFIG_TOP = Config.in
6KCONFIG_PROJECT = ToyBox
7obj = ./kconfig
8PHONY += clean help oldconfig menuconfig config silentoldconfig \
9	randconfig allyesconfig allnoconfig allmodconfig defconfig
10
11menuconfig: $(obj)/mconf $(KCONFIG_TOP)
12	$< $(KCONFIG_TOP)
13
14config: $(obj)/conf $(KCONFIG_TOP)
15	$< $(KCONFIG_TOP)
16
17oldconfig: $(obj)/conf $(KCONFIG_TOP)
18	$< -o $(KCONFIG_TOP)
19
20silentoldconfig: $(obj)/conf $(KCONFIG_TOP)
21	$< -s $(KCONFIG_TOP)
22
23randconfig: $(obj)/conf $(KCONFIG_TOP)
24	$< -r $(KCONFIG_TOP)
25
26allyesconfig: $(obj)/conf $(KCONFIG_TOP)
27	$< -y $(KCONFIG_TOP)
28
29allnoconfig: $(obj)/conf $(KCONFIG_TOP)
30	$< -n $(KCONFIG_TOP)
31
32defconfig: $(obj)/conf $(KCONFIG_TOP)
33	$< -D /dev/null $(KCONFIG_TOP)
34
35# Help text used by make help
36help::
37	@echo  '  config	  - Update current config utilising a line-oriented program'
38	@echo  '  menuconfig	  - Update current config utilising a menu based program'
39	@echo  '  oldconfig	  - Update current config utilising a provided .config as base'
40	@echo  '  silentoldconfig - Same as oldconfig, but quietly'
41	@echo  '  randconfig	  - New config with random answer to all options'
42	@echo  '  defconfig	  - New config with default answer to all options'
43	@echo  '  allyesconfig	  - New config where all options are accepted with yes'
44	@echo  '  allnoconfig	  - New config where all options are answered with no'
45
46# Cheesy build
47
48SHIPPED = kconfig/zconf.tab.c kconfig/lex.zconf.c kconfig/zconf.hash.c
49
50%.c: %.c_shipped
51	@ln -s $(notdir $<) $@
52
53gen_config.h: .config
54
55kconfig/mconf: $(SHIPPED)
56	$(HOSTCC) -o $@ kconfig/mconf.c kconfig/zconf.tab.c \
57		kconfig/lxdialog/*.c -lcurses -DCURSES_LOC="<ncurses.h>" \
58		-DKBUILD_NO_NLS=1 -DPROJECT_NAME=\"$(KCONFIG_PROJECT)\"
59
60kconfig/conf: $(SHIPPED)
61	$(HOSTCC) -o $@ kconfig/conf.c kconfig/zconf.tab.c -DKBUILD_NO_NLS=1 \
62		-DPROJECT_NAME=\"$(KCONFIG_PROJECT)\"
63
64clean::
65	rm -f $(wildcard kconfig/*zconf*.c) kconfig/conf kconfig/mconf
66