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