xref: /linux/scripts/kconfig/Makefile (revision 3b9fa0931dd86a1fe5507311ee8031650f5d0e8c)
11da177e4SLinus Torvalds# ===========================================================================
21da177e4SLinus Torvalds# Kernel configuration targets
31da177e4SLinus Torvalds# These targets are used from top-level makefile
41da177e4SLinus Torvalds
5*3b9fa093SArnaldo Carvalho de Melo.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
61da177e4SLinus Torvalds
71da177e4SLinus Torvaldsxconfig: $(obj)/qconf
81da177e4SLinus Torvalds	$< arch/$(ARCH)/Kconfig
91da177e4SLinus Torvalds
101da177e4SLinus Torvaldsgconfig: $(obj)/gconf
111da177e4SLinus Torvalds	$< arch/$(ARCH)/Kconfig
121da177e4SLinus Torvalds
131da177e4SLinus Torvaldsmenuconfig: $(obj)/mconf
141da177e4SLinus Torvalds	$(Q)$(MAKE) $(build)=scripts/lxdialog
151da177e4SLinus Torvalds	$< arch/$(ARCH)/Kconfig
161da177e4SLinus Torvalds
171da177e4SLinus Torvaldsconfig: $(obj)/conf
181da177e4SLinus Torvalds	$< arch/$(ARCH)/Kconfig
191da177e4SLinus Torvalds
201da177e4SLinus Torvaldsoldconfig: $(obj)/conf
211da177e4SLinus Torvalds	$< -o arch/$(ARCH)/Kconfig
221da177e4SLinus Torvalds
231da177e4SLinus Torvaldssilentoldconfig: $(obj)/conf
241da177e4SLinus Torvalds	$< -s arch/$(ARCH)/Kconfig
251da177e4SLinus Torvalds
26*3b9fa093SArnaldo Carvalho de Meloupdate-po-config: $(obj)/kxgettext
27*3b9fa093SArnaldo Carvalho de Melo	xgettext --default-domain=linux \
28*3b9fa093SArnaldo Carvalho de Melo          --add-comments --keyword=_ --keyword=N_ \
29*3b9fa093SArnaldo Carvalho de Melo          --files-from=scripts/kconfig/POTFILES.in \
30*3b9fa093SArnaldo Carvalho de Melo	-o scripts/kconfig/linux.pot
31*3b9fa093SArnaldo Carvalho de Melo	scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot
32*3b9fa093SArnaldo Carvalho de Melo
331da177e4SLinus Torvalds.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
341da177e4SLinus Torvalds
351da177e4SLinus Torvaldsrandconfig: $(obj)/conf
361da177e4SLinus Torvalds	$< -r arch/$(ARCH)/Kconfig
371da177e4SLinus Torvalds
381da177e4SLinus Torvaldsallyesconfig: $(obj)/conf
391da177e4SLinus Torvalds	$< -y arch/$(ARCH)/Kconfig
401da177e4SLinus Torvalds
411da177e4SLinus Torvaldsallnoconfig: $(obj)/conf
421da177e4SLinus Torvalds	$< -n arch/$(ARCH)/Kconfig
431da177e4SLinus Torvalds
441da177e4SLinus Torvaldsallmodconfig: $(obj)/conf
451da177e4SLinus Torvalds	$< -m arch/$(ARCH)/Kconfig
461da177e4SLinus Torvalds
471da177e4SLinus Torvaldsdefconfig: $(obj)/conf
481da177e4SLinus Torvaldsifeq ($(KBUILD_DEFCONFIG),)
491da177e4SLinus Torvalds	$< -d arch/$(ARCH)/Kconfig
501da177e4SLinus Torvaldselse
511da177e4SLinus Torvalds	@echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
521da177e4SLinus Torvalds	$(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
531da177e4SLinus Torvaldsendif
541da177e4SLinus Torvalds
551da177e4SLinus Torvalds%_defconfig: $(obj)/conf
561da177e4SLinus Torvalds	$(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
571da177e4SLinus Torvalds
581da177e4SLinus Torvalds# Help text used by make help
591da177e4SLinus Torvaldshelp:
601da177e4SLinus Torvalds	@echo  '  config	  - Update current config utilising a line-oriented program'
611da177e4SLinus Torvalds	@echo  '  menuconfig	  - Update current config utilising a menu based program'
621da177e4SLinus Torvalds	@echo  '  xconfig	  - Update current config utilising a QT based front-end'
631da177e4SLinus Torvalds	@echo  '  gconfig	  - Update current config utilising a GTK based front-end'
641da177e4SLinus Torvalds	@echo  '  oldconfig	  - Update current config utilising a provided .config as base'
651da177e4SLinus Torvalds	@echo  '  randconfig	  - New config with random answer to all options'
661da177e4SLinus Torvalds	@echo  '  defconfig	  - New config with default answer to all options'
671da177e4SLinus Torvalds	@echo  '  allmodconfig	  - New config selecting modules when possible'
681da177e4SLinus Torvalds	@echo  '  allyesconfig	  - New config where all options are accepted with yes'
691da177e4SLinus Torvalds	@echo  '  allnoconfig	  - New minimal config'
701da177e4SLinus Torvalds
711da177e4SLinus Torvalds# ===========================================================================
721da177e4SLinus Torvalds# Shared Makefile for the various kconfig executables:
731da177e4SLinus Torvalds# conf:	  Used for defconfig, oldconfig and related targets
741da177e4SLinus Torvalds# mconf:  Used for the mconfig target.
751da177e4SLinus Torvalds#         Utilizes the lxdialog package
761da177e4SLinus Torvalds# qconf:  Used for the xconfig target
771da177e4SLinus Torvalds#         Based on QT which needs to be installed to compile it
781da177e4SLinus Torvalds# gconf:  Used for the gconfig target
791da177e4SLinus Torvalds#         Based on GTK which needs to be installed to compile it
801da177e4SLinus Torvalds# object files used by all kconfig flavours
811da177e4SLinus Torvalds
82*3b9fa093SArnaldo Carvalho de Melohostprogs-y	:= conf mconf qconf gconf kxgettext
831da177e4SLinus Torvaldsconf-objs	:= conf.o  zconf.tab.o
841da177e4SLinus Torvaldsmconf-objs	:= mconf.o zconf.tab.o
85*3b9fa093SArnaldo Carvalho de Melokxgettext-objs	:= kxgettext.o zconf.tab.o
861da177e4SLinus Torvalds
871da177e4SLinus Torvaldsifeq ($(MAKECMDGOALS),xconfig)
881da177e4SLinus Torvalds	qconf-target := 1
891da177e4SLinus Torvaldsendif
901da177e4SLinus Torvaldsifeq ($(MAKECMDGOALS),gconfig)
911da177e4SLinus Torvalds	gconf-target := 1
921da177e4SLinus Torvaldsendif
931da177e4SLinus Torvalds
941da177e4SLinus Torvalds
951da177e4SLinus Torvaldsifeq ($(qconf-target),1)
961da177e4SLinus Torvaldsqconf-cxxobjs	:= qconf.o
971da177e4SLinus Torvaldsqconf-objs	:= kconfig_load.o zconf.tab.o
981da177e4SLinus Torvaldsendif
991da177e4SLinus Torvalds
1001da177e4SLinus Torvaldsifeq ($(gconf-target),1)
1011da177e4SLinus Torvaldsgconf-objs	:= gconf.o kconfig_load.o zconf.tab.o
1021da177e4SLinus Torvaldsendif
1031da177e4SLinus Torvalds
1041da177e4SLinus Torvaldsclean-files	:= lkc_defs.h qconf.moc .tmp_qtcheck \
1051da177e4SLinus Torvalds		   .tmp_gtkcheck zconf.tab.c zconf.tab.h lex.zconf.c
1061da177e4SLinus Torvalds
1071da177e4SLinus Torvalds# generated files seem to need this to find local include files
1081da177e4SLinus TorvaldsHOSTCFLAGS_lex.zconf.o	:= -I$(src)
1091da177e4SLinus TorvaldsHOSTCFLAGS_zconf.tab.o	:= -I$(src)
1101da177e4SLinus Torvalds
1111da177e4SLinus TorvaldsHOSTLOADLIBES_qconf	= -L$(QTLIBPATH) -Wl,-rpath,$(QTLIBPATH) -l$(QTLIB) -ldl
1121da177e4SLinus TorvaldsHOSTCXXFLAGS_qconf.o	= -I$(QTDIR)/include -D LKC_DIRECT_LINK
1131da177e4SLinus Torvalds
1141da177e4SLinus TorvaldsHOSTLOADLIBES_gconf	= `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
1151da177e4SLinus TorvaldsHOSTCFLAGS_gconf.o	= `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
1161da177e4SLinus Torvalds                          -D LKC_DIRECT_LINK
1171da177e4SLinus Torvalds
118*3b9fa093SArnaldo Carvalho de Melo$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h
1191da177e4SLinus Torvalds
1201da177e4SLinus Torvalds$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped
1211da177e4SLinus Torvalds$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped
1221da177e4SLinus Torvalds$(obj)/lex.zconf.c: $(src)/lex.zconf.c_shipped
1231da177e4SLinus Torvalds
1241da177e4SLinus Torvalds$(obj)/qconf.o: $(obj)/.tmp_qtcheck
1251da177e4SLinus Torvalds
1261da177e4SLinus Torvaldsifeq ($(qconf-target),1)
1271da177e4SLinus TorvaldsMOC = $(QTDIR)/bin/moc
1281da177e4SLinus TorvaldsQTLIBPATH = $(QTDIR)/lib
1291da177e4SLinus Torvalds-include $(obj)/.tmp_qtcheck
1301da177e4SLinus Torvalds
1311da177e4SLinus Torvalds# QT needs some extra effort...
1321da177e4SLinus Torvalds$(obj)/.tmp_qtcheck:
1331da177e4SLinus Torvalds	@set -e; for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
1341da177e4SLinus Torvalds	  if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \
1351da177e4SLinus Torvalds	done; \
1361da177e4SLinus Torvalds	if [ -z "$$DIR" ]; then \
1371da177e4SLinus Torvalds	  echo "*"; \
1381da177e4SLinus Torvalds	  echo "* Unable to find the QT installation. Please make sure that the"; \
1391da177e4SLinus Torvalds	  echo "* QT development package is correctly installed and the QTDIR"; \
1401da177e4SLinus Torvalds	  echo "* environment variable is set to the correct location."; \
1411da177e4SLinus Torvalds	  echo "*"; \
1421da177e4SLinus Torvalds	  false; \
1431da177e4SLinus Torvalds	fi; \
1441da177e4SLinus Torvalds	LIBPATH=$$DIR/lib; LIB=qt; \
1451da177e4SLinus Torvalds	$(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
1461da177e4SLinus Torvalds	  LIBPATH=$$DIR/lib/$$($(HOSTCXX) -print-multi-os-directory); \
1471da177e4SLinus Torvalds	if [ -f $$LIBPATH/libqt-mt.so ]; then LIB=qt-mt; fi; \
1481da177e4SLinus Torvalds	echo "QTDIR=$$DIR" > $@; echo "QTLIBPATH=$$LIBPATH" >> $@; \
1491da177e4SLinus Torvalds	echo "QTLIB=$$LIB" >> $@; \
1501da177e4SLinus Torvalds	if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \
1511da177e4SLinus Torvalds	  echo "*"; \
1521da177e4SLinus Torvalds	  echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \
1531da177e4SLinus Torvalds	  echo "*"; \
1541da177e4SLinus Torvalds	  echo "MOC=/usr/bin/moc" >> $@; \
1551da177e4SLinus Torvalds	fi
1561da177e4SLinus Torvaldsendif
1571da177e4SLinus Torvalds
1581da177e4SLinus Torvalds$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
1591da177e4SLinus Torvalds
1601da177e4SLinus Torvaldsifeq ($(gconf-target),1)
1611da177e4SLinus Torvalds-include $(obj)/.tmp_gtkcheck
1621da177e4SLinus Torvalds
1631da177e4SLinus Torvalds# GTK needs some extra effort, too...
1641da177e4SLinus Torvalds$(obj)/.tmp_gtkcheck:
1651da177e4SLinus Torvalds	@if `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --exists`; then		\
1661da177e4SLinus Torvalds		if `pkg-config gtk+-2.0 --atleast-version=2.0.0`; then			\
1671da177e4SLinus Torvalds			touch $@;								\
1681da177e4SLinus Torvalds		else									\
1691da177e4SLinus Torvalds			echo "*"; 							\
1701da177e4SLinus Torvalds			echo "* GTK+ is present but version >= 2.0.0 is required.";	\
1711da177e4SLinus Torvalds			echo "*";							\
1721da177e4SLinus Torvalds			false;								\
1731da177e4SLinus Torvalds		fi									\
1741da177e4SLinus Torvalds	else										\
1751da177e4SLinus Torvalds		echo "*"; 								\
1761da177e4SLinus Torvalds		echo "* Unable to find the GTK+ installation. Please make sure that"; 	\
1771da177e4SLinus Torvalds		echo "* the GTK+ 2.0 development package is correctly installed..."; 	\
1781da177e4SLinus Torvalds		echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; 		\
1791da177e4SLinus Torvalds		echo "*"; 								\
1801da177e4SLinus Torvalds		false;									\
1811da177e4SLinus Torvalds	fi
1821da177e4SLinus Torvaldsendif
1831da177e4SLinus Torvalds
1841da177e4SLinus Torvalds$(obj)/zconf.tab.o: $(obj)/lex.zconf.c
1851da177e4SLinus Torvalds
1861da177e4SLinus Torvalds$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
1871da177e4SLinus Torvalds
1881da177e4SLinus Torvalds$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
1891da177e4SLinus Torvalds
1901da177e4SLinus Torvalds$(obj)/gconf.o: $(obj)/lkc_defs.h
1911da177e4SLinus Torvalds
1921da177e4SLinus Torvalds$(obj)/%.moc: $(src)/%.h
1931da177e4SLinus Torvalds	$(MOC) -i $< -o $@
1941da177e4SLinus Torvalds
1951da177e4SLinus Torvalds$(obj)/lkc_defs.h: $(src)/lkc_proto.h
1961da177e4SLinus Torvalds	sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
1971da177e4SLinus Torvalds
1981da177e4SLinus Torvalds
1991da177e4SLinus Torvalds###
2001da177e4SLinus Torvalds# The following requires flex/bison
2011da177e4SLinus Torvalds# By default we use the _shipped versions, uncomment the following line if
2021da177e4SLinus Torvalds# you are modifying the flex/bison src.
2031da177e4SLinus Torvalds# LKC_GENPARSER := 1
2041da177e4SLinus Torvalds
2051da177e4SLinus Torvaldsifdef LKC_GENPARSER
2061da177e4SLinus Torvalds
2071da177e4SLinus Torvalds$(obj)/zconf.tab.c: $(obj)/zconf.y
2081da177e4SLinus Torvalds$(obj)/zconf.tab.h: $(obj)/zconf.tab.c
2091da177e4SLinus Torvalds
2101da177e4SLinus Torvalds%.tab.c: %.y
2111da177e4SLinus Torvalds	bison -t -d -v -b $* -p $(notdir $*) $<
2121da177e4SLinus Torvalds
2131da177e4SLinus Torvaldslex.%.c: %.l
2141da177e4SLinus Torvalds	flex -P$(notdir $*) -o$@ $<
2151da177e4SLinus Torvalds
2161da177e4SLinus Torvaldsendif
217