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