1 # ===========================================================================
2 # Kernel configuration targets
3 # These targets are used from top-level makefile
5 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
8 $< arch/$(ARCH)/Kconfig
11 $< arch/$(ARCH)/Kconfig
13 menuconfig: $(obj)/mconf
14 $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog
15 $< arch/$(ARCH)/Kconfig
18 $< arch/$(ARCH)/Kconfig
20 oldconfig: $(obj)/conf
21 $< -o arch/$(ARCH)/Kconfig
23 silentoldconfig: $(obj)/conf
24 $< -s arch/$(ARCH)/Kconfig
26 nonint_oldconfig: scripts/kconfig/conf
27 ./scripts/kconfig/conf -b arch/$(ARCH)/Kconfig
29 update-po-config: $(obj)/kxgettext
30 xgettext --default-domain=linux \
31 --add-comments --keyword=_ --keyword=N_ \
32 --files-from=scripts/kconfig/POTFILES.in \
33 --output scripts/kconfig/config.pot
34 $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
35 $(Q)for i in `ls arch/`; \
37 scripts/kconfig/kxgettext arch/$$i/Kconfig \
38 | msguniq -o scripts/kconfig/linux_$${i}.pot; \
40 $(Q)msgcat scripts/kconfig/config.pot \
41 `find scripts/kconfig/ -type f -name linux_*.pot` \
42 --output scripts/kconfig/linux_raw.pot
43 $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
44 --output scripts/kconfig/linux.pot
45 $(Q)rm -f arch/um/Kconfig_arch
46 $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
48 PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
50 randconfig: $(obj)/conf
51 $< -r arch/$(ARCH)/Kconfig
53 allyesconfig: $(obj)/conf
54 $< -y arch/$(ARCH)/Kconfig
56 allnoconfig: $(obj)/conf
57 $< -n arch/$(ARCH)/Kconfig
59 allmodconfig: $(obj)/conf
60 $< -m arch/$(ARCH)/Kconfig
62 defconfig: $(obj)/conf
63 ifeq ($(KBUILD_DEFCONFIG),)
64 $< -d arch/$(ARCH)/Kconfig
66 @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
67 $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
70 %_defconfig: $(obj)/conf
71 $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
73 # Help text used by make help
75 @echo ' config - Update current config utilising a line-oriented program'
76 @echo ' menuconfig - Update current config utilising a menu based program'
77 @echo ' xconfig - Update current config utilising a QT based front-end'
78 @echo ' gconfig - Update current config utilising a GTK based front-end'
79 @echo ' oldconfig - Update current config utilising a provided .config as base'
80 @echo ' randconfig - New config with random answer to all options'
81 @echo ' defconfig - New config with default answer to all options'
82 @echo ' allmodconfig - New config selecting modules when possible'
83 @echo ' allyesconfig - New config where all options are accepted with yes'
84 @echo ' allnoconfig - New config where all options are answered with no'
86 # ===========================================================================
87 # Shared Makefile for the various kconfig executables:
88 # conf: Used for defconfig, oldconfig and related targets
89 # mconf: Used for the mconfig target.
90 # Utilizes the lxdialog package
91 # qconf: Used for the xconfig target
92 # Based on QT which needs to be installed to compile it
93 # gconf: Used for the gconfig target
94 # Based on GTK which needs to be installed to compile it
95 # object files used by all kconfig flavours
97 hostprogs-y := conf mconf qconf gconf kxgettext
98 conf-objs := conf.o zconf.tab.o
99 mconf-objs := mconf.o zconf.tab.o
100 kxgettext-objs := kxgettext.o zconf.tab.o
102 ifeq ($(MAKECMDGOALS),xconfig)
105 ifeq ($(MAKECMDGOALS),gconfig)
110 ifeq ($(qconf-target),1)
111 qconf-cxxobjs := qconf.o
112 qconf-objs := kconfig_load.o zconf.tab.o
115 ifeq ($(gconf-target),1)
116 gconf-objs := gconf.o kconfig_load.o zconf.tab.o
119 clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
120 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
123 # Needed for systems without gettext
124 KBUILD_HAVE_NLS := $(shell \
125 if echo "\#include <libintl.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \
128 ifeq ($(KBUILD_HAVE_NLS),no)
129 HOSTCFLAGS += -DKBUILD_NO_NLS
132 # generated files seem to need this to find local include files
133 HOSTCFLAGS_lex.zconf.o := -I$(src)
134 HOSTCFLAGS_zconf.tab.o := -I$(src)
136 HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
137 HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
139 HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
140 HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
143 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
145 ifeq ($(qconf-target),1)
146 $(obj)/.tmp_qtcheck: $(src)/Makefile
147 -include $(obj)/.tmp_qtcheck
149 # QT needs some extra effort...
151 @set -e; echo " CHECK qt"; dir=""; pkg=""; \
152 pkg-config --exists qt 2> /dev/null && pkg=qt; \
153 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
154 if [ -n "$$pkg" ]; then \
155 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
156 libs="\$$(shell pkg-config $$pkg --libs)"; \
157 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
158 dir="$$(pkg-config $$pkg --variable=prefix)"; \
160 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
161 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
163 if [ -z "$$dir" ]; then \
165 echo "* Unable to find the QT installation. Please make sure that"; \
166 echo "* the QT development package is correctly installed and"; \
167 echo "* either install pkg-config or set the QTDIR environment"; \
168 echo "* variable to the correct location."; \
172 libpath=$$dir/lib; lib=qt; osdir=""; \
173 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
174 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
175 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
176 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
177 cflags="-I$$dir/include"; \
178 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
179 moc="$$dir/bin/moc"; \
181 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
183 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
185 moc="/usr/bin/moc"; \
187 echo "KC_QT_CFLAGS=$$cflags" > $@; \
188 echo "KC_QT_LIBS=$$libs" >> $@; \
189 echo "KC_QT_MOC=$$moc" >> $@
192 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
194 ifeq ($(gconf-target),1)
195 -include $(obj)/.tmp_gtkcheck
197 # GTK needs some extra effort, too...
198 $(obj)/.tmp_gtkcheck:
199 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
200 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
204 echo "* GTK+ is present but version >= 2.0.0 is required."; \
210 echo "* Unable to find the GTK+ installation. Please make sure that"; \
211 echo "* the GTK+ 2.0 development package is correctly installed..."; \
212 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
218 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
220 $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
222 $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
224 $(obj)/gconf.o: $(obj)/lkc_defs.h
226 $(obj)/%.moc: $(src)/%.h
227 $(KC_QT_MOC) -i $< -o $@
229 $(obj)/lkc_defs.h: $(src)/lkc_proto.h
230 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
234 # The following requires flex/bison/gperf
235 # By default we use the _shipped versions, uncomment the following line if
236 # you are modifying the flex/bison src.
241 $(obj)/zconf.tab.c: $(src)/zconf.y
242 $(obj)/lex.zconf.c: $(src)/zconf.l
243 $(obj)/zconf.hash.c: $(src)/zconf.gperf
246 bison -l -b $* -p $(notdir $*) $<
250 flex -L -P$(notdir $*) -o$@ $<