224 lines · 7.8 KB · Makefile
RawDownload
# SPDX-License-Identifier: GPL-2.0# ===========================================================================# Kernel configuration targets# These targets are used from top-level makefile PHONY += xconfig gconfig menuconfig config syncconfig \	localmodconfig localyesconfig ifdef KBUILD_KCONFIGKconfig := $(KBUILD_KCONFIG)elseKconfig := Kconfigendif ifeq ($(quiet),silent_)silent := -sendif # We need this, in case the user has it in its environmentunexport CONFIG_ xconfig: $(obj)/qconf	$< $(silent) $(Kconfig) gconfig: $(obj)/gconf	$< $(silent) $(Kconfig) menuconfig: $(obj)/mconf	$< $(silent) $(Kconfig) config: $(obj)/conf	$< $(silent) --oldaskconfig $(Kconfig) nconfig: $(obj)/nconf	$< $(silent) $(Kconfig) # This has become an internal implementation detail and is now deprecated# for external use.syncconfig: $(obj)/conf	$(Q)mkdir -p include/config include/generated	$< $(silent) --$@ $(Kconfig) localyesconfig localmodconfig: $(obj)/conf	$(Q)mkdir -p include/config include/generated	$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config	$(Q)if [ -f .config ]; then 					\			cmp -s .tmp.config .config ||			\			(mv -f .config .config.old.1;			\			 mv -f .tmp.config .config;			\			 $< $(silent) --oldconfig $(Kconfig);		\			 mv -f .config.old.1 .config.old)		\	else								\			mv -f .tmp.config .config;			\			$< $(silent) --oldconfig $(Kconfig);		\	fi	$(Q)rm -f .tmp.config # These targets map 1:1 to the commandline options of 'conf'simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \	alldefconfig randconfig listnewconfig olddefconfigPHONY += $(simple-targets) $(simple-targets): $(obj)/conf	$< $(silent) --$@ $(Kconfig) PHONY += oldnoconfig silentoldconfig savedefconfig defconfig # oldnoconfig is an alias of olddefconfig, because people already are dependent# on its behavior (sets new symbols to their default value but not 'n') with the# counter-intuitive name.oldnoconfig: olddefconfig	@echo "  WARNING: \"oldnoconfig\" target will be removed after Linux 4.19"	@echo "            Please use \"olddefconfig\" instead, which is an alias." # We do not expect manual invokcation of "silentoldcofig" (or "syncconfig").silentoldconfig: syncconfig	@echo "  WARNING: \"silentoldconfig\" has been renamed to \"syncconfig\""	@echo "            and is now an internal implementation detail."	@echo "            What you want is probably \"oldconfig\"."	@echo "            \"silentoldconfig\" will be removed after Linux 4.19" savedefconfig: $(obj)/conf	$< $(silent) --$@=defconfig $(Kconfig) defconfig: $(obj)/confifeq ($(KBUILD_DEFCONFIG),)	$< $(silent) --defconfig $(Kconfig)elseifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)	@$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)else	@$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'"	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG)endifendif %_defconfig: $(obj)/conf	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@) %.config: $(obj)/conf	$(if $(call configfiles),, $(error No configuration exists for this target on this architecture))	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles)	+$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig PHONY += kvmconfigkvmconfig: kvm_guest.config	@: PHONY += xenconfigxenconfig: xen.config	@: PHONY += tinyconfigtinyconfig:	$(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config # CHECK: -o cache_dir=<path> working?PHONY += testconfigtestconfig: $(obj)/conf	$(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \	-o cache_dir=$(abspath $(obj)/tests/.cache) \	$(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no)clean-dirs += tests/.cache # Help text used by make helphelp:	@echo  '  config	  - Update current config utilising a line-oriented program'	@echo  '  nconfig         - Update current config utilising a ncurses menu based program'	@echo  '  menuconfig	  - Update current config utilising a menu based program'	@echo  '  xconfig	  - Update current config utilising a Qt based front-end'	@echo  '  gconfig	  - Update current config utilising a GTK+ based front-end'	@echo  '  oldconfig	  - Update current config utilising a provided .config as base'	@echo  '  localmodconfig  - Update current config disabling modules not loaded'	@echo  '  localyesconfig  - Update current config converting local mods to core'	@echo  '  defconfig	  - New config with default from ARCH supplied defconfig'	@echo  '  savedefconfig   - Save current config as ./defconfig (minimal config)'	@echo  '  allnoconfig	  - New config where all options are answered with no'	@echo  '  allyesconfig	  - New config where all options are accepted with yes'	@echo  '  allmodconfig	  - New config selecting modules when possible'	@echo  '  alldefconfig    - New config with all symbols set to default'	@echo  '  randconfig	  - New config with random answer to all options'	@echo  '  listnewconfig   - List new options'	@echo  '  olddefconfig	  - Same as oldconfig but sets new symbols to their'	@echo  '                    default value without prompting'	@echo  '  kvmconfig	  - Enable additional options for kvm guest kernel support'	@echo  '  xenconfig       - Enable additional options for xen dom0 and guest kernel support'	@echo  '  tinyconfig	  - Configure the tiniest possible kernel'	@echo  '  testconfig	  - Run Kconfig unit tests (requires python3 and pytest)' # ===========================================================================# Shared Makefile for the various kconfig executables:# conf:	  Used for defconfig, oldconfig and related targets# object files used by all kconfig flavours conf-objs	:= conf.o  zconf.tab.o hostprogs-y := conf targets		+= zconf.lex.c # generated files seem to need this to find local include filesHOSTCFLAGS_zconf.lex.o	:= -I$(src)HOSTCFLAGS_zconf.tab.o	:= -I$(src) # nconf: Used for the nconfig target based on ncurseshostprogs-y	+= nconfnconf-objs	:= nconf.o zconf.tab.o nconf.gui.o HOSTLOADLIBES_nconf	= $(shell . $(obj)/.nconf-cfg && echo $$libs)HOSTCFLAGS_nconf.o	= $(shell . $(obj)/.nconf-cfg && echo $$cflags)HOSTCFLAGS_nconf.gui.o	= $(shell . $(obj)/.nconf-cfg && echo $$cflags) $(obj)/nconf.o: $(obj)/.nconf-cfg # mconf: Used for the menuconfig target based on lxdialoghostprogs-y	+= mconflxdialog	:= checklist.o inputbox.o menubox.o textbox.o util.o yesno.omconf-objs	:= mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)$(foreach f, mconf.o $(lxdialog), \  $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg # qconf: Used for the xconfig target based on Qthostprogs-y	+= qconfqconf-cxxobjs	:= qconf.oqconf-objs	:= zconf.tab.o HOSTLOADLIBES_qconf	= $(shell . $(obj)/.qconf-cfg && echo $$libs)HOSTCXXFLAGS_qconf.o	= $(shell . $(obj)/.qconf-cfg && echo $$cflags) $(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc quiet_cmd_moc = MOC     $@      cmd_moc = $(shell . $(obj)/.qconf-cfg && echo $$moc) -i $< -o $@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg	$(call cmd,moc) # gconf: Used for the gconfig target based on GTK+hostprogs-y	+= gconfgconf-objs	:= gconf.o zconf.tab.o HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)HOSTCFLAGS_gconf.o  = $(shell . $(obj)/.gconf-cfg && echo $$cflags) $(obj)/gconf.o: $(obj)/.gconf-cfg $(obj)/zconf.tab.o: $(obj)/zconf.lex.c # check if necessary packages are available, and configure build flagsdefine filechk_conf_cfg	$(CONFIG_SHELL) $<endef $(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE	$(call filechk,conf_cfg) clean-files += .*conf-cfg