10f66f451Sopenharmony_ci# ===========================================================================
20f66f451Sopenharmony_ci# Kernel configuration targets
30f66f451Sopenharmony_ci# These targets are used from top-level makefile
40f66f451Sopenharmony_ci
50f66f451Sopenharmony_ciKCONFIG_TOP = Config.in
60f66f451Sopenharmony_ciKCONFIG_PROJECT = ToyBox
70f66f451Sopenharmony_ciobj = ./kconfig
80f66f451Sopenharmony_ciPHONY += clean help oldconfig menuconfig config silentoldconfig \
90f66f451Sopenharmony_ci	randconfig allyesconfig allnoconfig allmodconfig defconfig
100f66f451Sopenharmony_ci
110f66f451Sopenharmony_cimenuconfig: $(obj)/mconf $(KCONFIG_TOP)
120f66f451Sopenharmony_ci	$< $(KCONFIG_TOP)
130f66f451Sopenharmony_ci
140f66f451Sopenharmony_ciconfig: $(obj)/conf $(KCONFIG_TOP)
150f66f451Sopenharmony_ci	$< $(KCONFIG_TOP)
160f66f451Sopenharmony_ci
170f66f451Sopenharmony_cioldconfig: $(obj)/conf $(KCONFIG_TOP)
180f66f451Sopenharmony_ci	$< -o $(KCONFIG_TOP)
190f66f451Sopenharmony_ci
200f66f451Sopenharmony_cisilentoldconfig: $(obj)/conf $(KCONFIG_TOP)
210f66f451Sopenharmony_ci	yes | $< -o $(KCONFIG_TOP) > /dev/null
220f66f451Sopenharmony_ci
230f66f451Sopenharmony_cirandconfig: $(obj)/conf $(KCONFIG_TOP)
240f66f451Sopenharmony_ci	$< -r $(KCONFIG_TOP) > /dev/null
250f66f451Sopenharmony_ci
260f66f451Sopenharmony_ciallyesconfig: $(obj)/conf $(KCONFIG_TOP)
270f66f451Sopenharmony_ci	$< -y $(KCONFIG_TOP) > /dev/null
280f66f451Sopenharmony_ci
290f66f451Sopenharmony_ciallnoconfig: $(obj)/conf $(KCONFIG_TOP)
300f66f451Sopenharmony_ci	$< -n $(KCONFIG_TOP) > /dev/null
310f66f451Sopenharmony_ci
320f66f451Sopenharmony_cidefconfig: $(obj)/conf $(KCONFIG_TOP)
330f66f451Sopenharmony_ci	$< -D /dev/null $(KCONFIG_TOP) > /dev/null
340f66f451Sopenharmony_ci
350f66f451Sopenharmony_cimacos_defconfig: $(obj)/conf $(KCONFIG_TOP)
360f66f451Sopenharmony_ci	KCONFIG_ALLCONFIG=$(obj)/macos_miniconfig $< -n $(KCONFIG_TOP) > /dev/null
370f66f451Sopenharmony_ci
380f66f451Sopenharmony_cibsd_defconfig: $(obj)/conf $(KCONFIG_TOP)
390f66f451Sopenharmony_ci	KCONFIG_ALLCONFIG=$(obj)/freebsd_miniconfig $< -n $(KCONFIG_TOP) > /dev/null
400f66f451Sopenharmony_ci
410f66f451Sopenharmony_ci# Help text used by make help
420f66f451Sopenharmony_cihelp::
430f66f451Sopenharmony_ci	@echo  '  config	  - Update current config utilising a line-oriented program'
440f66f451Sopenharmony_ci	@echo  '  menuconfig	  - Update current config utilising a menu based program'
450f66f451Sopenharmony_ci	@echo  '  oldconfig	  - Update current config utilising a provided .config as base'
460f66f451Sopenharmony_ci	@echo  '  silentoldconfig - Same as oldconfig, but quietly'
470f66f451Sopenharmony_ci	@echo  '  randconfig	  - New config with random answer to all options'
480f66f451Sopenharmony_ci	@echo  '  defconfig	  - New config with default answer to all options'
490f66f451Sopenharmony_ci	@echo  '                    This is the maximum sane configuration.'
500f66f451Sopenharmony_ci	@echo  '  allyesconfig	  - New config where all options are accepted with yes'
510f66f451Sopenharmony_ci	@echo  "                    This may not actually compile, it's a starting point"
520f66f451Sopenharmony_ci	@echo  '                    for further configuration (probably with menuconfig)'
530f66f451Sopenharmony_ci	@echo  '  allnoconfig	  - New config where all options are answered with no'
540f66f451Sopenharmony_ci	@echo  '                    (NOP binary, starting point for further configuration)'
550f66f451Sopenharmony_ci	@echo  '  macos_defconfig - Select commands known to build on macosx'
560f66f451Sopenharmony_ci	@echo  '  bsd_defconfig   - Select commands known to build on freebsd'
570f66f451Sopenharmony_ci
580f66f451Sopenharmony_ci# Cheesy build
590f66f451Sopenharmony_ci
600f66f451Sopenharmony_ciSHIPPED = kconfig/zconf.tab.c kconfig/lex.zconf.c kconfig/zconf.hash.c
610f66f451Sopenharmony_ci
620f66f451Sopenharmony_ci%.c: %.c_shipped
630f66f451Sopenharmony_ci	@ln -s $(notdir $<) $@
640f66f451Sopenharmony_ci
650f66f451Sopenharmony_cigen_config.h: .config
660f66f451Sopenharmony_ci
670f66f451Sopenharmony_cikconfig/mconf: $(SHIPPED)
680f66f451Sopenharmony_ci	$(HOSTCC) -o $@ kconfig/mconf.c kconfig/zconf.tab.c \
690f66f451Sopenharmony_ci		kconfig/lxdialog/*.c -lcurses -DCURSES_LOC="<ncurses.h>" \
700f66f451Sopenharmony_ci		-DKBUILD_NO_NLS=1 -DPROJECT_NAME=\"$(KCONFIG_PROJECT)\"
710f66f451Sopenharmony_ci
720f66f451Sopenharmony_cikconfig/conf: $(SHIPPED)
730f66f451Sopenharmony_ci	$(HOSTCC) -o $@ kconfig/conf.c kconfig/zconf.tab.c -DKBUILD_NO_NLS=1 \
740f66f451Sopenharmony_ci		-DPROJECT_NAME=\"$(KCONFIG_PROJECT)\"
750f66f451Sopenharmony_ci
760f66f451Sopenharmony_ciclean::
770f66f451Sopenharmony_ci	@rm -f $(wildcard kconfig/*zconf*.c) kconfig/conf kconfig/mconf
78