Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / scripts / kconfig / Makefile
1 # ===========================================================================
2 # Kernel configuration targets
3 # These targets are used from top-level makefile
4
5 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
6
7 xconfig: $(obj)/qconf
8         $< arch/$(ARCH)/Kconfig
9
10 gconfig: $(obj)/gconf
11         $< arch/$(ARCH)/Kconfig
12
13 menuconfig: $(obj)/mconf
14         $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog
15         $< arch/$(ARCH)/Kconfig
16
17 config: $(obj)/conf
18         $< arch/$(ARCH)/Kconfig
19
20 oldconfig: $(obj)/conf
21         $< -o arch/$(ARCH)/Kconfig
22
23 silentoldconfig: $(obj)/conf
24         $< -s arch/$(ARCH)/Kconfig
25
26 nonint_oldconfig: scripts/kconfig/conf
27         ./scripts/kconfig/conf -b arch/$(ARCH)/Kconfig
28
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/`; \
36         do \
37           scripts/kconfig/kxgettext arch/$$i/Kconfig \
38             | msguniq -o scripts/kconfig/linux_$${i}.pot; \
39         done
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
47
48 PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
49
50 randconfig: $(obj)/conf
51         $< -r arch/$(ARCH)/Kconfig
52
53 allyesconfig: $(obj)/conf
54         $< -y arch/$(ARCH)/Kconfig
55
56 allnoconfig: $(obj)/conf
57         $< -n arch/$(ARCH)/Kconfig
58
59 allmodconfig: $(obj)/conf
60         $< -m arch/$(ARCH)/Kconfig
61
62 defconfig: $(obj)/conf
63 ifeq ($(KBUILD_DEFCONFIG),)
64         $< -d arch/$(ARCH)/Kconfig
65 else
66         @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
67         $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
68 endif
69
70 %_defconfig: $(obj)/conf
71         $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
72
73 # Help text used by make help
74 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'
85
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
96
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
101
102 ifeq ($(MAKECMDGOALS),xconfig)
103         qconf-target := 1
104 endif
105 ifeq ($(MAKECMDGOALS),gconfig)
106         gconf-target := 1
107 endif
108
109
110 ifeq ($(qconf-target),1)
111 qconf-cxxobjs   := qconf.o
112 qconf-objs      := kconfig_load.o zconf.tab.o
113 endif
114
115 ifeq ($(gconf-target),1)
116 gconf-objs      := gconf.o kconfig_load.o zconf.tab.o
117 endif
118
119 clean-files     := lkc_defs.h qconf.moc .tmp_qtcheck \
120                    .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
121 subdir- += lxdialog
122
123 # Needed for systems without gettext
124 KBUILD_HAVE_NLS := $(shell \
125      if echo "\#include <libintl.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \
126      then echo yes ; \
127      else echo no ; fi)
128 ifeq ($(KBUILD_HAVE_NLS),no)
129 HOSTCFLAGS      += -DKBUILD_NO_NLS
130 endif
131
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)
135
136 HOSTLOADLIBES_qconf     = $(KC_QT_LIBS) -ldl
137 HOSTCXXFLAGS_qconf.o    = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
138
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` \
141                           -D LKC_DIRECT_LINK
142
143 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
144
145 ifeq ($(qconf-target),1)
146 $(obj)/.tmp_qtcheck: $(src)/Makefile
147 -include $(obj)/.tmp_qtcheck
148
149 # QT needs some extra effort...
150 $(obj)/.tmp_qtcheck:
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)"; \
159         else \
160           for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
161             if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
162           done; \
163           if [ -z "$$dir" ]; then \
164             echo "*"; \
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."; \
169             echo "*"; \
170             false; \
171           fi; \
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"; \
180         fi; \
181         if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
182           echo "*"; \
183           echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
184           echo "*"; \
185           moc="/usr/bin/moc"; \
186         fi; \
187         echo "KC_QT_CFLAGS=$$cflags" > $@; \
188         echo "KC_QT_LIBS=$$libs" >> $@; \
189         echo "KC_QT_MOC=$$moc" >> $@
190 endif
191
192 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
193
194 ifeq ($(gconf-target),1)
195 -include $(obj)/.tmp_gtkcheck
196
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                  \
201                         touch $@;                                                               \
202                 else                                                                    \
203                         echo "*";                                                       \
204                         echo "* GTK+ is present but version >= 2.0.0 is required.";     \
205                         echo "*";                                                       \
206                         false;                                                          \
207                 fi                                                                      \
208         else                                                                            \
209                 echo "*";                                                               \
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.";                 \
213                 echo "*";                                                               \
214                 false;                                                                  \
215         fi
216 endif
217
218 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
219
220 $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
221
222 $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
223
224 $(obj)/gconf.o: $(obj)/lkc_defs.h
225
226 $(obj)/%.moc: $(src)/%.h
227         $(KC_QT_MOC) -i $< -o $@
228
229 $(obj)/lkc_defs.h: $(src)/lkc_proto.h
230         sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
231
232
233 ###
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.
237 # LKC_GENPARSER := 1
238
239 ifdef LKC_GENPARSER
240
241 $(obj)/zconf.tab.c: $(src)/zconf.y
242 $(obj)/lex.zconf.c: $(src)/zconf.l
243 $(obj)/zconf.hash.c: $(src)/zconf.gperf
244
245 %.tab.c: %.y
246         bison -l -b $* -p $(notdir $*) $<
247         cp $@ $@_shipped
248
249 lex.%.c: %.l
250         flex -L -P$(notdir $*) -o$@ $<
251         cp $@ $@_shipped
252
253 %.hash.c: %.gperf
254         gperf < $< > $@
255         cp $@ $@_shipped
256
257 endif