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