xref: /linux/scripts/kconfig/Makefile (revision ab919c06144cfb11c05b5b5cd291daa96ac2e423)
11da177e4SLinus Torvalds# ===========================================================================
21da177e4SLinus Torvalds# Kernel configuration targets
31da177e4SLinus Torvalds# These targets are used from top-level makefile
41da177e4SLinus Torvalds
53b9fa093SArnaldo 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
263b9fa093SArnaldo Carvalho de Meloupdate-po-config: $(obj)/kxgettext
273b9fa093SArnaldo Carvalho de Melo	xgettext --default-domain=linux \
283b9fa093SArnaldo Carvalho de Melo          --add-comments --keyword=_ --keyword=N_ \
293b9fa093SArnaldo Carvalho de Melo          --files-from=scripts/kconfig/POTFILES.in \
30720d6c29SEgry Gabor          --output scripts/kconfig/config.pot
31720d6c29SEgry Gabor	$(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
32720d6c29SEgry Gabor	$(Q)for i in `ls arch/`; \
33720d6c29SEgry Gabor	do \
34720d6c29SEgry Gabor	  scripts/kconfig/kxgettext arch/$$i/Kconfig \
35720d6c29SEgry Gabor	    | msguniq -o scripts/kconfig/linux_$${i}.pot; \
36720d6c29SEgry Gabor	done
37720d6c29SEgry Gabor	$(Q)msgcat scripts/kconfig/config.pot \
38720d6c29SEgry Gabor	  `find scripts/kconfig/ -type f -name linux_*.pot` \
39720d6c29SEgry Gabor	  --output scripts/kconfig/linux_raw.pot
40720d6c29SEgry Gabor	$(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
41720d6c29SEgry Gabor	    --output scripts/kconfig/linux.pot
42720d6c29SEgry Gabor	$(Q)rm -f arch/um/Kconfig_arch
43720d6c29SEgry Gabor	$(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
443b9fa093SArnaldo Carvalho de Melo
451da177e4SLinus Torvalds.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
461da177e4SLinus Torvalds
471da177e4SLinus Torvaldsrandconfig: $(obj)/conf
481da177e4SLinus Torvalds	$< -r arch/$(ARCH)/Kconfig
491da177e4SLinus Torvalds
501da177e4SLinus Torvaldsallyesconfig: $(obj)/conf
511da177e4SLinus Torvalds	$< -y arch/$(ARCH)/Kconfig
521da177e4SLinus Torvalds
531da177e4SLinus Torvaldsallnoconfig: $(obj)/conf
541da177e4SLinus Torvalds	$< -n arch/$(ARCH)/Kconfig
551da177e4SLinus Torvalds
561da177e4SLinus Torvaldsallmodconfig: $(obj)/conf
571da177e4SLinus Torvalds	$< -m arch/$(ARCH)/Kconfig
581da177e4SLinus Torvalds
591da177e4SLinus Torvaldsdefconfig: $(obj)/conf
601da177e4SLinus Torvaldsifeq ($(KBUILD_DEFCONFIG),)
611da177e4SLinus Torvalds	$< -d arch/$(ARCH)/Kconfig
621da177e4SLinus Torvaldselse
631da177e4SLinus Torvalds	@echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
641da177e4SLinus Torvalds	$(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
651da177e4SLinus Torvaldsendif
661da177e4SLinus Torvalds
671da177e4SLinus Torvalds%_defconfig: $(obj)/conf
681da177e4SLinus Torvalds	$(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
691da177e4SLinus Torvalds
701da177e4SLinus Torvalds# Help text used by make help
711da177e4SLinus Torvaldshelp:
721da177e4SLinus Torvalds	@echo  '  config	  - Update current config utilising a line-oriented program'
731da177e4SLinus Torvalds	@echo  '  menuconfig	  - Update current config utilising a menu based program'
741da177e4SLinus Torvalds	@echo  '  xconfig	  - Update current config utilising a QT based front-end'
751da177e4SLinus Torvalds	@echo  '  gconfig	  - Update current config utilising a GTK based front-end'
761da177e4SLinus Torvalds	@echo  '  oldconfig	  - Update current config utilising a provided .config as base'
771da177e4SLinus Torvalds	@echo  '  randconfig	  - New config with random answer to all options'
781da177e4SLinus Torvalds	@echo  '  defconfig	  - New config with default answer to all options'
791da177e4SLinus Torvalds	@echo  '  allmodconfig	  - New config selecting modules when possible'
801da177e4SLinus Torvalds	@echo  '  allyesconfig	  - New config where all options are accepted with yes'
811da177e4SLinus Torvalds	@echo  '  allnoconfig	  - New minimal config'
821da177e4SLinus Torvalds
831da177e4SLinus Torvalds# ===========================================================================
841da177e4SLinus Torvalds# Shared Makefile for the various kconfig executables:
851da177e4SLinus Torvalds# conf:	  Used for defconfig, oldconfig and related targets
861da177e4SLinus Torvalds# mconf:  Used for the mconfig target.
871da177e4SLinus Torvalds#         Utilizes the lxdialog package
881da177e4SLinus Torvalds# qconf:  Used for the xconfig target
891da177e4SLinus Torvalds#         Based on QT which needs to be installed to compile it
901da177e4SLinus Torvalds# gconf:  Used for the gconfig target
911da177e4SLinus Torvalds#         Based on GTK which needs to be installed to compile it
921da177e4SLinus Torvalds# object files used by all kconfig flavours
931da177e4SLinus Torvalds
943b9fa093SArnaldo Carvalho de Melohostprogs-y	:= conf mconf qconf gconf kxgettext
951da177e4SLinus Torvaldsconf-objs	:= conf.o  zconf.tab.o
961da177e4SLinus Torvaldsmconf-objs	:= mconf.o zconf.tab.o
973b9fa093SArnaldo Carvalho de Melokxgettext-objs	:= kxgettext.o zconf.tab.o
981da177e4SLinus Torvalds
991da177e4SLinus Torvaldsifeq ($(MAKECMDGOALS),xconfig)
1001da177e4SLinus Torvalds	qconf-target := 1
1011da177e4SLinus Torvaldsendif
1021da177e4SLinus Torvaldsifeq ($(MAKECMDGOALS),gconfig)
1031da177e4SLinus Torvalds	gconf-target := 1
1041da177e4SLinus Torvaldsendif
1051da177e4SLinus Torvalds
1061da177e4SLinus Torvalds
1071da177e4SLinus Torvaldsifeq ($(qconf-target),1)
1081da177e4SLinus Torvaldsqconf-cxxobjs	:= qconf.o
1091da177e4SLinus Torvaldsqconf-objs	:= kconfig_load.o zconf.tab.o
1101da177e4SLinus Torvaldsendif
1111da177e4SLinus Torvalds
1121da177e4SLinus Torvaldsifeq ($(gconf-target),1)
1131da177e4SLinus Torvaldsgconf-objs	:= gconf.o kconfig_load.o zconf.tab.o
1141da177e4SLinus Torvaldsendif
1151da177e4SLinus Torvalds
1161da177e4SLinus Torvaldsclean-files	:= lkc_defs.h qconf.moc .tmp_qtcheck \
1171da177e4SLinus Torvalds		   .tmp_gtkcheck zconf.tab.c zconf.tab.h lex.zconf.c
1181da177e4SLinus Torvalds
11970a6a0cbSYuri Vasilevski# Needed for systems without gettext
12070a6a0cbSYuri VasilevskiKBUILD_HAVE_NLS := $(shell \
12170a6a0cbSYuri Vasilevski     if echo "\#include <libint.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \
12270a6a0cbSYuri Vasilevski     then echo yes ; \
12370a6a0cbSYuri Vasilevski     else echo no ; fi)
12470a6a0cbSYuri Vasilevskiifeq ($(KBUILD_HAVE_NLS),no)
12570a6a0cbSYuri VasilevskiHOSTCFLAGS	+= -DKBUILD_NO_NLS
12670a6a0cbSYuri Vasilevskiendif
12770a6a0cbSYuri Vasilevski
1281da177e4SLinus Torvalds# generated files seem to need this to find local include files
1291da177e4SLinus TorvaldsHOSTCFLAGS_lex.zconf.o	:= -I$(src)
1301da177e4SLinus TorvaldsHOSTCFLAGS_zconf.tab.o	:= -I$(src)
1311da177e4SLinus Torvalds
132*ab919c06SSam RavnborgHOSTLOADLIBES_qconf	= -L$(QTLIBPATH) -Wl,-rpath,$(QTLIBPATH) -l$(LIBS_QT) -ldl
1331da177e4SLinus TorvaldsHOSTCXXFLAGS_qconf.o	= -I$(QTDIR)/include -D LKC_DIRECT_LINK
1341da177e4SLinus Torvalds
1351da177e4SLinus TorvaldsHOSTLOADLIBES_gconf	= `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
1361da177e4SLinus TorvaldsHOSTCFLAGS_gconf.o	= `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
1371da177e4SLinus Torvalds                          -D LKC_DIRECT_LINK
1381da177e4SLinus Torvalds
1393b9fa093SArnaldo Carvalho de Melo$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h
1401da177e4SLinus Torvalds
1411da177e4SLinus Torvalds$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped
1421da177e4SLinus Torvalds$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped
1431da177e4SLinus Torvalds$(obj)/lex.zconf.c: $(src)/lex.zconf.c_shipped
1441da177e4SLinus Torvalds
1451da177e4SLinus Torvalds$(obj)/qconf.o: $(obj)/.tmp_qtcheck
1461da177e4SLinus Torvalds
1471da177e4SLinus Torvaldsifeq ($(qconf-target),1)
1481da177e4SLinus TorvaldsMOC = $(QTDIR)/bin/moc
1491da177e4SLinus TorvaldsQTLIBPATH = $(QTDIR)/lib
1501da177e4SLinus Torvalds-include $(obj)/.tmp_qtcheck
1511da177e4SLinus Torvalds
1521da177e4SLinus Torvalds# QT needs some extra effort...
1531da177e4SLinus Torvalds$(obj)/.tmp_qtcheck:
1541da177e4SLinus Torvalds	@set -e; for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
1551da177e4SLinus Torvalds	  if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \
1561da177e4SLinus Torvalds	done; \
1571da177e4SLinus Torvalds	if [ -z "$$DIR" ]; then \
1581da177e4SLinus Torvalds	  echo "*"; \
1591da177e4SLinus Torvalds	  echo "* Unable to find the QT installation. Please make sure that the"; \
1601da177e4SLinus Torvalds	  echo "* QT development package is correctly installed and the QTDIR"; \
1611da177e4SLinus Torvalds	  echo "* environment variable is set to the correct location."; \
1621da177e4SLinus Torvalds	  echo "*"; \
1631da177e4SLinus Torvalds	  false; \
1641da177e4SLinus Torvalds	fi; \
1651da177e4SLinus Torvalds	LIBPATH=$$DIR/lib; LIB=qt; \
166*ab919c06SSam Ravnborg	if [ -f $$QTLIB/libqt-mt.so ] ; then \
167*ab919c06SSam Ravnborg		LIB=qt-mt; \
168*ab919c06SSam Ravnborg		LIBPATH=$$QTLIB; \
169*ab919c06SSam Ravnborg	else \
1701da177e4SLinus Torvalds		$(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
1711da177e4SLinus Torvalds		LIBPATH=$$DIR/lib/$$($(HOSTCXX) -print-multi-os-directory); \
1721da177e4SLinus Torvalds		if [ -f $$LIBPATH/libqt-mt.so ]; then LIB=qt-mt; fi; \
173*ab919c06SSam Ravnborg	fi; \
1741da177e4SLinus Torvalds	echo "QTDIR=$$DIR" > $@; echo "QTLIBPATH=$$LIBPATH" >> $@; \
175*ab919c06SSam Ravnborg	echo "LIBS_QT=$$LIB" >> $@; \
1761da177e4SLinus Torvalds	if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \
1771da177e4SLinus Torvalds	  echo "*"; \
1781da177e4SLinus Torvalds	  echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \
1791da177e4SLinus Torvalds	  echo "*"; \
1801da177e4SLinus Torvalds	  echo "MOC=/usr/bin/moc" >> $@; \
1811da177e4SLinus Torvalds	fi
1821da177e4SLinus Torvaldsendif
1831da177e4SLinus Torvalds
1841da177e4SLinus Torvalds$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
1851da177e4SLinus Torvalds
1861da177e4SLinus Torvaldsifeq ($(gconf-target),1)
1871da177e4SLinus Torvalds-include $(obj)/.tmp_gtkcheck
1881da177e4SLinus Torvalds
1891da177e4SLinus Torvalds# GTK needs some extra effort, too...
1901da177e4SLinus Torvalds$(obj)/.tmp_gtkcheck:
1911da177e4SLinus Torvalds	@if `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --exists`; then		\
1921da177e4SLinus Torvalds		if `pkg-config gtk+-2.0 --atleast-version=2.0.0`; then			\
1931da177e4SLinus Torvalds			touch $@;								\
1941da177e4SLinus Torvalds		else									\
1951da177e4SLinus Torvalds			echo "*"; 							\
1961da177e4SLinus Torvalds			echo "* GTK+ is present but version >= 2.0.0 is required.";	\
1971da177e4SLinus Torvalds			echo "*";							\
1981da177e4SLinus Torvalds			false;								\
1991da177e4SLinus Torvalds		fi									\
2001da177e4SLinus Torvalds	else										\
2011da177e4SLinus Torvalds		echo "*"; 								\
2021da177e4SLinus Torvalds		echo "* Unable to find the GTK+ installation. Please make sure that"; 	\
2031da177e4SLinus Torvalds		echo "* the GTK+ 2.0 development package is correctly installed..."; 	\
2041da177e4SLinus Torvalds		echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; 		\
2051da177e4SLinus Torvalds		echo "*"; 								\
2061da177e4SLinus Torvalds		false;									\
2071da177e4SLinus Torvalds	fi
2081da177e4SLinus Torvaldsendif
2091da177e4SLinus Torvalds
2101da177e4SLinus Torvalds$(obj)/zconf.tab.o: $(obj)/lex.zconf.c
2111da177e4SLinus Torvalds
2121da177e4SLinus Torvalds$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
2131da177e4SLinus Torvalds
2141da177e4SLinus Torvalds$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
2151da177e4SLinus Torvalds
2161da177e4SLinus Torvalds$(obj)/gconf.o: $(obj)/lkc_defs.h
2171da177e4SLinus Torvalds
2181da177e4SLinus Torvalds$(obj)/%.moc: $(src)/%.h
2191da177e4SLinus Torvalds	$(MOC) -i $< -o $@
2201da177e4SLinus Torvalds
2211da177e4SLinus Torvalds$(obj)/lkc_defs.h: $(src)/lkc_proto.h
2221da177e4SLinus Torvalds	sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
2231da177e4SLinus Torvalds
2241da177e4SLinus Torvalds
2251da177e4SLinus Torvalds###
2261da177e4SLinus Torvalds# The following requires flex/bison
2271da177e4SLinus Torvalds# By default we use the _shipped versions, uncomment the following line if
2281da177e4SLinus Torvalds# you are modifying the flex/bison src.
2291da177e4SLinus Torvalds# LKC_GENPARSER := 1
2301da177e4SLinus Torvalds
2311da177e4SLinus Torvaldsifdef LKC_GENPARSER
2321da177e4SLinus Torvalds
2331da177e4SLinus Torvalds$(obj)/zconf.tab.c: $(obj)/zconf.y
2341da177e4SLinus Torvalds$(obj)/zconf.tab.h: $(obj)/zconf.tab.c
2351da177e4SLinus Torvalds
2361da177e4SLinus Torvalds%.tab.c: %.y
2371da177e4SLinus Torvalds	bison -t -d -v -b $* -p $(notdir $*) $<
2381da177e4SLinus Torvalds
2391da177e4SLinus Torvaldslex.%.c: %.l
2401da177e4SLinus Torvalds	flex -P$(notdir $*) -o$@ $<
2411da177e4SLinus Torvalds
2421da177e4SLinus Torvaldsendif
243