upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[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/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 update-po-config: $(obj)/kxgettext
27         xgettext --default-domain=linux \
28           --add-comments --keyword=_ --keyword=N_ \
29           --files-from=scripts/kconfig/POTFILES.in \
30         -o scripts/kconfig/linux.pot
31         scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot
32
33 nonint_oldconfig: scripts/kconfig/conf
34         ./scripts/kconfig/conf -b arch/$(ARCH)/Kconfig
35
36
37 .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
38
39 randconfig: $(obj)/conf
40         $< -r arch/$(ARCH)/Kconfig
41
42 allyesconfig: $(obj)/conf
43         $< -y arch/$(ARCH)/Kconfig
44
45 allnoconfig: $(obj)/conf
46         $< -n arch/$(ARCH)/Kconfig
47
48 allmodconfig: $(obj)/conf
49         $< -m arch/$(ARCH)/Kconfig
50
51 defconfig: $(obj)/conf
52 ifeq ($(KBUILD_DEFCONFIG),)
53         $< -d arch/$(ARCH)/Kconfig
54 else
55         @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
56         $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
57 endif
58
59 %_defconfig: $(obj)/conf
60         $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
61
62 # Help text used by make help
63 help:
64         @echo  '  config          - Update current config utilising a line-oriented program'
65         @echo  '  menuconfig      - Update current config utilising a menu based program'
66         @echo  '  xconfig         - Update current config utilising a QT based front-end'
67         @echo  '  gconfig         - Update current config utilising a GTK based front-end'
68         @echo  '  oldconfig       - Update current config utilising a provided .config as base'
69         @echo  '  randconfig      - New config with random answer to all options'
70         @echo  '  defconfig       - New config with default answer to all options'
71         @echo  '  allmodconfig    - New config selecting modules when possible'
72         @echo  '  allyesconfig    - New config where all options are accepted with yes'
73         @echo  '  allnoconfig     - New minimal config'
74
75 # ===========================================================================
76 # Shared Makefile for the various kconfig executables:
77 # conf:   Used for defconfig, oldconfig and related targets
78 # mconf:  Used for the mconfig target.
79 #         Utilizes the lxdialog package
80 # qconf:  Used for the xconfig target
81 #         Based on QT which needs to be installed to compile it
82 # gconf:  Used for the gconfig target
83 #         Based on GTK which needs to be installed to compile it
84 # object files used by all kconfig flavours
85
86 hostprogs-y     := conf mconf qconf gconf kxgettext
87 conf-objs       := conf.o  zconf.tab.o
88 mconf-objs      := mconf.o zconf.tab.o
89 kxgettext-objs  := kxgettext.o zconf.tab.o
90
91 ifeq ($(MAKECMDGOALS),xconfig)
92         qconf-target := 1
93 endif
94 ifeq ($(MAKECMDGOALS),gconfig)
95         gconf-target := 1
96 endif
97
98
99 ifeq ($(qconf-target),1)
100 qconf-cxxobjs   := qconf.o
101 qconf-objs      := kconfig_load.o zconf.tab.o
102 endif
103
104 ifeq ($(gconf-target),1)
105 gconf-objs      := gconf.o kconfig_load.o zconf.tab.o
106 endif
107
108 clean-files     := lkc_defs.h qconf.moc .tmp_qtcheck \
109                    .tmp_gtkcheck zconf.tab.c zconf.tab.h lex.zconf.c
110
111 # generated files seem to need this to find local include files
112 HOSTCFLAGS_lex.zconf.o  := -I$(src)
113 HOSTCFLAGS_zconf.tab.o  := -I$(src)
114
115 HOSTLOADLIBES_qconf     = -L$(QTLIBPATH) -Wl,-rpath,$(QTLIBPATH) -l$(QTLIB) -ldl
116 HOSTCXXFLAGS_qconf.o    = -I$(QTDIR)/include -D LKC_DIRECT_LINK
117
118 HOSTLOADLIBES_gconf     = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
119 HOSTCFLAGS_gconf.o      = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
120                           -D LKC_DIRECT_LINK
121
122 $(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h
123
124 $(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped
125 $(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped
126 $(obj)/lex.zconf.c: $(src)/lex.zconf.c_shipped
127
128 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
129
130 ifeq ($(qconf-target),1)
131 MOC = $(QTDIR)/bin/moc
132 QTLIBPATH = $(QTDIR)/lib
133 -include $(obj)/.tmp_qtcheck
134
135 # QT needs some extra effort...
136 $(obj)/.tmp_qtcheck:
137         @set -e; for d in $$QTDIR /usr/share/qt* /usr/lib/qt* /usr/lib64/qt* ; do \
138           if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \
139         done; \
140         if [ -z "$$DIR" ]; then \
141           echo "*"; \
142           echo "* Unable to find the QT installation. Please make sure that the"; \
143           echo "* QT development package is correctly installed and the QTDIR"; \
144           echo "* environment variable is set to the correct location."; \
145           echo "*"; \
146           false; \
147         fi; \
148         LIBPATH=$$DIR/lib; LIB=qt; \
149         $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
150           LIBPATH=$$DIR/lib/$$($(HOSTCXX) -print-multi-os-directory); \
151         if [ -f $$LIBPATH/libqt-mt.so ]; then LIB=qt-mt; fi; \
152         echo "QTDIR=$$DIR" > $@; echo "QTLIBPATH=$$LIBPATH" >> $@; \
153         echo "QTLIB=$$LIB" >> $@; \
154         if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \
155           echo "*"; \
156           echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \
157           echo "*"; \
158           echo "MOC=/usr/bin/moc" >> $@; \
159         fi
160 endif
161
162 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
163
164 ifeq ($(gconf-target),1)
165 -include $(obj)/.tmp_gtkcheck
166
167 # GTK needs some extra effort, too...
168 $(obj)/.tmp_gtkcheck:
169         @if `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --exists`; then               \
170                 if `pkg-config gtk+-2.0 --atleast-version=2.0.0`; then                  \
171                         touch $@;                                                               \
172                 else                                                                    \
173                         echo "*";                                                       \
174                         echo "* GTK+ is present but version >= 2.0.0 is required.";     \
175                         echo "*";                                                       \
176                         false;                                                          \
177                 fi                                                                      \
178         else                                                                            \
179                 echo "*";                                                               \
180                 echo "* Unable to find the GTK+ installation. Please make sure that";   \
181                 echo "* the GTK+ 2.0 development package is correctly installed...";    \
182                 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0.";                 \
183                 echo "*";                                                               \
184                 false;                                                                  \
185         fi
186 endif
187
188 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c
189
190 $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
191
192 $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
193
194 $(obj)/gconf.o: $(obj)/lkc_defs.h
195
196 $(obj)/%.moc: $(src)/%.h
197         $(MOC) -i $< -o $@
198
199 $(obj)/lkc_defs.h: $(src)/lkc_proto.h
200         sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
201
202
203 ###
204 # The following requires flex/bison
205 # By default we use the _shipped versions, uncomment the following line if
206 # you are modifying the flex/bison src.
207 # LKC_GENPARSER := 1
208
209 ifdef LKC_GENPARSER
210
211 $(obj)/zconf.tab.c: $(obj)/zconf.y 
212 $(obj)/zconf.tab.h: $(obj)/zconf.tab.c
213
214 %.tab.c: %.y
215         bison -t -d -v -b $* -p $(notdir $*) $<
216
217 lex.%.c: %.l
218         flex -P$(notdir $*) -o$@ $<
219
220 endif