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