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