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
13 menuconfig: $(obj)/mconf
14 $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog
20 # Mtime granularity problem.
21 # It was observed that these commands:
22 # make allnoconfig; sed -i -e '/CONFIG_TRUE/s/.*/CONFIG_TRUE=y/' .config; make
23 # sometimes produce busybox with "true" applet still disabled.
24 # This is caused by .config updated by sed having mtime which is still
25 # equal to (not bigger than) include/autoconf.h's mtime,
26 # and thus 2nd make does not regenerate include/autoconf.h.
27 # Waiting for 1 second after non-interactive "make XXXXconfig"
28 # prevents this from happening.
30 # We'd like to detect whether filesystem we are on has coarse mtimes,
31 # but can't do it yet, bbox ls hasn't got --full-time.
32 #MTIME_IS_COARSE:=@ls --full-time -ld | grep -F .000 >/dev/null
33 MTIME_IS_COARSE:=@true
35 oldconfig: $(obj)/conf
37 $(MTIME_IS_COARSE) && sleep 1
39 silentoldconfig: $(obj)/conf
41 $(MTIME_IS_COARSE) && sleep 1
43 update-po-config: $(obj)/kxgettext
44 xgettext --default-domain=linux \
45 --add-comments --keyword=_ --keyword=N_ \
46 --files-from=scripts/kconfig/POTFILES.in \
47 --output scripts/kconfig/config.pot
48 $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
49 $(Q)for i in `ls arch/`; \
51 scripts/kconfig/kxgettext arch/$$i/Kconfig \
52 | msguniq -o scripts/kconfig/linux_$${i}.pot; \
54 $(Q)msgcat scripts/kconfig/config.pot \
55 `find scripts/kconfig/ -type f -name linux_*.pot` \
56 --output scripts/kconfig/linux_raw.pot
57 $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
58 --output scripts/kconfig/linux.pot
59 $(Q)rm -f arch/um/Kconfig_arch
60 $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
62 PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
64 randconfig: $(obj)/conf
66 $(MTIME_IS_COARSE) && sleep 1
68 allyesconfig: $(obj)/conf
70 $(MTIME_IS_COARSE) && sleep 1
72 allnoconfig: $(obj)/conf
74 $(MTIME_IS_COARSE) && sleep 1
76 allmodconfig: $(obj)/conf
78 $(MTIME_IS_COARSE) && sleep 1
80 defconfig: $(obj)/conf
81 ifeq ($(KBUILD_DEFCONFIG),)
84 @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
85 $(Q)$< -D $(KBUILD_DEFCONFIG) Config.in
87 $(MTIME_IS_COARSE) && sleep 1
89 %_defconfig: $(obj)/conf
90 $(Q)$< -D $@ Config.in
91 $(MTIME_IS_COARSE) && sleep 1
93 # Help text used by make help
95 @echo ' config - Update current config utilising a line-oriented program'
96 @echo ' menuconfig - Update current config utilising a menu based program'
97 @echo ' xconfig - Update current config utilising a QT based front-end'
98 @echo ' gconfig - Update current config utilising a GTK based front-end'
99 @echo ' oldconfig - Update current config utilising a provided .config as base'
100 @echo ' randconfig - New config with random answer to all options'
101 @echo ' defconfig - New config with default answer to all options'
102 @echo ' allmodconfig - New config selecting modules when possible'
103 @echo ' allyesconfig - New config where all options are accepted with yes'
104 @echo ' allnoconfig - New config where all options are answered with no'
106 # ===========================================================================
107 # Shared Makefile for the various kconfig executables:
108 # conf: Used for defconfig, oldconfig and related targets
109 # mconf: Used for the mconfig target.
110 # Utilizes the lxdialog package
111 # qconf: Used for the xconfig target
112 # Based on QT which needs to be installed to compile it
113 # gconf: Used for the gconfig target
114 # Based on GTK which needs to be installed to compile it
115 # object files used by all kconfig flavours
117 hostprogs-y := conf mconf qconf gconf kxgettext
118 conf-objs := conf.o zconf.tab.o
119 mconf-objs := mconf.o zconf.tab.o
120 kxgettext-objs := kxgettext.o zconf.tab.o
122 ifeq ($(MAKECMDGOALS),xconfig)
125 ifeq ($(MAKECMDGOALS),gconfig)
130 ifeq ($(qconf-target),1)
131 qconf-cxxobjs := qconf.o
132 qconf-objs := kconfig_load.o zconf.tab.o
135 ifeq ($(gconf-target),1)
136 gconf-objs := gconf.o kconfig_load.o zconf.tab.o
139 clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
140 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
143 # Add environment specific flags
144 HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
146 # generated files seem to need this to find local include files
147 HOSTCFLAGS_lex.zconf.o := -I$(src)
148 HOSTCFLAGS_zconf.tab.o := -I$(src)
150 HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
151 HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
153 HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
154 HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
157 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
159 ifeq ($(qconf-target),1)
160 $(obj)/.tmp_qtcheck: $(src)/Makefile
161 -include $(obj)/.tmp_qtcheck
163 # QT needs some extra effort...
165 @set -e; echo " CHECK qt"; dir=""; pkg=""; \
166 pkg-config --exists qt 2> /dev/null && pkg=qt; \
167 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
168 if [ -n "$$pkg" ]; then \
169 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
170 libs="\$$(shell pkg-config $$pkg --libs)"; \
171 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
172 dir="$$(pkg-config $$pkg --variable=prefix)"; \
174 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
175 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
177 if [ -z "$$dir" ]; then \
179 echo "* Unable to find the QT installation. Please make sure that"; \
180 echo "* the QT development package is correctly installed and"; \
181 echo "* either install pkg-config or set the QTDIR environment"; \
182 echo "* variable to the correct location."; \
186 libpath=$$dir/lib; lib=qt; osdir=""; \
187 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
188 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
189 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
190 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
191 cflags="-I$$dir/include"; \
192 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
193 moc="$$dir/bin/moc"; \
195 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
197 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
199 moc="/usr/bin/moc"; \
201 echo "KC_QT_CFLAGS=$$cflags" > $@; \
202 echo "KC_QT_LIBS=$$libs" >> $@; \
203 echo "KC_QT_MOC=$$moc" >> $@
206 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
208 ifeq ($(gconf-target),1)
209 -include $(obj)/.tmp_gtkcheck
211 # GTK needs some extra effort, too...
212 $(obj)/.tmp_gtkcheck:
213 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
214 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
218 echo "* GTK+ is present but version >= 2.0.0 is required."; \
224 echo "* Unable to find the GTK+ installation. Please make sure that"; \
225 echo "* the GTK+ 2.0 development package is correctly installed..."; \
226 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
232 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
234 $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
236 $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
238 $(obj)/gconf.o: $(obj)/lkc_defs.h
240 $(obj)/%.moc: $(src)/%.h
241 $(KC_QT_MOC) -i $< -o $@
243 $(obj)/lkc_defs.h: $(src)/lkc_proto.h
244 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
248 # The following requires flex/bison/gperf
249 # By default we use the _shipped versions, uncomment the following line if
250 # you are modifying the flex/bison src.
255 $(obj)/zconf.tab.c: $(src)/zconf.y
256 $(obj)/lex.zconf.c: $(src)/zconf.l
257 $(obj)/zconf.hash.c: $(src)/zconf.gperf
260 bison -l -b $* -p $(notdir $*) $<
264 flex -L -P$(notdir $*) -o$@ $<