11da177e4SLinus Torvalds# =========================================================================== 21da177e4SLinus Torvalds# Kernel configuration targets 31da177e4SLinus Torvalds# These targets are used from top-level makefile 41da177e4SLinus Torvalds 51cba0c30SMichal MarekPHONY += xconfig gconfig menuconfig config silentoldconfig update-po-config \ 6281c9dadSSteven Rostedt localmodconfig localyesconfig 71da177e4SLinus Torvalds 861bee204SAl Viroifdef KBUILD_KCONFIG 961bee204SAl ViroKconfig := $(KBUILD_KCONFIG) 1061bee204SAl Viroelse 11838a2e55SArnaud LacombeKconfig := Kconfig 1261bee204SAl Viroendif 13e703f75dSSam Ravnborg 140a1f00a1SMichal Marekifeq ($(quiet),silent_) 150a1f00a1SMichal Mareksilent := -s 160a1f00a1SMichal Marekendif 170a1f00a1SMichal Marek 18c2838e6eSYann E. MORIN# We need this, in case the user has it in its environment 19c2838e6eSYann E. MORINunexport CONFIG_ 20c2838e6eSYann E. MORIN 211da177e4SLinus Torvaldsxconfig: $(obj)/qconf 220a1f00a1SMichal Marek $< $(silent) $(Kconfig) 231da177e4SLinus Torvalds 241da177e4SLinus Torvaldsgconfig: $(obj)/gconf 250a1f00a1SMichal Marek $< $(silent) $(Kconfig) 261da177e4SLinus Torvalds 271da177e4SLinus Torvaldsmenuconfig: $(obj)/mconf 280a1f00a1SMichal Marek $< $(silent) $(Kconfig) 291da177e4SLinus Torvalds 301da177e4SLinus Torvaldsconfig: $(obj)/conf 310a1f00a1SMichal Marek $< $(silent) --oldaskconfig $(Kconfig) 321da177e4SLinus Torvalds 33692d97c3Snir.tzachar@gmail.comnconfig: $(obj)/nconf 340a1f00a1SMichal Marek $< $(silent) $(Kconfig) 35692d97c3Snir.tzachar@gmail.com 361da177e4SLinus Torvaldssilentoldconfig: $(obj)/conf 379815594aSMasahiro Yamada $(Q)mkdir -p include/config include/generated 38d3fc425eSNicolas Pitre $(Q)test -e include/generated/autoksyms.h || \ 39d3fc425eSNicolas Pitre touch include/generated/autoksyms.h 400a1f00a1SMichal Marek $< $(silent) --$@ $(Kconfig) 411da177e4SLinus Torvalds 4250bce3e8SArnaud Lacombelocalyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf 439815594aSMasahiro Yamada $(Q)mkdir -p include/config include/generated 4422d550aeSArnaud Lacombe $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config 45a7c02602SSteven Rostedt $(Q)if [ -f .config ]; then \ 46a7c02602SSteven Rostedt cmp -s .tmp.config .config || \ 4703fa25daSSteven Rostedt (mv -f .config .config.old.1; \ 4803fa25daSSteven Rostedt mv -f .tmp.config .config; \ 490a1f00a1SMichal Marek $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \ 50a7c02602SSteven Rostedt mv -f .config.old.1 .config.old) \ 51a7c02602SSteven Rostedt else \ 52a7c02602SSteven Rostedt mv -f .tmp.config .config; \ 530a1f00a1SMichal Marek $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \ 54a7c02602SSteven Rostedt fi 5503fa25daSSteven Rostedt $(Q)rm -f .tmp.config 5603fa25daSSteven Rostedt 571020026fSEGRY Gabor# Create new linux.pot file 58b70e325cSSam Ravnborg# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 5946d26319SEGRY Gaborupdate-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h 600a1f00a1SMichal Marek $(Q)$(kecho) " GEN config.pot" 611020026fSEGRY Gabor $(Q)xgettext --default-domain=linux \ 623b9fa093SArnaldo Carvalho de Melo --add-comments --keyword=_ --keyword=N_ \ 63b70e325cSSam Ravnborg --from-code=UTF-8 \ 64a24a1b8eSPeter Foley --files-from=$(srctree)/scripts/kconfig/POTFILES.in \ 65a24a1b8eSPeter Foley --directory=$(srctree) --directory=$(objtree) \ 66b70e325cSSam Ravnborg --output $(obj)/config.pot 67b70e325cSSam Ravnborg $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot 68fa0ad657SPaul Bolle $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ 69fa0ad657SPaul Bolle $(srctree)/arch/*/um/Kconfig`; \ 70720d6c29SEgry Gabor do \ 710a1f00a1SMichal Marek $(kecho) " GEN $$i"; \ 724217516eSSam Ravnborg $(obj)/kxgettext $$i \ 731020026fSEGRY Gabor >> $(obj)/config.pot; \ 741020026fSEGRY Gabor done ) 750a1f00a1SMichal Marek $(Q)$(kecho) " GEN linux.pot" 761020026fSEGRY Gabor $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 77b70e325cSSam Ravnborg --output $(obj)/linux.pot 78b70e325cSSam Ravnborg $(Q)rm -f $(obj)/config.pot 793b9fa093SArnaldo Carvalho de Melo 801cba0c30SMichal Marek# These targets map 1:1 to the commandline options of 'conf' 811cba0c30SMichal Mareksimple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ 821cba0c30SMichal Marek alldefconfig randconfig listnewconfig olddefconfig 831cba0c30SMichal MarekPHONY += $(simple-targets) 841da177e4SLinus Torvalds 851cba0c30SMichal Marek$(simple-targets): $(obj)/conf 860a1f00a1SMichal Marek $< $(silent) --$@ $(Kconfig) 871da177e4SLinus Torvalds 881cba0c30SMichal MarekPHONY += oldnoconfig savedefconfig defconfig 891da177e4SLinus Torvalds 90fb16d891SAdam Lee# oldnoconfig is an alias of olddefconfig, because people already are dependent 91fb16d891SAdam Lee# on its behavior (sets new symbols to their default value but not 'n') with the 92fb16d891SAdam Lee# counter-intuitive name. 931cba0c30SMichal Marekoldnoconfig: olddefconfig 94fb16d891SAdam Lee 957cf3d73bSSam Ravnborgsavedefconfig: $(obj)/conf 960a1f00a1SMichal Marek $< $(silent) --$@=defconfig $(Kconfig) 977cf3d73bSSam Ravnborg 981da177e4SLinus Torvaldsdefconfig: $(obj)/conf 991da177e4SLinus Torvaldsifeq ($(KBUILD_DEFCONFIG),) 1000a1f00a1SMichal Marek $< $(silent) --defconfig $(Kconfig) 10142f9d3c6SJan Beulichelse 10242f9d3c6SJan Beulichifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),) 1030a1f00a1SMichal Marek @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" 1040a1f00a1SMichal Marek $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) 105d2036f30SMichael Ellermanelse 106d2036f30SMichael Ellerman @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'" 107d2036f30SMichael Ellerman $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) 1081da177e4SLinus Torvaldsendif 10942f9d3c6SJan Beulichendif 1101da177e4SLinus Torvalds 1111da177e4SLinus Torvalds%_defconfig: $(obj)/conf 1120a1f00a1SMichal Marek $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) 1131da177e4SLinus Torvalds 11463a91033SMasahiro Yamadaconfigfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@) 1153aaefce1SJosh Triplett 11663a91033SMasahiro Yamada%.config: $(obj)/conf 11763a91033SMasahiro Yamada $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) 11863a91033SMasahiro Yamada $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles) 119de461993SMasahiro Yamada +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig 1203aaefce1SJosh Triplett 1213aaefce1SJosh TriplettPHONY += kvmconfig 12263a91033SMasahiro Yamadakvmconfig: kvm_guest.config 12363a91033SMasahiro Yamada @: 1243aaefce1SJosh Triplett 1256c668505SLuis R. RodriguezPHONY += xenconfig 1266c668505SLuis R. Rodriguezxenconfig: xen.config 1276c668505SLuis R. Rodriguez @: 1286c668505SLuis R. Rodriguez 1290da1d4a0SJosh TriplettPHONY += tinyconfig 13063a91033SMasahiro Yamadatinyconfig: 13163a91033SMasahiro Yamada $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config 1320da1d4a0SJosh Triplett 1331da177e4SLinus Torvalds# Help text used by make help 1341da177e4SLinus Torvaldshelp: 1351da177e4SLinus Torvalds @echo ' config - Update current config utilising a line-oriented program' 136fa75a727SGeert Uytterhoeven @echo ' nconfig - Update current config utilising a ncurses menu based' 137fa75a727SGeert Uytterhoeven @echo ' program' 1381da177e4SLinus Torvalds @echo ' menuconfig - Update current config utilising a menu based program' 139092373c2SDiego Viola @echo ' xconfig - Update current config utilising a Qt based front-end' 14039c3f1baSDiego Viola @echo ' gconfig - Update current config utilising a GTK+ based front-end' 1411da177e4SLinus Torvalds @echo ' oldconfig - Update current config utilising a provided .config as base' 14203fa25daSSteven Rostedt @echo ' localmodconfig - Update current config disabling modules not loaded' 143281c9dadSSteven Rostedt @echo ' localyesconfig - Update current config converting local mods to core' 144590a5857SMarkus Heidelberg @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' 1450748cb3eSSam Ravnborg @echo ' defconfig - New config with default from ARCH supplied defconfig' 1467cf3d73bSSam Ravnborg @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' 147e11f0496SJesper Juhl @echo ' allnoconfig - New config where all options are answered with no' 1480748cb3eSSam Ravnborg @echo ' allyesconfig - New config where all options are accepted with yes' 1490748cb3eSSam Ravnborg @echo ' allmodconfig - New config selecting modules when possible' 1500748cb3eSSam Ravnborg @echo ' alldefconfig - New config with all symbols set to default' 1510748cb3eSSam Ravnborg @echo ' randconfig - New config with random answer to all options' 152861b4ea4SSam Ravnborg @echo ' listnewconfig - List new options' 153fa75a727SGeert Uytterhoeven @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their' 154fa75a727SGeert Uytterhoeven @echo ' default value' 1559bcd776dSLuis R. Rodriguez @echo ' kvmconfig - Enable additional options for kvm guest kernel support' 1566c668505SLuis R. Rodriguez @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' 1570da1d4a0SJosh Triplett @echo ' tinyconfig - Configure the tiniest possible kernel' 1581da177e4SLinus Torvalds 1592982de69SSam Ravnborg# lxdialog stuff 1602982de69SSam Ravnborgcheck-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 1612982de69SSam Ravnborg 162e9e40e14SRob Landley# Use recursively expanded variables so we do not call gcc unless 1632982de69SSam Ravnborg# we really need to do so. (Do not call gcc as part of make mrproper) 1649ba95682SArnaud LacombeHOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ 1659ba95682SArnaud Lacombe -DLOCALE 1662982de69SSam Ravnborg 1671da177e4SLinus Torvalds# =========================================================================== 1681da177e4SLinus Torvalds# Shared Makefile for the various kconfig executables: 1691da177e4SLinus Torvalds# conf: Used for defconfig, oldconfig and related targets 170692d97c3Snir.tzachar@gmail.com# nconf: Used for the nconfig target. 171692d97c3Snir.tzachar@gmail.com# Utilizes ncurses 1726f26e5e4SMarkus Heidelberg# mconf: Used for the menuconfig target 1731da177e4SLinus Torvalds# Utilizes the lxdialog package 1741da177e4SLinus Torvalds# qconf: Used for the xconfig target 175092373c2SDiego Viola# Based on Qt which needs to be installed to compile it 1761da177e4SLinus Torvalds# gconf: Used for the gconfig target 17739c3f1baSDiego Viola# Based on GTK+ which needs to be installed to compile it 1781da177e4SLinus Torvalds# object files used by all kconfig flavours 1791da177e4SLinus Torvalds 1802982de69SSam Ravnborglxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o 1812982de69SSam Ravnborglxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o 1822982de69SSam Ravnborg 1831da177e4SLinus Torvaldsconf-objs := conf.o zconf.tab.o 1842982de69SSam Ravnborgmconf-objs := mconf.o zconf.tab.o $(lxdialog) 185692d97c3Snir.tzachar@gmail.comnconf-objs := nconf.o zconf.tab.o nconf.gui.o 1863b9fa093SArnaldo Carvalho de Melokxgettext-objs := kxgettext.o zconf.tab.o 187f1943049SPeter Foleyqconf-cxxobjs := qconf.o 1885a6f8d2bSArnaud Lacombeqconf-objs := zconf.tab.o 1895a6f8d2bSArnaud Lacombegconf-objs := gconf.o zconf.tab.o 1901da177e4SLinus Torvalds 191022af62dSMasahiro Yamadahostprogs-y := conf nconf mconf kxgettext qconf gconf 1921da177e4SLinus Torvalds 1935a6f8d2bSArnaud Lacombeclean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck 1942f76b358SArnaud Lacombeclean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h 1951020026fSEGRY Gaborclean-files += config.pot linux.pot 1961da177e4SLinus Torvalds 1976e588f6dSSam Ravnborg# Check that we have the required ncurses stuff installed for lxdialog (menuconfig) 1986e588f6dSSam RavnborgPHONY += $(obj)/dochecklxdialog 199*ff85a1a8SBorislav Petkov$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog 2006e588f6dSSam Ravnborg$(obj)/dochecklxdialog: 2017080e47bSArnaud Lacombe $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf) 2026e588f6dSSam Ravnborg 2036e588f6dSSam Ravnborgalways := dochecklxdialog 2046e588f6dSSam Ravnborg 205aa1e5ef5SSam Ravnborg# Add environment specific flags 206aa1e5ef5SSam RavnborgHOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) 20770a6a0cbSYuri Vasilevski 2081da177e4SLinus Torvalds# generated files seem to need this to find local include files 2092f76b358SArnaud LacombeHOSTCFLAGS_zconf.lex.o := -I$(src) 2101da177e4SLinus TorvaldsHOSTCFLAGS_zconf.tab.o := -I$(src) 2111da177e4SLinus Torvalds 212378dbb2cSArnaud LacombeLEX_PREFIX_zconf := zconf 213378dbb2cSArnaud LacombeYACC_PREFIX_zconf := zconf 214378dbb2cSArnaud Lacombe 2155a6f8d2bSArnaud LacombeHOSTLOADLIBES_qconf = $(KC_QT_LIBS) 2165a6f8d2bSArnaud LacombeHOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) 2171da177e4SLinus Torvalds 2185a6f8d2bSArnaud LacombeHOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` 21937193147SAdrian BunkHOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 2201ea3ad4eSArnaud Lacombe -Wno-missing-prototypes 2211da177e4SLinus Torvalds 2227080e47bSArnaud LacombeHOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 2237080e47bSArnaud Lacombe 224544e7e54SJustin LecherHOSTLOADLIBES_nconf = $(shell \ 2257285996aSBrian Norris pkg-config --libs menuw panelw ncursesw 2>/dev/null \ 2267285996aSBrian Norris || pkg-config --libs menu panel ncurses 2>/dev/null \ 227544e7e54SJustin Lecher || echo "-lmenu -lpanel -lncurses" ) 2281da177e4SLinus Torvalds$(obj)/qconf.o: $(obj)/.tmp_qtcheck 2291da177e4SLinus Torvalds 230022af62dSMasahiro Yamadaifeq ($(MAKECMDGOALS),xconfig) 231b3a5225fSRoman Zippel$(obj)/.tmp_qtcheck: $(src)/Makefile 2321da177e4SLinus Torvalds-include $(obj)/.tmp_qtcheck 2331da177e4SLinus Torvalds 234092373c2SDiego Viola# Qt needs some extra effort... 2351da177e4SLinus Torvalds$(obj)/.tmp_qtcheck: 236d1b0dc90SThiago Macieira @set -e; $(kecho) " CHECK qt"; \ 237588446a8SThiago Macieira if pkg-config --exists Qt5Core; then \ 238588446a8SThiago Macieira cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ 239588446a8SThiago Macieira libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \ 240588446a8SThiago Macieira moc=`pkg-config --variable=host_bins Qt5Core`/moc; \ 241588446a8SThiago Macieira elif pkg-config --exists QtCore; then \ 242588446a8SThiago Macieira cflags=`pkg-config --cflags QtCore QtGui`; \ 243588446a8SThiago Macieira libs=`pkg-config --libs QtCore QtGui`; \ 244588446a8SThiago Macieira moc=`pkg-config --variable=moc_location QtCore`; \ 245b3a5225fSRoman Zippel else \ 2465b580fa6SMichal Marek echo >&2 "*"; \ 247588446a8SThiago Macieira echo >&2 "* Could not find Qt via pkg-config."; \ 248588446a8SThiago Macieira echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \ 2495b580fa6SMichal Marek echo >&2 "*"; \ 250d1b0dc90SThiago Macieira exit 1; \ 251133c5f7cSAlexander Stein fi; \ 252b3a5225fSRoman Zippel echo "KC_QT_CFLAGS=$$cflags" > $@; \ 253b3a5225fSRoman Zippel echo "KC_QT_LIBS=$$libs" >> $@; \ 254b3a5225fSRoman Zippel echo "KC_QT_MOC=$$moc" >> $@ 2551da177e4SLinus Torvaldsendif 2561da177e4SLinus Torvalds 2571da177e4SLinus Torvalds$(obj)/gconf.o: $(obj)/.tmp_gtkcheck 2581da177e4SLinus Torvalds 259022af62dSMasahiro Yamadaifeq ($(MAKECMDGOALS),gconfig) 2601da177e4SLinus Torvalds-include $(obj)/.tmp_gtkcheck 2611da177e4SLinus Torvalds 26239c3f1baSDiego Viola# GTK+ needs some extra effort, too... 2631da177e4SLinus Torvalds$(obj)/.tmp_gtkcheck: 26437193147SAdrian Bunk @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ 26537193147SAdrian Bunk if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ 2661da177e4SLinus Torvalds touch $@; \ 2671da177e4SLinus Torvalds else \ 2685b580fa6SMichal Marek echo >&2 "*"; \ 2695b580fa6SMichal Marek echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \ 2705b580fa6SMichal Marek echo >&2 "*"; \ 2711da177e4SLinus Torvalds false; \ 2721da177e4SLinus Torvalds fi \ 2731da177e4SLinus Torvalds else \ 2745b580fa6SMichal Marek echo >&2 "*"; \ 2755b580fa6SMichal Marek echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \ 2765b580fa6SMichal Marek echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \ 2775b580fa6SMichal Marek echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ 2785b580fa6SMichal Marek echo >&2 "*"; \ 2791da177e4SLinus Torvalds false; \ 2801da177e4SLinus Torvalds fi 2811da177e4SLinus Torvaldsendif 2821da177e4SLinus Torvalds 2832f76b358SArnaud Lacombe$(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c 2841da177e4SLinus Torvalds 2855a6f8d2bSArnaud Lacombe$(obj)/qconf.o: $(obj)/qconf.moc 2861da177e4SLinus Torvalds 287ebca026aSYaakov Selkowitzquiet_cmd_moc = MOC $@ 288ebca026aSYaakov Selkowitz cmd_moc = $(KC_QT_MOC) -i $< -o $@ 289ebca026aSYaakov Selkowitz 290ebca026aSYaakov Selkowitz$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck 291ebca026aSYaakov Selkowitz $(call cmd,moc) 2921da177e4SLinus Torvalds 29339c3f1baSDiego Viola# Extract gconf menu items for i18n support 29446d26319SEGRY Gabor$(obj)/gconf.glade.h: $(obj)/gconf.glade 2952d80eb0fSPeter Foley $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ 296a24a1b8eSPeter Foley $(obj)/gconf.glade 297