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