]> Git Repo - J-u-boot.git/blame - scripts/kconfig/Makefile
Merge tag 'v2023.10-rc4' into next
[J-u-boot.git] / scripts / kconfig / Makefile
CommitLineData
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
6PHONY += 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.
13SRCARCH := ..
14
0a9064fb
MY
15ifdef KBUILD_KCONFIG
16Kconfig := $(KBUILD_KCONFIG)
17else
18Kconfig := Kconfig
19endif
20
9b5f0b1d
MY
21ifeq ($(quiet),silent_)
22silent := -s
23endif
24
0a9064fb
MY
25# We need this, in case the user has it in its environment
26unexport CONFIG_
27
28xconfig: $(obj)/qconf
9b5f0b1d 29 $< $(silent) $(Kconfig)
0a9064fb
MY
30
31gconfig: $(obj)/gconf
9b5f0b1d 32 $< $(silent) $(Kconfig)
0a9064fb
MY
33
34menuconfig: $(obj)/mconf
9b5f0b1d 35 $< $(silent) $(Kconfig)
0a9064fb
MY
36
37config: $(obj)/conf
9b5f0b1d 38 $< $(silent) --oldaskconfig $(Kconfig)
0a9064fb
MY
39
40nconfig: $(obj)/nconf
9b5f0b1d 41 $< $(silent) $(Kconfig)
0a9064fb 42
587e4a42
TR
43build_menuconfig: $(obj)/mconf
44
45build_nconfig: $(obj)/nconf
46
47build_gconfig: $(obj)/gconf
48
49build_xconfig: $(obj)/qconf
0a9064fb 50
e91610da 51localyesconfig 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 70simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
587e4a42 71 alldefconfig randconfig listnewconfig olddefconfig syncconfig
9b5f0b1d 72PHONY += $(simple-targets)
0a9064fb 73
9b5f0b1d
MY
74$(simple-targets): $(obj)/conf
75 $< $(silent) --$@ $(Kconfig)
0a9064fb 76
473fc279 77PHONY += savedefconfig defconfig
0a9064fb
MY
78
79savedefconfig: $(obj)/conf
9b5f0b1d 80 $< $(silent) --$@=defconfig $(Kconfig)
0a9064fb
MY
81
82defconfig: $(obj)/conf
83ifeq ($(KBUILD_DEFCONFIG),)
9b5f0b1d 84 $< $(silent) --defconfig $(Kconfig)
0a9064fb 85else
bf7ab1e7 86ifneq ($(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
89else
90 @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'"
91 $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG)
92endif
0a9064fb
MY
93endif
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
102configfiles=$(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
111PHONY += kvmconfig
9b5f0b1d
MY
112kvmconfig: kvm_guest.config
113 @:
ad618992 114
bf7ab1e7
MY
115PHONY += xenconfig
116xenconfig: xen.config
117 @:
118
ad618992 119PHONY += tinyconfig
9b5f0b1d
MY
120tinyconfig:
121 $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
ad618992 122
e91610da
ER
123# CHECK: -o cache_dir=<path> working?
124PHONY += testconfig
125testconfig: $(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)
129clean-dirs += tests/.cache
130
0a9064fb
MY
131# Help text used by make help
132help:
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 161conf-objs := conf.o zconf.tab.o
0a9064fb 162
5972ff07 163hostprogs-y := conf
0a9064fb 164
e91610da 165targets += zconf.lex.c
0a9064fb
MY
166
167# generated files seem to need this to find local include files
168HOSTCFLAGS_zconf.lex.o := -I$(src)
169HOSTCFLAGS_zconf.tab.o := -I$(src)
170
5972ff07
TR
171# nconf: Used for the nconfig target based on ncurses
172hostprogs-y += nconf
173nconf-objs := nconf.o zconf.tab.o nconf.gui.o
0a9064fb 174
587e4a42 175HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
5972ff07
TR
176HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
177HOSTCFLAGS_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
182hostprogs-y += mconf
183lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o
184mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog))
0a9064fb 185
587e4a42 186HOSTLDLIBS_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
194hostprogs-y += qconf
195qconf-cxxobjs := qconf.o
196qconf-objs := zconf.tab.o
197
587e4a42 198HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
5972ff07
TR
199HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
200
201$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc
0a9064fb
MY
202
203quiet_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+
210hostprogs-y += gconf
211gconf-objs := gconf.o zconf.tab.o
212
587e4a42 213HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
5972ff07
TR
214HOSTCFLAGS_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
221define filechk_conf_cfg
222 $(CONFIG_SHELL) $<
223endef
224
225$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
226 $(call filechk,conf_cfg)
227
228clean-files += .*conf-cfg
This page took 0.362257 seconds and 4 git commands to generate.