]> git.ipfire.org Git - people/ms/u-boot.git/blame - scripts/kconfig/Makefile
kconfig: sync with Linux 4.1
[people/ms/u-boot.git] / scripts / kconfig / Makefile
CommitLineData
0a9064fb
MY
1# ===========================================================================
2# Kernel configuration targets
3# These targets are used from top-level makefile
4
9b5f0b1d 5PHONY += xconfig gconfig menuconfig config silentoldconfig update-po-config \
0a9064fb
MY
6 localmodconfig localyesconfig
7
5f9eb220
MY
8# Added for U-Boot
9# Linux has defconfig files in arch/$(SRCARCH)/configs/,
10# on the other hand, U-Boot does in configs/.
11# Set SRCARCH to .. fake this Makefile.
12SRCARCH := ..
13
0a9064fb
MY
14ifdef KBUILD_KCONFIG
15Kconfig := $(KBUILD_KCONFIG)
16else
17Kconfig := Kconfig
18endif
19
9b5f0b1d
MY
20ifeq ($(quiet),silent_)
21silent := -s
22endif
23
0a9064fb
MY
24# We need this, in case the user has it in its environment
25unexport CONFIG_
26
27xconfig: $(obj)/qconf
9b5f0b1d 28 $< $(silent) $(Kconfig)
0a9064fb
MY
29
30gconfig: $(obj)/gconf
9b5f0b1d 31 $< $(silent) $(Kconfig)
0a9064fb
MY
32
33menuconfig: $(obj)/mconf
9b5f0b1d 34 $< $(silent) $(Kconfig)
0a9064fb
MY
35
36config: $(obj)/conf
9b5f0b1d 37 $< $(silent) --oldaskconfig $(Kconfig)
0a9064fb
MY
38
39nconfig: $(obj)/nconf
9b5f0b1d 40 $< $(silent) $(Kconfig)
0a9064fb
MY
41
42silentoldconfig: $(obj)/conf
43 $(Q)mkdir -p include/config include/generated
9b5f0b1d 44 $< $(silent) --$@ $(Kconfig)
0a9064fb
MY
45
46localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
47 $(Q)mkdir -p include/config include/generated
48 $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
49 $(Q)if [ -f .config ]; then \
50 cmp -s .tmp.config .config || \
51 (mv -f .config .config.old.1; \
52 mv -f .tmp.config .config; \
9b5f0b1d 53 $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
0a9064fb
MY
54 mv -f .config.old.1 .config.old) \
55 else \
56 mv -f .tmp.config .config; \
9b5f0b1d 57 $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
0a9064fb
MY
58 fi
59 $(Q)rm -f .tmp.config
60
61# Create new linux.pot file
62# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
63update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
9b5f0b1d 64 $(Q)$(kecho) " GEN config.pot"
0a9064fb
MY
65 $(Q)xgettext --default-domain=linux \
66 --add-comments --keyword=_ --keyword=N_ \
67 --from-code=UTF-8 \
68 --files-from=$(srctree)/scripts/kconfig/POTFILES.in \
69 --directory=$(srctree) --directory=$(objtree) \
70 --output $(obj)/config.pot
71 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
72 $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
73 $(srctree)/arch/*/um/Kconfig`; \
74 do \
9b5f0b1d 75 $(kecho) " GEN $$i"; \
0a9064fb
MY
76 $(obj)/kxgettext $$i \
77 >> $(obj)/config.pot; \
78 done )
9b5f0b1d 79 $(Q)$(kecho) " GEN linux.pot"
0a9064fb
MY
80 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
81 --output $(obj)/linux.pot
82 $(Q)rm -f $(obj)/config.pot
83
9b5f0b1d
MY
84# These targets map 1:1 to the commandline options of 'conf'
85simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
86 alldefconfig randconfig listnewconfig olddefconfig
87PHONY += $(simple-targets)
0a9064fb 88
9b5f0b1d
MY
89$(simple-targets): $(obj)/conf
90 $< $(silent) --$@ $(Kconfig)
0a9064fb 91
9b5f0b1d 92PHONY += oldnoconfig savedefconfig defconfig
0a9064fb
MY
93
94# oldnoconfig is an alias of olddefconfig, because people already are dependent
95# on its behavior(sets new symbols to their default value but not 'n') with the
96# counter-intuitive name.
9b5f0b1d 97oldnoconfig: olddefconfig
0a9064fb
MY
98
99savedefconfig: $(obj)/conf
9b5f0b1d 100 $< $(silent) --$@=defconfig $(Kconfig)
0a9064fb
MY
101
102defconfig: $(obj)/conf
103ifeq ($(KBUILD_DEFCONFIG),)
9b5f0b1d 104 $< $(silent) --defconfig $(Kconfig)
0a9064fb 105else
9b5f0b1d
MY
106 @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
107 $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
0a9064fb
MY
108endif
109
110%_defconfig: $(obj)/conf
9b5f0b1d 111 $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
0a9064fb 112
5f9eb220
MY
113# Added for U-Boot (backward compatibility)
114%_config: %_defconfig
115 @:
116
9b5f0b1d 117configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
ad618992 118
9b5f0b1d
MY
119%.config: $(obj)/conf
120 $(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
121 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles)
122 +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
ad618992
MY
123
124PHONY += kvmconfig
9b5f0b1d
MY
125kvmconfig: kvm_guest.config
126 @:
ad618992
MY
127
128PHONY += tinyconfig
9b5f0b1d
MY
129tinyconfig:
130 $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
ad618992 131
0a9064fb
MY
132# Help text used by make help
133help:
134 @echo ' config - Update current config utilising a line-oriented program'
135 @echo ' nconfig - Update current config utilising a ncurses menu based program'
136 @echo ' menuconfig - Update current config utilising a menu based program'
137 @echo ' xconfig - Update current config utilising a QT based front-end'
138 @echo ' gconfig - Update current config utilising a GTK based front-end'
139 @echo ' oldconfig - Update current config utilising a provided .config as base'
140 @echo ' localmodconfig - Update current config disabling modules not loaded'
141 @echo ' localyesconfig - Update current config converting local mods to core'
142 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
143 @echo ' defconfig - New config with default from ARCH supplied defconfig'
144 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
145 @echo ' allnoconfig - New config where all options are answered with no'
146 @echo ' allyesconfig - New config where all options are accepted with yes'
147 @echo ' allmodconfig - New config selecting modules when possible'
148 @echo ' alldefconfig - New config with all symbols set to default'
149 @echo ' randconfig - New config with random answer to all options'
150 @echo ' listnewconfig - List new options'
151 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
ad618992
MY
152# @echo ' kvmconfig - Enable additional options for guest kernel support'
153# @echo ' tinyconfig - Configure the tiniest possible kernel'
0a9064fb
MY
154
155# lxdialog stuff
156check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
157
158# Use recursively expanded variables so we do not call gcc unless
159# we really need to do so. (Do not call gcc as part of make mrproper)
160HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
161 -DLOCALE
162
163# ===========================================================================
164# Shared Makefile for the various kconfig executables:
165# conf: Used for defconfig, oldconfig and related targets
166# nconf: Used for the nconfig target.
167# Utilizes ncurses
168# mconf: Used for the menuconfig target
169# Utilizes the lxdialog package
170# qconf: Used for the xconfig target
171# Based on QT which needs to be installed to compile it
172# gconf: Used for the gconfig target
173# Based on GTK which needs to be installed to compile it
174# object files used by all kconfig flavours
175
176lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
177lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
178
179conf-objs := conf.o zconf.tab.o
180mconf-objs := mconf.o zconf.tab.o $(lxdialog)
181nconf-objs := nconf.o zconf.tab.o nconf.gui.o
182kxgettext-objs := kxgettext.o zconf.tab.o
183qconf-cxxobjs := qconf.o
184qconf-objs := zconf.tab.o
185gconf-objs := gconf.o zconf.tab.o
186
cb6e7b0d 187hostprogs-y := conf nconf mconf kxgettext qconf gconf
0a9064fb
MY
188
189clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck
190clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
0a9064fb
MY
191clean-files += config.pot linux.pot
192
193# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
194PHONY += $(obj)/dochecklxdialog
195$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
196$(obj)/dochecklxdialog:
197 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
198
199always := dochecklxdialog
200
201# Add environment specific flags
202HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
203
204# generated files seem to need this to find local include files
205HOSTCFLAGS_zconf.lex.o := -I$(src)
206HOSTCFLAGS_zconf.tab.o := -I$(src)
207
208LEX_PREFIX_zconf := zconf
209YACC_PREFIX_zconf := zconf
210
211HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
212HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
213
214HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
215HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
216 -Wno-missing-prototypes
217
218HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
219
220HOSTLOADLIBES_nconf = $(shell \
ad618992
MY
221 pkg-config --libs menuw panelw ncursesw 2>/dev/null \
222 || pkg-config --libs menu panel ncurses 2>/dev/null \
0a9064fb
MY
223 || echo "-lmenu -lpanel -lncurses" )
224$(obj)/qconf.o: $(obj)/.tmp_qtcheck
225
cb6e7b0d 226ifeq ($(MAKECMDGOALS),xconfig)
0a9064fb
MY
227$(obj)/.tmp_qtcheck: $(src)/Makefile
228-include $(obj)/.tmp_qtcheck
229
230# QT needs some extra effort...
231$(obj)/.tmp_qtcheck:
9b5f0b1d 232 @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \
0a9064fb
MY
233 if ! pkg-config --exists QtCore 2> /dev/null; then \
234 echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
235 pkg-config --exists qt 2> /dev/null && pkg=qt; \
236 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
237 if [ -n "$$pkg" ]; then \
238 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
239 libs="\$$(shell pkg-config $$pkg --libs)"; \
240 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
241 dir="$$(pkg-config $$pkg --variable=prefix)"; \
242 else \
243 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
244 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
245 done; \
246 if [ -z "$$dir" ]; then \
247 echo >&2 "*"; \
248 echo >&2 "* Unable to find any QT installation. Please make sure that"; \
249 echo >&2 "* the QT4 or QT3 development package is correctly installed and"; \
250 echo >&2 "* either qmake can be found or install pkg-config or set"; \
251 echo >&2 "* the QTDIR environment variable to the correct location."; \
252 echo >&2 "*"; \
253 false; \
254 fi; \
255 libpath=$$dir/lib; lib=qt; osdir=""; \
256 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
257 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
258 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
259 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
260 cflags="-I$$dir/include"; \
261 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
262 moc="$$dir/bin/moc"; \
263 fi; \
264 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
265 echo "*"; \
266 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
267 echo "*"; \
268 moc="/usr/bin/moc"; \
269 fi; \
270 else \
271 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
272 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
273 moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \
274 [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \
275 fi; \
276 echo "KC_QT_CFLAGS=$$cflags" > $@; \
277 echo "KC_QT_LIBS=$$libs" >> $@; \
278 echo "KC_QT_MOC=$$moc" >> $@
279endif
280
281$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
282
cb6e7b0d 283ifeq ($(MAKECMDGOALS),gconfig)
0a9064fb
MY
284-include $(obj)/.tmp_gtkcheck
285
286# GTK needs some extra effort, too...
287$(obj)/.tmp_gtkcheck:
288 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
289 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
290 touch $@; \
291 else \
292 echo >&2 "*"; \
293 echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \
294 echo >&2 "*"; \
295 false; \
296 fi \
297 else \
298 echo >&2 "*"; \
299 echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \
300 echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \
301 echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
302 echo >&2 "*"; \
303 false; \
304 fi
305endif
306
307$(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c
308
309$(obj)/qconf.o: $(obj)/qconf.moc
310
311quiet_cmd_moc = MOC $@
312 cmd_moc = $(KC_QT_MOC) -i $< -o $@
313
314$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck
315 $(call cmd,moc)
316
317# Extract gconf menu items for I18N support
318$(obj)/gconf.glade.h: $(obj)/gconf.glade
319 $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
320 $(obj)/gconf.glade