]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | # SPDX-License-Identifier: GPL-2.0 |
1da177e4 LT |
2 | # =========================================================================== |
3 | # Kernel configuration targets | |
4 | # These targets are used from top-level makefile | |
5 | ||
4bf6a9af RD |
6 | PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \ |
7 | build_menuconfig build_nconfig build_gconfig build_xconfig | |
1da177e4 | 8 | |
61bee204 AV |
9 | ifdef KBUILD_KCONFIG |
10 | Kconfig := $(KBUILD_KCONFIG) | |
11 | else | |
838a2e55 | 12 | Kconfig := Kconfig |
61bee204 | 13 | endif |
e703f75d | 14 | |
0a1f00a1 MM |
15 | ifeq ($(quiet),silent_) |
16 | silent := -s | |
17 | endif | |
18 | ||
c2838e6e YM |
19 | # We need this, in case the user has it in its environment |
20 | unexport CONFIG_ | |
21 | ||
1da177e4 | 22 | xconfig: $(obj)/qconf |
23cd88c9 | 23 | $(Q)$< $(silent) $(Kconfig) |
1da177e4 LT |
24 | |
25 | gconfig: $(obj)/gconf | |
23cd88c9 | 26 | $(Q)$< $(silent) $(Kconfig) |
1da177e4 LT |
27 | |
28 | menuconfig: $(obj)/mconf | |
23cd88c9 | 29 | $(Q)$< $(silent) $(Kconfig) |
1da177e4 LT |
30 | |
31 | config: $(obj)/conf | |
23cd88c9 | 32 | $(Q)$< $(silent) --oldaskconfig $(Kconfig) |
1da177e4 | 33 | |
692d97c3 | 34 | nconfig: $(obj)/nconf |
23cd88c9 | 35 | $(Q)$< $(silent) $(Kconfig) |
692d97c3 | 36 | |
4bf6a9af RD |
37 | build_menuconfig: $(obj)/mconf |
38 | ||
39 | build_nconfig: $(obj)/nconf | |
40 | ||
41 | build_gconfig: $(obj)/gconf | |
42 | ||
43 | build_xconfig: $(obj)/qconf | |
44 | ||
2a616258 | 45 | localyesconfig localmodconfig: $(obj)/conf |
c8138a57 | 46 | $(Q)$(PERL) $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config |
1d135237 MY |
47 | $(Q)if [ -f .config ]; then \ |
48 | cmp -s .tmp.config .config || \ | |
49 | (mv -f .config .config.old.1; \ | |
50 | mv -f .tmp.config .config; \ | |
51 | $< $(silent) --oldconfig $(Kconfig); \ | |
52 | mv -f .config.old.1 .config.old) \ | |
53 | else \ | |
54 | mv -f .tmp.config .config; \ | |
55 | $< $(silent) --oldconfig $(Kconfig); \ | |
a7c02602 | 56 | fi |
03fa25da SR |
57 | $(Q)rm -f .tmp.config |
58 | ||
1cba0c30 | 59 | # These targets map 1:1 to the commandline options of 'conf' |
79123b13 MY |
60 | # |
61 | # Note: | |
62 | # syncconfig has become an internal implementation detail and is now | |
63 | # deprecated for external use | |
1cba0c30 | 64 | simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ |
5d8b42aa | 65 | alldefconfig randconfig listnewconfig olddefconfig syncconfig \ |
89b90609 | 66 | helpnewconfig yes2modconfig mod2yesconfig |
5d8b42aa | 67 | |
1cba0c30 | 68 | PHONY += $(simple-targets) |
1da177e4 | 69 | |
1cba0c30 | 70 | $(simple-targets): $(obj)/conf |
23cd88c9 | 71 | $(Q)$< $(silent) --$@ $(Kconfig) |
1da177e4 | 72 | |
0085b419 | 73 | PHONY += savedefconfig defconfig |
911a91c3 | 74 | |
7cf3d73b | 75 | savedefconfig: $(obj)/conf |
23cd88c9 | 76 | $(Q)$< $(silent) --$@=defconfig $(Kconfig) |
7cf3d73b | 77 | |
1da177e4 | 78 | defconfig: $(obj)/conf |
e0a26686 | 79 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),) |
0a1f00a1 MM |
80 | @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" |
81 | $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) | |
d2036f30 ME |
82 | else |
83 | @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'" | |
84 | $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) | |
1da177e4 LT |
85 | endif |
86 | ||
87 | %_defconfig: $(obj)/conf | |
0a1f00a1 | 88 | $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) |
1da177e4 | 89 | |
63a91033 | 90 | configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@) |
3aaefce1 | 91 | |
63a91033 MY |
92 | %.config: $(obj)/conf |
93 | $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) | |
94 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles) | |
3266c806 | 95 | $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig |
3aaefce1 | 96 | |
0da1d4a0 | 97 | PHONY += tinyconfig |
63a91033 MY |
98 | tinyconfig: |
99 | $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config | |
0da1d4a0 | 100 | |
022a4bf6 MY |
101 | # CHECK: -o cache_dir=<path> working? |
102 | PHONY += testconfig | |
103 | testconfig: $(obj)/conf | |
23cd88c9 | 104 | $(Q)$(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ |
022a4bf6 MY |
105 | -o cache_dir=$(abspath $(obj)/tests/.cache) \ |
106 | $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) | |
1634f2bf | 107 | clean-files += tests/.cache |
022a4bf6 | 108 | |
1da177e4 LT |
109 | # Help text used by make help |
110 | help: | |
111 | @echo ' config - Update current config utilising a line-oriented program' | |
bb6d83dd | 112 | @echo ' nconfig - Update current config utilising a ncurses menu based program' |
1da177e4 | 113 | @echo ' menuconfig - Update current config utilising a menu based program' |
092373c2 | 114 | @echo ' xconfig - Update current config utilising a Qt based front-end' |
39c3f1ba | 115 | @echo ' gconfig - Update current config utilising a GTK+ based front-end' |
1da177e4 | 116 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
03fa25da | 117 | @echo ' localmodconfig - Update current config disabling modules not loaded' |
c027b02d | 118 | @echo ' except those preserved by LMC_KEEP environment variable' |
281c9dad | 119 | @echo ' localyesconfig - Update current config converting local mods to core' |
c027b02d | 120 | @echo ' except those preserved by LMC_KEEP environment variable' |
0748cb3e | 121 | @echo ' defconfig - New config with default from ARCH supplied defconfig' |
7cf3d73b | 122 | @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' |
e11f0496 | 123 | @echo ' allnoconfig - New config where all options are answered with no' |
0748cb3e SR |
124 | @echo ' allyesconfig - New config where all options are accepted with yes' |
125 | @echo ' allmodconfig - New config selecting modules when possible' | |
126 | @echo ' alldefconfig - New config with all symbols set to default' | |
127 | @echo ' randconfig - New config with random answer to all options' | |
89b90609 TH |
128 | @echo ' yes2modconfig - Change answers from yes to mod if possible' |
129 | @echo ' mod2yesconfig - Change answers from mod to yes if possible' | |
861b4ea4 | 130 | @echo ' listnewconfig - List new options' |
5d8b42aa | 131 | @echo ' helpnewconfig - List new options and help text' |
cedd55d4 MH |
132 | @echo ' olddefconfig - Same as oldconfig but sets new symbols to their' |
133 | @echo ' default value without prompting' | |
0da1d4a0 | 134 | @echo ' tinyconfig - Configure the tiniest possible kernel' |
d6a0c8a1 | 135 | @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' |
1da177e4 LT |
136 | |
137 | # =========================================================================== | |
1da177e4 | 138 | # object files used by all kconfig flavours |
769a1c02 | 139 | common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \ |
521b29b6 | 140 | symbol.o util.o |
1da177e4 | 141 | |
769a1c02 | 142 | $(obj)/lexer.lex.o: $(obj)/parser.tab.h |
9cc342f6 MY |
143 | HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) |
144 | HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src) | |
1da177e4 | 145 | |
558e78e3 | 146 | # conf: Used for defconfig, oldconfig and related targets |
5f2fb52f | 147 | hostprogs += conf |
558e78e3 MY |
148 | conf-objs := conf.o $(common-objs) |
149 | ||
1c5af5cf | 150 | # nconf: Used for the nconfig target based on ncurses |
5f2fb52f | 151 | hostprogs += nconf |
558e78e3 | 152 | nconf-objs := nconf.o nconf.gui.o $(common-objs) |
1c5af5cf | 153 | |
d86271af MY |
154 | HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs) |
155 | HOSTCFLAGS_nconf.o = $(shell . $(obj)/nconf-cfg && echo $$cflags) | |
156 | HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/nconf-cfg && echo $$cflags) | |
1c5af5cf | 157 | |
d86271af | 158 | $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg |
1c5af5cf MY |
159 | |
160 | # mconf: Used for the menuconfig target based on lxdialog | |
5f2fb52f | 161 | hostprogs += mconf |
54b8ae66 MY |
162 | lxdialog := $(addprefix lxdialog/, \ |
163 | checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) | |
164 | mconf-objs := mconf.o $(lxdialog) $(common-objs) | |
1c5af5cf | 165 | |
d86271af | 166 | HOSTLDLIBS_mconf = $(shell . $(obj)/mconf-cfg && echo $$libs) |
1c5af5cf | 167 | $(foreach f, mconf.o $(lxdialog), \ |
d86271af | 168 | $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/mconf-cfg && echo $$$$cflags))) |
7080e47b | 169 | |
54b8ae66 | 170 | $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg |
0b669a50 MY |
171 | |
172 | # qconf: Used for the xconfig target based on Qt | |
5f2fb52f | 173 | hostprogs += qconf |
0e912c03 | 174 | qconf-cxxobjs := qconf.o qconf-moc.o |
3b541978 | 175 | qconf-objs := images.o $(common-objs) |
0b669a50 | 176 | |
d86271af MY |
177 | HOSTLDLIBS_qconf = $(shell . $(obj)/qconf-cfg && echo $$libs) |
178 | HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/qconf-cfg && echo $$cflags) | |
0e912c03 | 179 | HOSTCXXFLAGS_qconf-moc.o = $(shell . $(obj)/qconf-cfg && echo $$cflags) |
0b669a50 | 180 | |
0e912c03 | 181 | $(obj)/qconf.o: $(obj)/qconf-cfg |
0b669a50 MY |
182 | |
183 | quiet_cmd_moc = MOC $@ | |
0e912c03 | 184 | cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) $< -o $@ |
0b669a50 | 185 | |
0e912c03 | 186 | $(obj)/qconf-moc.cc: $(src)/qconf.h $(obj)/qconf-cfg FORCE |
c3cd7cfa MY |
187 | $(call if_changed,moc) |
188 | ||
0e912c03 | 189 | targets += qconf-moc.cc |
1da177e4 | 190 | |
b464ef58 | 191 | # gconf: Used for the gconfig target based on GTK+ |
5f2fb52f | 192 | hostprogs += gconf |
3b541978 | 193 | gconf-objs := gconf.o images.o $(common-objs) |
b464ef58 | 194 | |
d86271af MY |
195 | HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs) |
196 | HOSTCFLAGS_gconf.o = $(shell . $(obj)/gconf-cfg && echo $$cflags) | |
b464ef58 | 197 | |
d86271af | 198 | $(obj)/gconf.o: $(obj)/gconf-cfg |
1da177e4 | 199 | |
0b669a50 | 200 | # check if necessary packages are available, and configure build flags |
ba97df45 | 201 | filechk_conf_cfg = $(CONFIG_SHELL) $< |
0b669a50 | 202 | |
d86271af | 203 | $(obj)/%conf-cfg: $(src)/%conf-cfg.sh FORCE |
0b669a50 MY |
204 | $(call filechk,conf_cfg) |
205 | ||
2648ca18 | 206 | clean-files += *conf-cfg |