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