]> bbs.cooldavid.org Git - net-next-2.6.git/blame - scripts/kconfig/Makefile
kconfig: Add LSMOD=file to override the lsmod for localmodconfig
[net-next-2.6.git] / scripts / kconfig / Makefile
CommitLineData
1da177e4
LT
1# ===========================================================================
2# Kernel configuration targets
3# These targets are used from top-level makefile
4
03fa25da 5PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
281c9dad 6 localmodconfig localyesconfig
1da177e4 7
61bee204
AV
8ifdef KBUILD_KCONFIG
9Kconfig := $(KBUILD_KCONFIG)
10else
daa93fab 11Kconfig := arch/$(SRCARCH)/Kconfig
61bee204 12endif
e703f75d 13
1da177e4 14xconfig: $(obj)/qconf
e703f75d 15 $< $(Kconfig)
1da177e4
LT
16
17gconfig: $(obj)/gconf
e703f75d 18 $< $(Kconfig)
1da177e4
LT
19
20menuconfig: $(obj)/mconf
e703f75d 21 $< $(Kconfig)
1da177e4
LT
22
23config: $(obj)/conf
e703f75d 24 $< $(Kconfig)
1da177e4
LT
25
26oldconfig: $(obj)/conf
e703f75d 27 $< -o $(Kconfig)
1da177e4
LT
28
29silentoldconfig: $(obj)/conf
32197c7f 30 $(Q)mkdir -p include/generated
e703f75d 31 $< -s $(Kconfig)
1da177e4 32
615f0833
SR
33# if no path is given, then use src directory to find file
34ifdef LSMOD
35LSMOD_F = $(shell if [ `basename $(LSMOD)` == $(LSMOD) ]; then \
36 echo $(objtree)/$(LSMOD); \
37 else \
38 echo $(LSMOD); \
39 fi)
40endif
41
03fa25da 42localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
17263baf 43 $(Q)mkdir -p include/generated
615f0833 44 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
a7c02602
SR
45 $(Q)if [ -f .config ]; then \
46 cmp -s .tmp.config .config || \
47 (mv -f .config .config.old.1; \
48 mv -f .tmp.config .config; \
49 $(obj)/conf -s $(Kconfig); \
50 mv -f .config.old.1 .config.old) \
51 else \
52 mv -f .tmp.config .config; \
53 $(obj)/conf -s $(Kconfig); \
54 fi
03fa25da
SR
55 $(Q)rm -f .tmp.config
56
48586218 57localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
17263baf 58 $(Q)mkdir -p include/generated
615f0833 59 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
281c9dad 60 $(Q)sed -i s/=m/=y/ .tmp.config
a7c02602
SR
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 $(obj)/conf -s $(Kconfig); \
66 mv -f .config.old.1 .config.old) \
67 else \
68 mv -f .tmp.config .config; \
69 $(obj)/conf -s $(Kconfig); \
70 fi
281c9dad
SR
71 $(Q)rm -f .tmp.config
72
1020026f 73# Create new linux.pot file
b70e325c
SR
74# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
75# The symlink is used to repair a deficiency in arch/um
46d26319 76update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
1020026f
EG
77 $(Q)echo " GEN config"
78 $(Q)xgettext --default-domain=linux \
b70e325c
SR
79 --add-comments --keyword=_ --keyword=N_ \
80 --from-code=UTF-8 \
81 --files-from=scripts/kconfig/POTFILES.in \
82 --output $(obj)/config.pot
83 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
84 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
4217516e 85 $(Q)(for i in `ls arch/*/Kconfig`; \
1020026f
EG
86 do \
87 echo " GEN $$i"; \
4217516e 88 $(obj)/kxgettext $$i \
1020026f
EG
89 >> $(obj)/config.pot; \
90 done )
91 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
b70e325c
SR
92 --output $(obj)/linux.pot
93 $(Q)rm -f arch/um/Kconfig.arch
94 $(Q)rm -f $(obj)/config.pot
3b9fa093 95
4f193362 96PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
1da177e4
LT
97
98randconfig: $(obj)/conf
e703f75d 99 $< -r $(Kconfig)
1da177e4
LT
100
101allyesconfig: $(obj)/conf
e703f75d 102 $< -y $(Kconfig)
1da177e4
LT
103
104allnoconfig: $(obj)/conf
e703f75d 105 $< -n $(Kconfig)
1da177e4
LT
106
107allmodconfig: $(obj)/conf
e703f75d 108 $< -m $(Kconfig)
1da177e4
LT
109
110defconfig: $(obj)/conf
111ifeq ($(KBUILD_DEFCONFIG),)
e703f75d 112 $< -d $(Kconfig)
1da177e4 113else
2266cfd5 114 @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
e703f75d 115 $(Q)$< -D arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
1da177e4
LT
116endif
117
118%_defconfig: $(obj)/conf
e703f75d 119 $(Q)$< -D arch/$(SRCARCH)/configs/$@ $(Kconfig)
1da177e4
LT
120
121# Help text used by make help
122help:
123 @echo ' config - Update current config utilising a line-oriented program'
124 @echo ' menuconfig - Update current config utilising a menu based program'
125 @echo ' xconfig - Update current config utilising a QT based front-end'
126 @echo ' gconfig - Update current config utilising a GTK based front-end'
127 @echo ' oldconfig - Update current config utilising a provided .config as base'
03fa25da 128 @echo ' localmodconfig - Update current config disabling modules not loaded'
281c9dad 129 @echo ' localyesconfig - Update current config converting local mods to core'
590a5857 130 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
1da177e4
LT
131 @echo ' randconfig - New config with random answer to all options'
132 @echo ' defconfig - New config with default answer to all options'
133 @echo ' allmodconfig - New config selecting modules when possible'
134 @echo ' allyesconfig - New config where all options are accepted with yes'
e11f0496 135 @echo ' allnoconfig - New config where all options are answered with no'
1da177e4 136
2982de69
SR
137# lxdialog stuff
138check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
139
e9e40e14 140# Use recursively expanded variables so we do not call gcc unless
2982de69
SR
141# we really need to do so. (Do not call gcc as part of make mrproper)
142HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
143HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
144
145HOST_EXTRACFLAGS += -DLOCALE
146
2982de69 147
1da177e4
LT
148# ===========================================================================
149# Shared Makefile for the various kconfig executables:
150# conf: Used for defconfig, oldconfig and related targets
6f26e5e4 151# mconf: Used for the menuconfig target
1da177e4
LT
152# Utilizes the lxdialog package
153# qconf: Used for the xconfig target
154# Based on QT which needs to be installed to compile it
155# gconf: Used for the gconfig target
156# Based on GTK which needs to be installed to compile it
157# object files used by all kconfig flavours
158
2982de69
SR
159lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
160lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
161
1da177e4 162conf-objs := conf.o zconf.tab.o
2982de69 163mconf-objs := mconf.o zconf.tab.o $(lxdialog)
3b9fa093 164kxgettext-objs := kxgettext.o zconf.tab.o
1da177e4 165
c29121b7
SR
166hostprogs-y := conf qconf gconf kxgettext
167
168ifeq ($(MAKECMDGOALS),menuconfig)
169 hostprogs-y += mconf
170endif
171
1da177e4
LT
172ifeq ($(MAKECMDGOALS),xconfig)
173 qconf-target := 1
174endif
175ifeq ($(MAKECMDGOALS),gconfig)
176 gconf-target := 1
177endif
178
179
180ifeq ($(qconf-target),1)
181qconf-cxxobjs := qconf.o
182qconf-objs := kconfig_load.o zconf.tab.o
183endif
184
185ifeq ($(gconf-target),1)
186gconf-objs := gconf.o kconfig_load.o zconf.tab.o
187endif
188
189clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
46d26319 190 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
145c9047 191clean-files += mconf qconf gconf
1020026f 192clean-files += config.pot linux.pot
1da177e4 193
6e588f6d
SR
194# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
195PHONY += $(obj)/dochecklxdialog
196$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
197$(obj)/dochecklxdialog:
198 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
199
200always := dochecklxdialog
201
aa1e5ef5
SR
202# Add environment specific flags
203HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
70a6a0cb 204
1da177e4
LT
205# generated files seem to need this to find local include files
206HOSTCFLAGS_lex.zconf.o := -I$(src)
207HOSTCFLAGS_zconf.tab.o := -I$(src)
208
b3a5225f
RZ
209HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
210HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
1da177e4 211
37193147
AB
212HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
213HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
1da177e4
LT
214 -D LKC_DIRECT_LINK
215
1da177e4
LT
216$(obj)/qconf.o: $(obj)/.tmp_qtcheck
217
218ifeq ($(qconf-target),1)
b3a5225f 219$(obj)/.tmp_qtcheck: $(src)/Makefile
1da177e4
LT
220-include $(obj)/.tmp_qtcheck
221
222# QT needs some extra effort...
223$(obj)/.tmp_qtcheck:
b3a5225f
RZ
224 @set -e; echo " CHECK qt"; dir=""; pkg=""; \
225 pkg-config --exists qt 2> /dev/null && pkg=qt; \
226 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
227 if [ -n "$$pkg" ]; then \
228 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
229 libs="\$$(shell pkg-config $$pkg --libs)"; \
230 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
231 dir="$$(pkg-config $$pkg --variable=prefix)"; \
ab919c06 232 else \
b3a5225f
RZ
233 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
234 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
235 done; \
236 if [ -z "$$dir" ]; then \
237 echo "*"; \
9ae57004
SR
238 echo "* Unable to find the QT3 installation. Please make sure that"; \
239 echo "* the QT3 development package is correctly installed and"; \
b3a5225f
RZ
240 echo "* either install pkg-config or set the QTDIR environment"; \
241 echo "* variable to the correct location."; \
242 echo "*"; \
243 false; \
244 fi; \
245 libpath=$$dir/lib; lib=qt; osdir=""; \
246 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
247 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
248 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
249 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
250 cflags="-I$$dir/include"; \
251 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
252 moc="$$dir/bin/moc"; \
ab919c06 253 fi; \
b3a5225f 254 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
1da177e4 255 echo "*"; \
b3a5225f 256 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
1da177e4 257 echo "*"; \
b3a5225f
RZ
258 moc="/usr/bin/moc"; \
259 fi; \
260 echo "KC_QT_CFLAGS=$$cflags" > $@; \
261 echo "KC_QT_LIBS=$$libs" >> $@; \
262 echo "KC_QT_MOC=$$moc" >> $@
1da177e4
LT
263endif
264
265$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
266
267ifeq ($(gconf-target),1)
268-include $(obj)/.tmp_gtkcheck
269
270# GTK needs some extra effort, too...
271$(obj)/.tmp_gtkcheck:
37193147
AB
272 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
273 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
1da177e4
LT
274 touch $@; \
275 else \
276 echo "*"; \
277 echo "* GTK+ is present but version >= 2.0.0 is required."; \
278 echo "*"; \
279 false; \
280 fi \
281 else \
282 echo "*"; \
283 echo "* Unable to find the GTK+ installation. Please make sure that"; \
284 echo "* the GTK+ 2.0 development package is correctly installed..."; \
285 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
286 echo "*"; \
287 false; \
288 fi
289endif
290
7a88488b 291$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
1da177e4
LT
292
293$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
294
295$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
296
297$(obj)/gconf.o: $(obj)/lkc_defs.h
298
299$(obj)/%.moc: $(src)/%.h
b3a5225f 300 $(KC_QT_MOC) -i $< -o $@
1da177e4
LT
301
302$(obj)/lkc_defs.h: $(src)/lkc_proto.h
303 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
304
46d26319
EG
305# Extract gconf menu items for I18N support
306$(obj)/gconf.glade.h: $(obj)/gconf.glade
307 intltool-extract --type=gettext/glade $(obj)/gconf.glade
1da177e4
LT
308
309###
7a88488b 310# The following requires flex/bison/gperf
1da177e4
LT
311# By default we use the _shipped versions, uncomment the following line if
312# you are modifying the flex/bison src.
313# LKC_GENPARSER := 1
314
315ifdef LKC_GENPARSER
316
491d7110
RZ
317$(obj)/zconf.tab.c: $(src)/zconf.y
318$(obj)/lex.zconf.c: $(src)/zconf.l
7a88488b 319$(obj)/zconf.hash.c: $(src)/zconf.gperf
1da177e4
LT
320
321%.tab.c: %.y
491d7110
RZ
322 bison -l -b $* -p $(notdir $*) $<
323 cp $@ $@_shipped
1da177e4
LT
324
325lex.%.c: %.l
491d7110
RZ
326 flex -L -P$(notdir $*) -o$@ $<
327 cp $@ $@_shipped
1da177e4 328
7a88488b
RZ
329%.hash.c: %.gperf
330 gperf < $< > $@
331 cp $@ $@_shipped
332
1da177e4 333endif