Makefile (c13aca79ff3c4af5fd31a5b2743a90eba6e36a26) | Makefile (d6a0c8a1326bb54c5518f8a343a6b09056c43b36) |
---|---|
1# SPDX-License-Identifier: GPL-2.0 2# =========================================================================== 3# Kernel configuration targets 4# These targets are used from top-level makefile 5 | 1# SPDX-License-Identifier: GPL-2.0 2# =========================================================================== 3# Kernel configuration targets 4# These targets are used from top-level makefile 5 |
6PHONY += xconfig gconfig menuconfig config syncconfig update-po-config \ | 6PHONY += xconfig gconfig menuconfig config syncconfig \ |
7 localmodconfig localyesconfig 8 9ifdef KBUILD_KCONFIG 10Kconfig := $(KBUILD_KCONFIG) 11else 12Kconfig := Kconfig 13endif 14 --- 35 unchanged lines hidden (view full) --- 50 $< $(silent) --oldconfig $(Kconfig); \ 51 mv -f .config.old.1 .config.old) \ 52 else \ 53 mv -f .tmp.config .config; \ 54 $< $(silent) --oldconfig $(Kconfig); \ 55 fi 56 $(Q)rm -f .tmp.config 57 | 7 localmodconfig localyesconfig 8 9ifdef KBUILD_KCONFIG 10Kconfig := $(KBUILD_KCONFIG) 11else 12Kconfig := Kconfig 13endif 14 --- 35 unchanged lines hidden (view full) --- 50 $< $(silent) --oldconfig $(Kconfig); \ 51 mv -f .config.old.1 .config.old) \ 52 else \ 53 mv -f .tmp.config .config; \ 54 $< $(silent) --oldconfig $(Kconfig); \ 55 fi 56 $(Q)rm -f .tmp.config 57 |
58# Create new linux.pot file 59# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 60update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h 61 $(Q)$(kecho) " GEN config.pot" 62 $(Q)xgettext --default-domain=linux \ 63 --add-comments --keyword=_ --keyword=N_ \ 64 --from-code=UTF-8 \ 65 --files-from=$(srctree)/scripts/kconfig/POTFILES.in \ 66 --directory=$(srctree) --directory=$(objtree) \ 67 --output $(obj)/config.pot 68 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot 69 $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ 70 $(srctree)/arch/*/um/Kconfig`; \ 71 do \ 72 $(kecho) " GEN $$i"; \ 73 $(obj)/kxgettext $$i \ 74 >> $(obj)/config.pot; \ 75 done ) 76 $(Q)$(kecho) " GEN linux.pot" 77 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 78 --output $(obj)/linux.pot 79 $(Q)rm -f $(obj)/config.pot 80 | |
81# These targets map 1:1 to the commandline options of 'conf' 82simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ 83 alldefconfig randconfig listnewconfig olddefconfig 84PHONY += $(simple-targets) 85 86$(simple-targets): $(obj)/conf 87 $< $(silent) --$@ $(Kconfig) 88 --- 78 unchanged lines hidden (view full) --- 167 @echo ' alldefconfig - New config with all symbols set to default' 168 @echo ' randconfig - New config with random answer to all options' 169 @echo ' listnewconfig - List new options' 170 @echo ' olddefconfig - Same as oldconfig but sets new symbols to their' 171 @echo ' default value without prompting' 172 @echo ' kvmconfig - Enable additional options for kvm guest kernel support' 173 @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' 174 @echo ' tinyconfig - Configure the tiniest possible kernel' | 58# These targets map 1:1 to the commandline options of 'conf' 59simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ 60 alldefconfig randconfig listnewconfig olddefconfig 61PHONY += $(simple-targets) 62 63$(simple-targets): $(obj)/conf 64 $< $(silent) --$@ $(Kconfig) 65 --- 78 unchanged lines hidden (view full) --- 144 @echo ' alldefconfig - New config with all symbols set to default' 145 @echo ' randconfig - New config with random answer to all options' 146 @echo ' listnewconfig - List new options' 147 @echo ' olddefconfig - Same as oldconfig but sets new symbols to their' 148 @echo ' default value without prompting' 149 @echo ' kvmconfig - Enable additional options for kvm guest kernel support' 150 @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' 151 @echo ' tinyconfig - Configure the tiniest possible kernel' |
152 @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' |
|
175 | 153 |
176# lxdialog stuff 177check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 178 179# Use recursively expanded variables so we do not call gcc unless 180# we really need to do so. (Do not call gcc as part of make mrproper) 181HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ 182 -DLOCALE 183 | |
184# =========================================================================== 185# Shared Makefile for the various kconfig executables: 186# conf: Used for defconfig, oldconfig and related targets | 154# =========================================================================== 155# Shared Makefile for the various kconfig executables: 156# conf: Used for defconfig, oldconfig and related targets |
187# nconf: Used for the nconfig target. 188# Utilizes ncurses 189# mconf: Used for the menuconfig target 190# Utilizes the lxdialog package 191# qconf: Used for the xconfig target 192# Based on Qt which needs to be installed to compile it 193# gconf: Used for the gconfig target 194# Based on GTK+ which needs to be installed to compile it | |
195# object files used by all kconfig flavours 196 | 157# object files used by all kconfig flavours 158 |
197lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o 198lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o 199 | |
200conf-objs := conf.o zconf.tab.o | 159conf-objs := conf.o zconf.tab.o |
201mconf-objs := mconf.o zconf.tab.o $(lxdialog) 202nconf-objs := nconf.o zconf.tab.o nconf.gui.o 203kxgettext-objs := kxgettext.o zconf.tab.o 204qconf-cxxobjs := qconf.o 205qconf-objs := zconf.tab.o 206gconf-objs := gconf.o zconf.tab.o | |
207 | 160 |
208hostprogs-y := conf nconf mconf kxgettext qconf gconf | 161hostprogs-y := conf |
209 210targets += zconf.lex.c | 162 163targets += zconf.lex.c |
211clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck 212clean-files += gconf.glade.h 213clean-files += config.pot linux.pot | |
214 | 164 |
215# Check that we have the required ncurses stuff installed for lxdialog (menuconfig) 216PHONY += $(obj)/dochecklxdialog 217$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog 218$(obj)/dochecklxdialog: 219 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf) 220 221always := dochecklxdialog 222 223# Add environment specific flags 224HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) 225HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS)) 226 | |
227# generated files seem to need this to find local include files 228HOSTCFLAGS_zconf.lex.o := -I$(src) 229HOSTCFLAGS_zconf.tab.o := -I$(src) 230 | 165# generated files seem to need this to find local include files 166HOSTCFLAGS_zconf.lex.o := -I$(src) 167HOSTCFLAGS_zconf.tab.o := -I$(src) 168 |
231HOSTLOADLIBES_qconf = $(KC_QT_LIBS) 232HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) | 169# nconf: Used for the nconfig target based on ncurses 170hostprogs-y += nconf 171nconf-objs := nconf.o zconf.tab.o nconf.gui.o |
233 | 172 |
234HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` 235HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 236 -Wno-missing-prototypes | 173HOSTLOADLIBES_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) 174HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 175HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) |
237 | 176 |
238HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | 177$(obj)/nconf.o: $(obj)/.nconf-cfg |
239 | 178 |
240HOSTLOADLIBES_nconf = $(shell \ 241 pkg-config --libs menuw panelw ncursesw 2>/dev/null \ 242 || pkg-config --libs menu panel ncurses 2>/dev/null \ 243 || echo "-lmenu -lpanel -lncurses" ) 244$(obj)/qconf.o: $(obj)/.tmp_qtcheck | 179# mconf: Used for the menuconfig target based on lxdialog 180hostprogs-y += mconf 181lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o 182mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) |
245 | 183 |
246ifeq ($(MAKECMDGOALS),xconfig) 247$(obj)/.tmp_qtcheck: $(src)/Makefile 248-include $(obj)/.tmp_qtcheck | 184HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) 185$(foreach f, mconf.o $(lxdialog), \ 186 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) |
249 | 187 |
250# Qt needs some extra effort... 251$(obj)/.tmp_qtcheck: 252 @set -e; $(kecho) " CHECK qt"; \ 253 if pkg-config --exists Qt5Core; then \ 254 cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ 255 libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \ 256 moc=`pkg-config --variable=host_bins Qt5Core`/moc; \ 257 elif pkg-config --exists QtCore; then \ 258 cflags=`pkg-config --cflags QtCore QtGui`; \ 259 libs=`pkg-config --libs QtCore QtGui`; \ 260 moc=`pkg-config --variable=moc_location QtCore`; \ 261 else \ 262 echo >&2 "*"; \ 263 echo >&2 "* Could not find Qt via pkg-config."; \ 264 echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \ 265 echo >&2 "*"; \ 266 exit 1; \ 267 fi; \ 268 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 269 echo "KC_QT_LIBS=$$libs" >> $@; \ 270 echo "KC_QT_MOC=$$moc" >> $@ 271endif | 188$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg |
272 | 189 |
273$(obj)/gconf.o: $(obj)/.tmp_gtkcheck | 190# qconf: Used for the xconfig target based on Qt 191hostprogs-y += qconf 192qconf-cxxobjs := qconf.o 193qconf-objs := zconf.tab.o |
274 | 194 |
275ifeq ($(MAKECMDGOALS),gconfig) 276-include $(obj)/.tmp_gtkcheck | 195HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) 196HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) |
277 | 197 |
278# GTK+ needs some extra effort, too... 279$(obj)/.tmp_gtkcheck: 280 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ 281 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ 282 touch $@; \ 283 else \ 284 echo >&2 "*"; \ 285 echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \ 286 echo >&2 "*"; \ 287 false; \ 288 fi \ 289 else \ 290 echo >&2 "*"; \ 291 echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \ 292 echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \ 293 echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ 294 echo >&2 "*"; \ 295 false; \ 296 fi 297endif | 198$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc |
298 | 199 |
299$(obj)/zconf.tab.o: $(obj)/zconf.lex.c 300 301$(obj)/qconf.o: $(obj)/qconf.moc 302 | |
303quiet_cmd_moc = MOC $@ | 200quiet_cmd_moc = MOC $@ |
304 cmd_moc = $(KC_QT_MOC) -i $< -o $@ | 201 cmd_moc = $(shell . $(obj)/.qconf-cfg && echo $$moc) -i $< -o $@ |
305 | 202 |
306$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck | 203$(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg |
307 $(call cmd,moc) 308 | 204 $(call cmd,moc) 205 |
309# Extract gconf menu items for i18n support 310$(obj)/gconf.glade.h: $(obj)/gconf.glade 311 $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ 312 $(obj)/gconf.glade | 206# gconf: Used for the gconfig target based on GTK+ 207hostprogs-y += gconf 208gconf-objs := gconf.o zconf.tab.o 209 210HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) 211HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) 212 213$(obj)/gconf.o: $(obj)/.gconf-cfg 214 215$(obj)/zconf.tab.o: $(obj)/zconf.lex.c 216 217# check if necessary packages are available, and configure build flags 218define filechk_conf_cfg 219 $(CONFIG_SHELL) $< 220endef 221 222$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE 223 $(call filechk,conf_cfg) 224 225clean-files += .*conf-cfg |