]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | # SPDX-License-Identifier: GPL-2.0 |
0a9064fb MY |
2 | # =========================================================================== |
3 | # Kernel configuration targets | |
4 | # These targets are used from top-level makefile | |
5 | ||
587e4a42 TR |
6 | PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \ |
7 | build_menuconfig build_nconfig build_gconfig build_xconfig | |
0a9064fb | 8 | |
5f9eb220 MY |
9 | # Added for U-Boot |
10 | # Linux has defconfig files in arch/$(SRCARCH)/configs/, | |
11 | # on the other hand, U-Boot does in configs/. | |
12 | # Set SRCARCH to .. fake this Makefile. | |
13 | SRCARCH := .. | |
14 | ||
0a9064fb MY |
15 | ifdef KBUILD_KCONFIG |
16 | Kconfig := $(KBUILD_KCONFIG) | |
17 | else | |
18 | Kconfig := Kconfig | |
19 | endif | |
20 | ||
9b5f0b1d MY |
21 | ifeq ($(quiet),silent_) |
22 | silent := -s | |
23 | endif | |
24 | ||
0a9064fb MY |
25 | # We need this, in case the user has it in its environment |
26 | unexport CONFIG_ | |
27 | ||
28 | xconfig: $(obj)/qconf | |
9b5f0b1d | 29 | $< $(silent) $(Kconfig) |
0a9064fb MY |
30 | |
31 | gconfig: $(obj)/gconf | |
9b5f0b1d | 32 | $< $(silent) $(Kconfig) |
0a9064fb MY |
33 | |
34 | menuconfig: $(obj)/mconf | |
9b5f0b1d | 35 | $< $(silent) $(Kconfig) |
0a9064fb MY |
36 | |
37 | config: $(obj)/conf | |
9b5f0b1d | 38 | $< $(silent) --oldaskconfig $(Kconfig) |
0a9064fb MY |
39 | |
40 | nconfig: $(obj)/nconf | |
9b5f0b1d | 41 | $< $(silent) $(Kconfig) |
0a9064fb | 42 | |
587e4a42 TR |
43 | build_menuconfig: $(obj)/mconf |
44 | ||
45 | build_nconfig: $(obj)/nconf | |
46 | ||
47 | build_gconfig: $(obj)/gconf | |
48 | ||
49 | build_xconfig: $(obj)/qconf | |
0a9064fb | 50 | |
e91610da | 51 | localyesconfig localmodconfig: $(obj)/conf |
e91610da | 52 | $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config |
0cf207ec | 53 | $(Q)if [ -f .config ]; then \ |
0a9064fb MY |
54 | cmp -s .tmp.config .config || \ |
55 | (mv -f .config .config.old.1; \ | |
56 | mv -f .tmp.config .config; \ | |
e91610da | 57 | $< $(silent) --oldconfig $(Kconfig); \ |
0a9064fb MY |
58 | mv -f .config.old.1 .config.old) \ |
59 | else \ | |
60 | mv -f .tmp.config .config; \ | |
e91610da | 61 | $< $(silent) --oldconfig $(Kconfig); \ |
0a9064fb MY |
62 | fi |
63 | $(Q)rm -f .tmp.config | |
64 | ||
9b5f0b1d | 65 | # These targets map 1:1 to the commandline options of 'conf' |
587e4a42 TR |
66 | # |
67 | # Note: | |
68 | # syncconfig has become an internal implementation detail and is now | |
69 | # deprecated for external use | |
9b5f0b1d | 70 | simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ |
587e4a42 | 71 | alldefconfig randconfig listnewconfig olddefconfig syncconfig |
9b5f0b1d | 72 | PHONY += $(simple-targets) |
0a9064fb | 73 | |
9b5f0b1d MY |
74 | $(simple-targets): $(obj)/conf |
75 | $< $(silent) --$@ $(Kconfig) | |
0a9064fb | 76 | |
473fc279 | 77 | PHONY += savedefconfig defconfig |
0a9064fb MY |
78 | |
79 | savedefconfig: $(obj)/conf | |
9b5f0b1d | 80 | $< $(silent) --$@=defconfig $(Kconfig) |
0a9064fb MY |
81 | |
82 | defconfig: $(obj)/conf | |
83 | ifeq ($(KBUILD_DEFCONFIG),) | |
9b5f0b1d | 84 | $< $(silent) --defconfig $(Kconfig) |
0a9064fb | 85 | else |
bf7ab1e7 | 86 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),) |
9b5f0b1d MY |
87 | @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" |
88 | $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) | |
bf7ab1e7 MY |
89 | else |
90 | @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'" | |
91 | $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) | |
92 | endif | |
0a9064fb MY |
93 | endif |
94 | ||
95 | %_defconfig: $(obj)/conf | |
9b5f0b1d | 96 | $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) |
0a9064fb | 97 | |
5f9eb220 MY |
98 | # Added for U-Boot (backward compatibility) |
99 | %_config: %_defconfig | |
100 | @: | |
101 | ||
06b51f77 JK |
102 | configfiles=$(wildcard $(srctree)/kernel/configs/$@ \ |
103 | $(srctree)/arch/$(SRCARCH)/configs/$@ \ | |
104 | $(shell find $(srctree)/board -name "$@")) | |
ad618992 | 105 | |
9b5f0b1d MY |
106 | %.config: $(obj)/conf |
107 | $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) | |
108 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles) | |
109 | +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig | |
ad618992 MY |
110 | |
111 | PHONY += kvmconfig | |
9b5f0b1d MY |
112 | kvmconfig: kvm_guest.config |
113 | @: | |
ad618992 | 114 | |
bf7ab1e7 MY |
115 | PHONY += xenconfig |
116 | xenconfig: xen.config | |
117 | @: | |
118 | ||
ad618992 | 119 | PHONY += tinyconfig |
9b5f0b1d MY |
120 | tinyconfig: |
121 | $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config | |
ad618992 | 122 | |
e91610da ER |
123 | # CHECK: -o cache_dir=<path> working? |
124 | PHONY += testconfig | |
125 | testconfig: $(obj)/conf | |
126 | $(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ | |
127 | -o cache_dir=$(abspath $(obj)/tests/.cache) \ | |
128 | $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) | |
129 | clean-dirs += tests/.cache | |
130 | ||
0a9064fb MY |
131 | # Help text used by make help |
132 | help: | |
133 | @echo ' config - Update current config utilising a line-oriented program' | |
5972ff07 | 134 | @echo ' nconfig - Update current config utilising a ncurses menu based program' |
0a9064fb | 135 | @echo ' menuconfig - Update current config utilising a menu based program' |
bf7ab1e7 MY |
136 | @echo ' xconfig - Update current config utilising a Qt based front-end' |
137 | @echo ' gconfig - Update current config utilising a GTK+ based front-end' | |
0a9064fb MY |
138 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
139 | @echo ' localmodconfig - Update current config disabling modules not loaded' | |
140 | @echo ' localyesconfig - Update current config converting local mods to core' | |
0a9064fb MY |
141 | @echo ' defconfig - New config with default from ARCH supplied defconfig' |
142 | @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' | |
143 | @echo ' allnoconfig - New config where all options are answered with no' | |
144 | @echo ' allyesconfig - New config where all options are accepted with yes' | |
145 | @echo ' allmodconfig - New config selecting modules when possible' | |
146 | @echo ' alldefconfig - New config with all symbols set to default' | |
147 | @echo ' randconfig - New config with random answer to all options' | |
148 | @echo ' listnewconfig - List new options' | |
e91610da ER |
149 | @echo ' olddefconfig - Same as oldconfig but sets new symbols to their' |
150 | @echo ' default value without prompting' | |
bf7ab1e7 MY |
151 | # @echo ' kvmconfig - Enable additional options for kvm guest kernel support' |
152 | # @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' | |
ad618992 | 153 | # @echo ' tinyconfig - Configure the tiniest possible kernel' |
5972ff07 | 154 | @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' |
0a9064fb MY |
155 | |
156 | # =========================================================================== | |
157 | # Shared Makefile for the various kconfig executables: | |
158 | # conf: Used for defconfig, oldconfig and related targets | |
0a9064fb MY |
159 | # object files used by all kconfig flavours |
160 | ||
0a9064fb | 161 | conf-objs := conf.o zconf.tab.o |
0a9064fb | 162 | |
5972ff07 | 163 | hostprogs-y := conf |
0a9064fb | 164 | |
e91610da | 165 | targets += zconf.lex.c |
0a9064fb MY |
166 | |
167 | # generated files seem to need this to find local include files | |
168 | HOSTCFLAGS_zconf.lex.o := -I$(src) | |
169 | HOSTCFLAGS_zconf.tab.o := -I$(src) | |
170 | ||
5972ff07 TR |
171 | # nconf: Used for the nconfig target based on ncurses |
172 | hostprogs-y += nconf | |
173 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o | |
0a9064fb | 174 | |
587e4a42 | 175 | HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) |
5972ff07 TR |
176 | HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) |
177 | HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) | |
0a9064fb | 178 | |
587e4a42 | 179 | $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg |
5972ff07 TR |
180 | |
181 | # mconf: Used for the menuconfig target based on lxdialog | |
182 | hostprogs-y += mconf | |
183 | lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o | |
184 | mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) | |
0a9064fb | 185 | |
587e4a42 | 186 | HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) |
5972ff07 TR |
187 | $(foreach f, mconf.o $(lxdialog), \ |
188 | $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) | |
189 | ||
587e4a42 TR |
190 | $(obj)/mconf.o: $(obj)/.mconf-cfg |
191 | $(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg | |
5972ff07 TR |
192 | |
193 | # qconf: Used for the xconfig target based on Qt | |
194 | hostprogs-y += qconf | |
195 | qconf-cxxobjs := qconf.o | |
196 | qconf-objs := zconf.tab.o | |
197 | ||
587e4a42 | 198 | HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) |
5972ff07 TR |
199 | HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) |
200 | ||
201 | $(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc | |
0a9064fb MY |
202 | |
203 | quiet_cmd_moc = MOC $@ | |
5972ff07 | 204 | cmd_moc = $(shell . $(obj)/.qconf-cfg && echo $$moc) -i $< -o $@ |
0a9064fb | 205 | |
5972ff07 | 206 | $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg |
0a9064fb MY |
207 | $(call cmd,moc) |
208 | ||
5972ff07 TR |
209 | # gconf: Used for the gconfig target based on GTK+ |
210 | hostprogs-y += gconf | |
211 | gconf-objs := gconf.o zconf.tab.o | |
212 | ||
587e4a42 | 213 | HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) |
5972ff07 TR |
214 | HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) |
215 | ||
216 | $(obj)/gconf.o: $(obj)/.gconf-cfg | |
217 | ||
218 | $(obj)/zconf.tab.o: $(obj)/zconf.lex.c | |
219 | ||
220 | # check if necessary packages are available, and configure build flags | |
221 | define filechk_conf_cfg | |
222 | $(CONFIG_SHELL) $< | |
223 | endef | |
224 | ||
225 | $(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE | |
226 | $(call filechk,conf_cfg) | |
227 | ||
228 | clean-files += .*conf-cfg |