1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 21da177e4SLinus Torvalds# =========================================================================== 31da177e4SLinus Torvalds# Kernel configuration targets 41da177e4SLinus Torvalds# These targets are used from top-level makefile 51da177e4SLinus Torvalds 6694c49a7SSam RavnborgPHONY += xconfig gconfig menuconfig config syncconfig \ 7281c9dadSSteven Rostedt localmodconfig localyesconfig 81da177e4SLinus Torvalds 961bee204SAl Viroifdef KBUILD_KCONFIG 1061bee204SAl ViroKconfig := $(KBUILD_KCONFIG) 1161bee204SAl Viroelse 12838a2e55SArnaud LacombeKconfig := Kconfig 1361bee204SAl Viroendif 14e703f75dSSam Ravnborg 150a1f00a1SMichal Marekifeq ($(quiet),silent_) 160a1f00a1SMichal Mareksilent := -s 170a1f00a1SMichal Marekendif 180a1f00a1SMichal Marek 19c2838e6eSYann E. MORIN# We need this, in case the user has it in its environment 20c2838e6eSYann E. MORINunexport CONFIG_ 21c2838e6eSYann E. MORIN 221da177e4SLinus Torvaldsxconfig: $(obj)/qconf 230a1f00a1SMichal Marek $< $(silent) $(Kconfig) 241da177e4SLinus Torvalds 251da177e4SLinus Torvaldsgconfig: $(obj)/gconf 260a1f00a1SMichal Marek $< $(silent) $(Kconfig) 271da177e4SLinus Torvalds 281da177e4SLinus Torvaldsmenuconfig: $(obj)/mconf 290a1f00a1SMichal Marek $< $(silent) $(Kconfig) 301da177e4SLinus Torvalds 311da177e4SLinus Torvaldsconfig: $(obj)/conf 320a1f00a1SMichal Marek $< $(silent) --oldaskconfig $(Kconfig) 331da177e4SLinus Torvalds 34692d97c3Snir.tzachar@gmail.comnconfig: $(obj)/nconf 350a1f00a1SMichal Marek $< $(silent) $(Kconfig) 36692d97c3Snir.tzachar@gmail.com 37cedd55d4SMarc Herbert# This has become an internal implementation detail and is now deprecated 38cedd55d4SMarc Herbert# for external use. 39911a91c3SMasahiro Yamadasyncconfig: $(obj)/conf 409815594aSMasahiro Yamada $(Q)mkdir -p include/config include/generated 410a1f00a1SMichal Marek $< $(silent) --$@ $(Kconfig) 421da177e4SLinus Torvalds 432a616258SUlf Magnussonlocalyesconfig localmodconfig: $(obj)/conf 449815594aSMasahiro Yamada $(Q)mkdir -p include/config include/generated 452a616258SUlf Magnusson $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config 46a7c02602SSteven Rostedt $(Q)if [ -f .config ]; then \ 47a7c02602SSteven Rostedt cmp -s .tmp.config .config || \ 4803fa25daSSteven Rostedt (mv -f .config .config.old.1; \ 4903fa25daSSteven Rostedt mv -f .tmp.config .config; \ 502a616258SUlf Magnusson $< $(silent) --oldconfig $(Kconfig); \ 51a7c02602SSteven Rostedt mv -f .config.old.1 .config.old) \ 52a7c02602SSteven Rostedt else \ 53a7c02602SSteven Rostedt mv -f .tmp.config .config; \ 542a616258SUlf Magnusson $< $(silent) --oldconfig $(Kconfig); \ 55a7c02602SSteven Rostedt fi 5603fa25daSSteven Rostedt $(Q)rm -f .tmp.config 5703fa25daSSteven Rostedt 581cba0c30SMichal Marek# These targets map 1:1 to the commandline options of 'conf' 591cba0c30SMichal Mareksimple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ 601cba0c30SMichal Marek alldefconfig randconfig listnewconfig olddefconfig 611cba0c30SMichal MarekPHONY += $(simple-targets) 621da177e4SLinus Torvalds 631cba0c30SMichal Marek$(simple-targets): $(obj)/conf 640a1f00a1SMichal Marek $< $(silent) --$@ $(Kconfig) 651da177e4SLinus Torvalds 66911a91c3SMasahiro YamadaPHONY += oldnoconfig silentoldconfig savedefconfig defconfig 671da177e4SLinus Torvalds 68fb16d891SAdam Lee# oldnoconfig is an alias of olddefconfig, because people already are dependent 69fb16d891SAdam Lee# on its behavior (sets new symbols to their default value but not 'n') with the 70fb16d891SAdam Lee# counter-intuitive name. 711cba0c30SMichal Marekoldnoconfig: olddefconfig 72312ee687SMasahiro Yamada @echo " WARNING: \"oldnoconfig\" target will be removed after Linux 4.19" 73312ee687SMasahiro Yamada @echo " Please use \"olddefconfig\" instead, which is an alias." 74fb16d891SAdam Lee 75911a91c3SMasahiro Yamada# We do not expect manual invokcation of "silentoldcofig" (or "syncconfig"). 76911a91c3SMasahiro Yamadasilentoldconfig: syncconfig 77911a91c3SMasahiro Yamada @echo " WARNING: \"silentoldconfig\" has been renamed to \"syncconfig\"" 78911a91c3SMasahiro Yamada @echo " and is now an internal implementation detail." 79911a91c3SMasahiro Yamada @echo " What you want is probably \"oldconfig\"." 80911a91c3SMasahiro Yamada @echo " \"silentoldconfig\" will be removed after Linux 4.19" 81911a91c3SMasahiro Yamada 827cf3d73bSSam Ravnborgsavedefconfig: $(obj)/conf 830a1f00a1SMichal Marek $< $(silent) --$@=defconfig $(Kconfig) 847cf3d73bSSam Ravnborg 851da177e4SLinus Torvaldsdefconfig: $(obj)/conf 861da177e4SLinus Torvaldsifeq ($(KBUILD_DEFCONFIG),) 870a1f00a1SMichal Marek $< $(silent) --defconfig $(Kconfig) 8842f9d3c6SJan Beulichelse 8942f9d3c6SJan Beulichifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),) 900a1f00a1SMichal Marek @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" 910a1f00a1SMichal Marek $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) 92d2036f30SMichael Ellermanelse 93d2036f30SMichael Ellerman @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'" 94d2036f30SMichael Ellerman $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) 951da177e4SLinus Torvaldsendif 9642f9d3c6SJan Beulichendif 971da177e4SLinus Torvalds 981da177e4SLinus Torvalds%_defconfig: $(obj)/conf 990a1f00a1SMichal Marek $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) 1001da177e4SLinus Torvalds 10163a91033SMasahiro Yamadaconfigfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@) 1023aaefce1SJosh Triplett 10363a91033SMasahiro Yamada%.config: $(obj)/conf 10463a91033SMasahiro Yamada $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) 10563a91033SMasahiro Yamada $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles) 106de461993SMasahiro Yamada +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig 1073aaefce1SJosh Triplett 1083aaefce1SJosh TriplettPHONY += kvmconfig 10963a91033SMasahiro Yamadakvmconfig: kvm_guest.config 11063a91033SMasahiro Yamada @: 1113aaefce1SJosh Triplett 1126c668505SLuis R. RodriguezPHONY += xenconfig 1136c668505SLuis R. Rodriguezxenconfig: xen.config 1146c668505SLuis R. Rodriguez @: 1156c668505SLuis R. Rodriguez 1160da1d4a0SJosh TriplettPHONY += tinyconfig 11763a91033SMasahiro Yamadatinyconfig: 11863a91033SMasahiro Yamada $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config 1190da1d4a0SJosh Triplett 120022a4bf6SMasahiro Yamada# CHECK: -o cache_dir=<path> working? 121022a4bf6SMasahiro YamadaPHONY += testconfig 122022a4bf6SMasahiro Yamadatestconfig: $(obj)/conf 123022a4bf6SMasahiro Yamada $(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ 124022a4bf6SMasahiro Yamada -o cache_dir=$(abspath $(obj)/tests/.cache) \ 125022a4bf6SMasahiro Yamada $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) 126022a4bf6SMasahiro Yamadaclean-dirs += tests/.cache 127022a4bf6SMasahiro Yamada 1281da177e4SLinus Torvalds# Help text used by make help 1291da177e4SLinus Torvaldshelp: 1301da177e4SLinus Torvalds @echo ' config - Update current config utilising a line-oriented program' 131fa75a727SGeert Uytterhoeven @echo ' nconfig - Update current config utilising a ncurses menu based' 132fa75a727SGeert Uytterhoeven @echo ' program' 1331da177e4SLinus Torvalds @echo ' menuconfig - Update current config utilising a menu based program' 134092373c2SDiego Viola @echo ' xconfig - Update current config utilising a Qt based front-end' 13539c3f1baSDiego Viola @echo ' gconfig - Update current config utilising a GTK+ based front-end' 1361da177e4SLinus Torvalds @echo ' oldconfig - Update current config utilising a provided .config as base' 13703fa25daSSteven Rostedt @echo ' localmodconfig - Update current config disabling modules not loaded' 138281c9dadSSteven Rostedt @echo ' localyesconfig - Update current config converting local mods to core' 1390748cb3eSSam Ravnborg @echo ' defconfig - New config with default from ARCH supplied defconfig' 1407cf3d73bSSam Ravnborg @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' 141e11f0496SJesper Juhl @echo ' allnoconfig - New config where all options are answered with no' 1420748cb3eSSam Ravnborg @echo ' allyesconfig - New config where all options are accepted with yes' 1430748cb3eSSam Ravnborg @echo ' allmodconfig - New config selecting modules when possible' 1440748cb3eSSam Ravnborg @echo ' alldefconfig - New config with all symbols set to default' 1450748cb3eSSam Ravnborg @echo ' randconfig - New config with random answer to all options' 146861b4ea4SSam Ravnborg @echo ' listnewconfig - List new options' 147cedd55d4SMarc Herbert @echo ' olddefconfig - Same as oldconfig but sets new symbols to their' 148cedd55d4SMarc Herbert @echo ' default value without prompting' 1499bcd776dSLuis R. Rodriguez @echo ' kvmconfig - Enable additional options for kvm guest kernel support' 1506c668505SLuis R. Rodriguez @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' 1510da1d4a0SJosh Triplett @echo ' tinyconfig - Configure the tiniest possible kernel' 152*d6a0c8a1SPetr Vorel @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' 1531da177e4SLinus Torvalds 1541da177e4SLinus Torvalds# =========================================================================== 1551da177e4SLinus Torvalds# Shared Makefile for the various kconfig executables: 1561da177e4SLinus Torvalds# conf: Used for defconfig, oldconfig and related targets 1571da177e4SLinus Torvalds# object files used by all kconfig flavours 1581da177e4SLinus Torvalds 1591da177e4SLinus Torvaldsconf-objs := conf.o zconf.tab.o 1601da177e4SLinus Torvalds 161694c49a7SSam Ravnborghostprogs-y := conf 1621da177e4SLinus Torvalds 163b23d1a24SMasahiro Yamadatargets += zconf.lex.c 1641da177e4SLinus Torvalds 1651da177e4SLinus Torvalds# generated files seem to need this to find local include files 1662f76b358SArnaud LacombeHOSTCFLAGS_zconf.lex.o := -I$(src) 1671da177e4SLinus TorvaldsHOSTCFLAGS_zconf.tab.o := -I$(src) 1681da177e4SLinus Torvalds 1691c5af5cfSMasahiro Yamada# nconf: Used for the nconfig target based on ncurses 1701c5af5cfSMasahiro Yamadahostprogs-y += nconf 1711c5af5cfSMasahiro Yamadanconf-objs := nconf.o zconf.tab.o nconf.gui.o 1727080e47bSArnaud Lacombe 1731c5af5cfSMasahiro YamadaHOSTLOADLIBES_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) 1741c5af5cfSMasahiro YamadaHOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 1751c5af5cfSMasahiro YamadaHOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 1761c5af5cfSMasahiro Yamada 1771c5af5cfSMasahiro Yamada$(obj)/nconf.o: $(obj)/.nconf-cfg 1781c5af5cfSMasahiro Yamada 1791c5af5cfSMasahiro Yamada# mconf: Used for the menuconfig target based on lxdialog 1801c5af5cfSMasahiro Yamadahostprogs-y += mconf 1811c5af5cfSMasahiro Yamadalxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o 1821c5af5cfSMasahiro Yamadamconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) 1831c5af5cfSMasahiro Yamada 1841c5af5cfSMasahiro YamadaHOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) 1851c5af5cfSMasahiro Yamada$(foreach f, mconf.o $(lxdialog), \ 1861c5af5cfSMasahiro Yamada $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) 1871c5af5cfSMasahiro Yamada 1881c5af5cfSMasahiro Yamada$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg 1891da177e4SLinus Torvalds 1900b669a50SMasahiro Yamada# qconf: Used for the xconfig target based on Qt 1910b669a50SMasahiro Yamadahostprogs-y += qconf 1920b669a50SMasahiro Yamadaqconf-cxxobjs := qconf.o 1930b669a50SMasahiro Yamadaqconf-objs := zconf.tab.o 1941da177e4SLinus Torvalds 1950b669a50SMasahiro YamadaHOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) 1960b669a50SMasahiro YamadaHOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) 1970b669a50SMasahiro Yamada 1980b669a50SMasahiro Yamada$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc 1990b669a50SMasahiro Yamada 2000b669a50SMasahiro Yamadaquiet_cmd_moc = MOC $@ 2010b669a50SMasahiro Yamada cmd_moc = $(shell . $(obj)/.qconf-cfg && echo $$moc) -i $< -o $@ 2020b669a50SMasahiro Yamada 2030b669a50SMasahiro Yamada$(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg 2040b669a50SMasahiro Yamada $(call cmd,moc) 2051da177e4SLinus Torvalds 206b464ef58SMasahiro Yamada# gconf: Used for the gconfig target based on GTK+ 207b464ef58SMasahiro Yamadahostprogs-y += gconf 208b464ef58SMasahiro Yamadagconf-objs := gconf.o zconf.tab.o 2091da177e4SLinus Torvalds 210b464ef58SMasahiro YamadaHOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) 211b464ef58SMasahiro YamadaHOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) 2121da177e4SLinus Torvalds 213b464ef58SMasahiro Yamada$(obj)/gconf.o: $(obj)/.gconf-cfg 2141da177e4SLinus Torvalds 215bb3290d9SLinus Torvalds$(obj)/zconf.tab.o: $(obj)/zconf.lex.c 2161da177e4SLinus Torvalds 2170b669a50SMasahiro Yamada# check if necessary packages are available, and configure build flags 2180b669a50SMasahiro Yamadadefine filechk_conf_cfg 2190b669a50SMasahiro Yamada $(CONFIG_SHELL) $< 2200b669a50SMasahiro Yamadaendef 2210b669a50SMasahiro Yamada 2220b669a50SMasahiro Yamada$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE 2230b669a50SMasahiro Yamada $(call filechk,conf_cfg) 2240b669a50SMasahiro Yamada 2250b669a50SMasahiro Yamadaclean-files += .*conf-cfg 226