1 # SPDX-License-Identifier: GPL-2.0 << 2 # ============================================ 1 # =========================================================================== 3 # Kernel configuration targets 2 # Kernel configuration targets 4 # These targets are used from top-level makefi 3 # These targets are used from top-level makefile 5 4 6 ifdef KBUILD_KCONFIG !! 5 .PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig 7 Kconfig := $(KBUILD_KCONFIG) << 8 else << 9 Kconfig := Kconfig << 10 endif << 11 << 12 ifndef KBUILD_DEFCONFIG << 13 KBUILD_DEFCONFIG := defconfig << 14 endif << 15 << 16 ifeq ($(quiet),silent_) << 17 silent := -s << 18 endif << 19 << 20 export KCONFIG_DEFCONFIG_LIST := << 21 ifndef cross_compiling << 22 kernel-release := $(shell uname -r) << 23 KCONFIG_DEFCONFIG_LIST += \ << 24 /lib/modules/$(kernel-release)/.config << 25 /etc/kernel-config \ << 26 /boot/config-$(kernel-release) << 27 endif << 28 KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/conf << 29 << 30 ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),) << 31 export KCONFIG_WARN_UNKNOWN_SYMBOLS=1 << 32 endif << 33 6 34 ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) !! 7 xconfig: $(obj)/qconf 35 export KCONFIG_WERROR=1 !! 8 $< arch/$(ARCH)/Kconfig 36 endif << 37 9 38 # We need this, in case the user has it in its !! 10 gconfig: $(obj)/gconf 39 unexport CONFIG_ !! 11 ./$< arch/$(ARCH)/Kconfig 40 12 41 config-prog := conf !! 13 menuconfig: $(obj)/mconf 42 menuconfig-prog := mconf !! 14 $(Q)$(MAKE) $(build)=scripts/lxdialog 43 nconfig-prog := nconf !! 15 $< arch/$(ARCH)/Kconfig 44 gconfig-prog := gconf << 45 xconfig-prog := qconf << 46 16 47 define config_rule !! 17 config: $(obj)/conf 48 PHONY += $(1) !! 18 $< arch/$(ARCH)/Kconfig 49 $(1): $(obj)/$($(1)-prog) << 50 $(Q)$$< $(silent) $(Kconfig) << 51 19 52 PHONY += build_$(1) !! 20 oldconfig: $(obj)/conf 53 build_$(1): $(obj)/$($(1)-prog) !! 21 $< -o arch/$(ARCH)/Kconfig 54 endef << 55 22 56 $(foreach c, config menuconfig nconfig gconfig !! 23 silentoldconfig: $(obj)/conf >> 24 $< -s arch/$(ARCH)/Kconfig 57 25 58 PHONY += localmodconfig localyesconfig !! 26 .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig 59 localyesconfig localmodconfig: $(obj)/conf << 60 $(Q)$(PERL) $(src)/streamline_config.p << 61 $(Q)if [ -f .config ]; then << 62 cmp -s .tmp.config .config || << 63 (mv -f .config .config.old.1; << 64 mv -f .tmp.config .config; << 65 $< $(silent) --oldconfig $(Kc << 66 mv -f .config.old.1 .config.o << 67 else << 68 mv -f .tmp.config .config; << 69 $< $(silent) --oldconfig $(Kco << 70 fi << 71 $(Q)rm -f .tmp.config << 72 27 73 # These targets map 1:1 to the commandline opt !! 28 randconfig: $(obj)/conf 74 # !! 29 $< -r arch/$(ARCH)/Kconfig 75 # Note: << 76 # syncconfig has become an internal implement << 77 # deprecated for external use << 78 simple-targets := oldconfig allnoconfig allyes << 79 alldefconfig randconfig listnewconfig << 80 helpnewconfig yes2modconfig mod2yescon << 81 << 82 PHONY += $(simple-targets) << 83 30 84 $(simple-targets): $(obj)/conf !! 31 allyesconfig: $(obj)/conf 85 $(Q)$< $(silent) --$@ $(Kconfig) !! 32 $< -y arch/$(ARCH)/Kconfig 86 33 87 PHONY += savedefconfig defconfig !! 34 allnoconfig: $(obj)/conf >> 35 $< -n arch/$(ARCH)/Kconfig 88 36 89 savedefconfig: $(obj)/conf !! 37 allmodconfig: $(obj)/conf 90 $(Q)$< $(silent) --$@=defconfig $(Kcon !! 38 $< -m arch/$(ARCH)/Kconfig 91 39 92 defconfig: $(obj)/conf 40 defconfig: $(obj)/conf 93 ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/c !! 41 $< -d arch/$(ARCH)/Kconfig 94 @$(kecho) "*** Default configuration i << 95 $(Q)$< $(silent) --defconfig=arch/$(SR << 96 else << 97 @$(kecho) "*** Default configuration i << 98 $(Q)$(MAKE) -f $(srctree)/Makefile $(K << 99 endif << 100 42 101 %_defconfig: $(obj)/conf 43 %_defconfig: $(obj)/conf 102 $(Q)$< $(silent) --defconfig=arch/$(SR !! 44 $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig 103 << 104 configfiles = $(wildcard $(srctree)/kernel/con << 105 all-config-fragments = $(call configfiles,*.co << 106 config-fragments = $(call configfiles,$@) << 107 << 108 %.config: $(obj)/conf << 109 $(if $(config-fragments),, $(error $@ << 110 $(Q)$(CONFIG_SHELL) $(srctree)/scripts << 111 $(Q)$(MAKE) -f $(srctree)/Makefile old << 112 << 113 PHONY += tinyconfig << 114 tinyconfig: << 115 $(Q)KCONFIG_ALLCONFIG=kernel/configs/t << 116 $(Q)$(MAKE) -f $(srctree)/Makefile tin << 117 << 118 # CHECK: -o cache_dir=<path> working? << 119 PHONY += testconfig << 120 testconfig: $(obj)/conf << 121 $(Q)$(PYTHON3) -B -m pytest $(src)/tes << 122 -o cache_dir=$(abspath $(obj)/tests/.c << 123 $(if $(findstring 1,$(KBUILD_VERBOSE)) << 124 clean-files += tests/.cache << 125 45 126 # Help text used by make help 46 # Help text used by make help 127 help: 47 help: 128 @echo 'Configuration targets:' !! 48 @echo ' oldconfig - Update current config utilising a line-oriented program' 129 @echo ' config - Update cur << 130 @echo ' nconfig - Update cur << 131 @echo ' menuconfig - Update cur 49 @echo ' menuconfig - Update current config utilising a menu based program' 132 @echo ' xconfig - Update cur !! 50 @echo ' xconfig - Update current config utilising a QT based front-end' 133 @echo ' gconfig - Update cur !! 51 @echo ' gconfig - Update current config utilising a GTK based front-end' 134 @echo ' oldconfig - Update cur !! 52 @echo ' defconfig - New config with default answer to all options' 135 @echo ' localmodconfig - Update cur << 136 @echo ' except tho << 137 @echo ' localyesconfig - Update cur << 138 @echo ' except tho << 139 @echo ' defconfig - New config << 140 @echo ' savedefconfig - Save curre << 141 @echo ' allnoconfig - New config << 142 @echo ' allyesconfig - New config << 143 @echo ' allmodconfig - New config 53 @echo ' allmodconfig - New config selecting modules when possible' 144 @echo ' alldefconfig - New config !! 54 @echo ' allyesconfig - New config where all options are accepted with yes' 145 @echo ' randconfig - New config !! 55 @echo ' allnoconfig - New minimal config' 146 @echo ' yes2modconfig - Change ans << 147 @echo ' mod2yesconfig - Change ans << 148 @echo ' mod2noconfig - Change ans << 149 @echo ' listnewconfig - List new o << 150 @echo ' helpnewconfig - List new o << 151 @echo ' olddefconfig - Same as ol << 152 @echo ' default va << 153 @echo ' tinyconfig - Configure << 154 @echo ' testconfig - Run Kconfi << 155 @echo '' << 156 @echo 'Configuration topic targets:' << 157 @$(foreach f, $(all-config-fragments), << 158 if help=$$(grep -m1 '^# Help: << 159 printf ' %-25s - %s\n << 160 fi;) << 161 56 162 # ============================================ 57 # =========================================================================== >> 58 # Shared Makefile for the various kconfig executables: >> 59 # conf: Used for defconfig, oldconfig and related targets >> 60 # mconf: Used for the mconfig target. >> 61 # Utilizes the lxdialog package >> 62 # qconf: Used for the xconfig target >> 63 # Based on QT which needs to be installed to compile it >> 64 # gconf: Used for the gconfig target >> 65 # Based on GTK which needs to be installed to compile it 163 # object files used by all kconfig flavours 66 # object files used by all kconfig flavours 164 common-objs := confdata.o expr.o lexer.lex << 165 preprocess.o symbol.o util. << 166 67 167 $(obj)/lexer.lex.o: $(obj)/parser.tab.h !! 68 libkconfig-objs := zconf.tab.o 168 HOSTCFLAGS_lexer.lex.o := -I $(src) << 169 HOSTCFLAGS_parser.tab.o := -I $(src) << 170 69 171 # conf: Used for defconfig, oldconfig and rela !! 70 host-progs := conf mconf qconf gconf 172 hostprogs += conf !! 71 conf-objs := conf.o libkconfig.so 173 conf-objs := conf.o $(common-objs) !! 72 mconf-objs := mconf.o libkconfig.so 174 73 175 # nconf: Used for the nconfig target based on !! 74 ifeq ($(MAKECMDGOALS),xconfig) 176 hostprogs += nconf !! 75 qconf-target := 1 177 nconf-objs := nconf.o nconf.gui.o mnconf- !! 76 endif >> 77 ifeq ($(MAKECMDGOALS),gconfig) >> 78 gconf-target := 1 >> 79 endif 178 80 179 HOSTLDLIBS_nconf = $(call read-file, $(o << 180 HOSTCFLAGS_nconf.o = $(call read-file, $(o << 181 HOSTCFLAGS_nconf.gui.o = $(call read-file, $(o << 182 81 183 $(obj)/nconf: | $(obj)/nconf-libs !! 82 ifeq ($(qconf-target),1) 184 $(obj)/nconf.o $(obj)/nconf.gui.o: | $(obj)/nc !! 83 qconf-cxxobjs := qconf.o >> 84 qconf-objs := kconfig_load.o >> 85 endif 185 86 186 # mconf: Used for the menuconfig target based !! 87 ifeq ($(gconf-target),1) 187 hostprogs += mconf !! 88 gconf-objs := gconf.o kconfig_load.o 188 lxdialog := $(addprefix lxdialog/, \ !! 89 endif 189 checklist.o inputbox.o me !! 90 190 mconf-objs := mconf.o $(lxdialog) mnconf- !! 91 clean-files := libkconfig.so lkc_defs.h qconf.moc .tmp_qtcheck \ >> 92 .tmp_gtkcheck zconf.tab.c zconf.tab.h lex.zconf.c >> 93 >> 94 # generated files seem to need this to find local include files >> 95 HOSTCFLAGS_lex.zconf.o := -I$(src) >> 96 HOSTCFLAGS_zconf.tab.o := -I$(src) 191 97 192 HOSTLDLIBS_mconf = $(call read-file, $(obj)/mc !! 98 HOSTLOADLIBES_qconf = -L$(QTDIR)/lib -Wl,-rpath,$(QTDIR)/lib -l$(QTLIB) -ldl 193 $(foreach f, mconf.o $(lxdialog), \ !! 99 HOSTCXXFLAGS_qconf.o = -I$(QTDIR)/include 194 $(eval HOSTCFLAGS_$f = $$(call read-file, $( << 195 100 196 $(obj)/mconf: | $(obj)/mconf-libs !! 101 HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs` 197 $(addprefix $(obj)/, mconf.o $(lxdialog)): | $ !! 102 HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` 198 103 199 # qconf: Used for the xconfig target based on !! 104 $(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o: $(obj)/zconf.tab.h 200 hostprogs += qconf << 201 qconf-cxxobjs := qconf.o qconf-moc.o << 202 qconf-objs := images.o $(common-objs) << 203 105 204 HOSTLDLIBS_qconf = $(call read-file, $ !! 106 $(obj)/qconf.o: $(obj)/.tmp_qtcheck 205 HOSTCXXFLAGS_qconf.o = -std=c++11 -fPIC $( << 206 HOSTCXXFLAGS_qconf-moc.o = -std=c++11 -fPIC $( << 207 $(obj)/qconf: | $(obj)/qconf-libs << 208 $(obj)/qconf.o $(obj)/qconf-moc.o: | $(obj)/qc << 209 107 210 quiet_cmd_moc = MOC $@ !! 108 ifeq ($(qconf-target),1) 211 cmd_moc = $(call read-file, $(obj)/qconf !! 109 MOC = $(QTDIR)/bin/moc >> 110 -include $(obj)/.tmp_qtcheck 212 111 213 $(obj)/qconf-moc.cc: $(src)/qconf.h FORCE | $( !! 112 # QT needs some extra effort... 214 $(call if_changed,moc) !! 113 $(obj)/.tmp_qtcheck: >> 114 @set -e; for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ >> 115 if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \ >> 116 done; \ >> 117 if [ -z "$$DIR" ]; then \ >> 118 echo "*"; \ >> 119 echo "* Unable to find the QT installation. Please make sure that the"; \ >> 120 echo "* QT development package is correctly installed and the QTDIR"; \ >> 121 echo "* environment variable is set to the correct location."; \ >> 122 echo "*"; \ >> 123 false; \ >> 124 fi; \ >> 125 LIB=qt; \ >> 126 if [ -f $$DIR/lib/libqt-mt.so ]; then LIB=qt-mt; fi; \ >> 127 echo "QTDIR=$$DIR" > $@; echo "QTLIB=$$LIB" >> $@; \ >> 128 if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \ >> 129 echo "*"; \ >> 130 echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \ >> 131 echo "*"; \ >> 132 echo "MOC=/usr/bin/moc" >> $@; \ >> 133 fi >> 134 endif 215 135 216 targets += qconf-moc.cc !! 136 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck >> 137 >> 138 ifeq ($(gconf-target),1) >> 139 -include $(obj)/.tmp_gtkcheck >> 140 >> 141 # GTK needs some extra effort, too... >> 142 $(obj)/.tmp_gtkcheck: >> 143 @if `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --exists`; then \ >> 144 if `pkg-config gtk+-2.0 --atleast-version=2.0.0`; then \ >> 145 touch $@; \ >> 146 else \ >> 147 echo "*"; \ >> 148 echo "* GTK+ is present but version >= 2.0.0 is required."; \ >> 149 echo "*"; \ >> 150 false; \ >> 151 fi \ >> 152 else \ >> 153 echo "*"; \ >> 154 echo "* Unable to find the GTK+ installation. Please make sure that"; \ >> 155 echo "* the GTK+ 2.0 development package is correctly installed..."; \ >> 156 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ >> 157 echo "*"; \ >> 158 false; \ >> 159 fi >> 160 endif 217 161 218 # gconf: Used for the gconfig target based on !! 162 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c 219 hostprogs += gconf << 220 gconf-objs := gconf.o images.o $(common-o << 221 163 222 HOSTLDLIBS_gconf = $(call read-file, $(obj)/ !! 164 $(obj)/kconfig_load.o: $(obj)/lkc_defs.h 223 HOSTCFLAGS_gconf.o = $(call read-file, $(obj)/ << 224 165 225 $(obj)/gconf: | $(obj)/gconf-libs !! 166 $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h 226 $(obj)/gconf.o: | $(obj)/gconf-cflags << 227 167 228 # check if necessary packages are available, a !! 168 $(obj)/gconf.o: $(obj)/lkc_defs.h 229 cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, << 230 169 231 $(obj)/%conf-cflags $(obj)/%conf-libs $(obj)/% !! 170 $(obj)/%.moc: $(src)/%.h 232 $(call cmd,conf_cfg) !! 171 $(MOC) -i $< -o $@ 233 172 234 clean-files += *conf-cflags *conf-libs *conf-b !! 173 $(obj)/lkc_defs.h: $(src)/lkc_proto.h >> 174 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' >> 175 >> 176 >> 177 ### >> 178 # The following requires flex/bison >> 179 # By default we use the _shipped versions, uncomment the following line if >> 180 # you are modifying the flex/bison src. >> 181 # LKC_GENPARSER := 1 >> 182 >> 183 ifdef LKC_GENPARSER >> 184 >> 185 $(obj)/zconf.tab.c: $(obj)/zconf.y >> 186 $(obj)/zconf.tab.h: $(obj)/zconf.tab.c >> 187 >> 188 %.tab.c: %.y >> 189 bison -t -d -v -b $* -p $(notdir $*) $< >> 190 >> 191 lex.%.c: %.l >> 192 flex -P$(notdir $*) -o$@ $< >> 193 >> 194 endif
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.