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