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