xref: /linux/scripts/kconfig/Makefile (revision 2982de6993e6d9944f2215d7cb9b558b465a0c99)
11da177e4SLinus Torvalds# ===========================================================================
21da177e4SLinus Torvalds# Kernel configuration targets
31da177e4SLinus Torvalds# These targets are used from top-level makefile
41da177e4SLinus Torvalds
54f193362SPaul SmithPHONY += 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	$< arch/$(ARCH)/Kconfig
151da177e4SLinus Torvalds
161da177e4SLinus Torvaldsconfig: $(obj)/conf
171da177e4SLinus Torvalds	$< arch/$(ARCH)/Kconfig
181da177e4SLinus Torvalds
191da177e4SLinus Torvaldsoldconfig: $(obj)/conf
201da177e4SLinus Torvalds	$< -o arch/$(ARCH)/Kconfig
211da177e4SLinus Torvalds
221da177e4SLinus Torvaldssilentoldconfig: $(obj)/conf
231da177e4SLinus Torvalds	$< -s arch/$(ARCH)/Kconfig
241da177e4SLinus Torvalds
253b9fa093SArnaldo Carvalho de Meloupdate-po-config: $(obj)/kxgettext
263b9fa093SArnaldo Carvalho de Melo	xgettext --default-domain=linux \
273b9fa093SArnaldo Carvalho de Melo          --add-comments --keyword=_ --keyword=N_ \
283b9fa093SArnaldo Carvalho de Melo          --files-from=scripts/kconfig/POTFILES.in \
29720d6c29SEgry Gabor          --output scripts/kconfig/config.pot
30720d6c29SEgry Gabor	$(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
31720d6c29SEgry Gabor	$(Q)for i in `ls arch/`; \
32720d6c29SEgry Gabor	do \
33720d6c29SEgry Gabor	  scripts/kconfig/kxgettext arch/$$i/Kconfig \
34720d6c29SEgry Gabor	    | msguniq -o scripts/kconfig/linux_$${i}.pot; \
35720d6c29SEgry Gabor	done
36720d6c29SEgry Gabor	$(Q)msgcat scripts/kconfig/config.pot \
37720d6c29SEgry Gabor	  `find scripts/kconfig/ -type f -name linux_*.pot` \
38720d6c29SEgry Gabor	  --output scripts/kconfig/linux_raw.pot
39720d6c29SEgry Gabor	$(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
40720d6c29SEgry Gabor	    --output scripts/kconfig/linux.pot
41720d6c29SEgry Gabor	$(Q)rm -f arch/um/Kconfig_arch
42720d6c29SEgry Gabor	$(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
433b9fa093SArnaldo Carvalho de Melo
444f193362SPaul SmithPHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
451da177e4SLinus Torvalds
461da177e4SLinus Torvaldsrandconfig: $(obj)/conf
471da177e4SLinus Torvalds	$< -r arch/$(ARCH)/Kconfig
481da177e4SLinus Torvalds
491da177e4SLinus Torvaldsallyesconfig: $(obj)/conf
501da177e4SLinus Torvalds	$< -y arch/$(ARCH)/Kconfig
511da177e4SLinus Torvalds
521da177e4SLinus Torvaldsallnoconfig: $(obj)/conf
531da177e4SLinus Torvalds	$< -n arch/$(ARCH)/Kconfig
541da177e4SLinus Torvalds
551da177e4SLinus Torvaldsallmodconfig: $(obj)/conf
561da177e4SLinus Torvalds	$< -m arch/$(ARCH)/Kconfig
571da177e4SLinus Torvalds
581da177e4SLinus Torvaldsdefconfig: $(obj)/conf
591da177e4SLinus Torvaldsifeq ($(KBUILD_DEFCONFIG),)
601da177e4SLinus Torvalds	$< -d arch/$(ARCH)/Kconfig
611da177e4SLinus Torvaldselse
621da177e4SLinus Torvalds	@echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
631da177e4SLinus Torvalds	$(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
641da177e4SLinus Torvaldsendif
651da177e4SLinus Torvalds
661da177e4SLinus Torvalds%_defconfig: $(obj)/conf
671da177e4SLinus Torvalds	$(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
681da177e4SLinus Torvalds
691da177e4SLinus Torvalds# Help text used by make help
701da177e4SLinus Torvaldshelp:
711da177e4SLinus Torvalds	@echo  '  config	  - Update current config utilising a line-oriented program'
721da177e4SLinus Torvalds	@echo  '  menuconfig	  - Update current config utilising a menu based program'
731da177e4SLinus Torvalds	@echo  '  xconfig	  - Update current config utilising a QT based front-end'
741da177e4SLinus Torvalds	@echo  '  gconfig	  - Update current config utilising a GTK based front-end'
751da177e4SLinus Torvalds	@echo  '  oldconfig	  - Update current config utilising a provided .config as base'
76b32c8268SRobert P. J. Day	@echo  '  silentoldconfig - Same as oldconfig, but quietly'
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'
81e11f0496SJesper Juhl	@echo  '  allnoconfig	  - New config where all options are answered with no'
821da177e4SLinus Torvalds
83*2982de69SSam Ravnborg# lxdialog stuff
84*2982de69SSam Ravnborgcheck-lxdialog  := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
85*2982de69SSam Ravnborg
86*2982de69SSam Ravnborg# Use reursively expanded variables so we do not call gcc unless
87*2982de69SSam Ravnborg# we really need to do so. (Do not call gcc as part of make mrproper)
88*2982de69SSam RavnborgHOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
89*2982de69SSam RavnborgHOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
90*2982de69SSam Ravnborg
91*2982de69SSam RavnborgHOST_EXTRACFLAGS += -DLOCALE
92*2982de69SSam Ravnborg
93*2982de69SSam RavnborgPHONY += $(obj)/dochecklxdialog
94*2982de69SSam Ravnborg$(obj)/dochecklxdialog:
95*2982de69SSam Ravnborg	$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
96*2982de69SSam Ravnborg
97*2982de69SSam Ravnborgalways := dochecklxdialog
98*2982de69SSam Ravnborg
99*2982de69SSam Ravnborg
1001da177e4SLinus Torvalds# ===========================================================================
1011da177e4SLinus Torvalds# Shared Makefile for the various kconfig executables:
1021da177e4SLinus Torvalds# conf:	  Used for defconfig, oldconfig and related targets
1031da177e4SLinus Torvalds# mconf:  Used for the mconfig target.
1041da177e4SLinus Torvalds#         Utilizes the lxdialog package
1051da177e4SLinus Torvalds# qconf:  Used for the xconfig target
1061da177e4SLinus Torvalds#         Based on QT which needs to be installed to compile it
1071da177e4SLinus Torvalds# gconf:  Used for the gconfig target
1081da177e4SLinus Torvalds#         Based on GTK which needs to be installed to compile it
1091da177e4SLinus Torvalds# object files used by all kconfig flavours
1101da177e4SLinus Torvalds
111*2982de69SSam Ravnborglxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
112*2982de69SSam Ravnborglxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
113*2982de69SSam Ravnborg
1143b9fa093SArnaldo Carvalho de Melohostprogs-y	:= conf mconf qconf gconf kxgettext
1151da177e4SLinus Torvaldsconf-objs	:= conf.o  zconf.tab.o
116*2982de69SSam Ravnborgmconf-objs	:= mconf.o zconf.tab.o $(lxdialog)
1173b9fa093SArnaldo Carvalho de Melokxgettext-objs	:= kxgettext.o zconf.tab.o
1181da177e4SLinus Torvalds
1191da177e4SLinus Torvaldsifeq ($(MAKECMDGOALS),xconfig)
1201da177e4SLinus Torvalds	qconf-target := 1
1211da177e4SLinus Torvaldsendif
1221da177e4SLinus Torvaldsifeq ($(MAKECMDGOALS),gconfig)
1231da177e4SLinus Torvalds	gconf-target := 1
1241da177e4SLinus Torvaldsendif
1251da177e4SLinus Torvalds
1261da177e4SLinus Torvalds
1271da177e4SLinus Torvaldsifeq ($(qconf-target),1)
1281da177e4SLinus Torvaldsqconf-cxxobjs	:= qconf.o
1291da177e4SLinus Torvaldsqconf-objs	:= kconfig_load.o zconf.tab.o
1301da177e4SLinus Torvaldsendif
1311da177e4SLinus Torvalds
1321da177e4SLinus Torvaldsifeq ($(gconf-target),1)
1331da177e4SLinus Torvaldsgconf-objs	:= gconf.o kconfig_load.o zconf.tab.o
1341da177e4SLinus Torvaldsendif
1351da177e4SLinus Torvalds
1361da177e4SLinus Torvaldsclean-files	:= lkc_defs.h qconf.moc .tmp_qtcheck \
1377a88488bSRoman Zippel		   .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
1386f6046cfSSam Ravnborgsubdir- += lxdialog
1391da177e4SLinus Torvalds
14070a6a0cbSYuri Vasilevski# Needed for systems without gettext
14170a6a0cbSYuri VasilevskiKBUILD_HAVE_NLS := $(shell \
1424ecc65e4SYuri Vasilevski     if echo "\#include <libintl.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \
14370a6a0cbSYuri Vasilevski     then echo yes ; \
14470a6a0cbSYuri Vasilevski     else echo no ; fi)
14570a6a0cbSYuri Vasilevskiifeq ($(KBUILD_HAVE_NLS),no)
14670a6a0cbSYuri VasilevskiHOSTCFLAGS	+= -DKBUILD_NO_NLS
14770a6a0cbSYuri Vasilevskiendif
14870a6a0cbSYuri Vasilevski
1491da177e4SLinus Torvalds# generated files seem to need this to find local include files
1501da177e4SLinus TorvaldsHOSTCFLAGS_lex.zconf.o	:= -I$(src)
1511da177e4SLinus TorvaldsHOSTCFLAGS_zconf.tab.o	:= -I$(src)
1521da177e4SLinus Torvalds
153b3a5225fSRoman ZippelHOSTLOADLIBES_qconf	= $(KC_QT_LIBS) -ldl
154b3a5225fSRoman ZippelHOSTCXXFLAGS_qconf.o	= $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
1551da177e4SLinus Torvalds
15637193147SAdrian BunkHOSTLOADLIBES_gconf	= `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
15737193147SAdrian BunkHOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
1581da177e4SLinus Torvalds                          -D LKC_DIRECT_LINK
1591da177e4SLinus Torvalds
1601da177e4SLinus Torvalds$(obj)/qconf.o: $(obj)/.tmp_qtcheck
1611da177e4SLinus Torvalds
1621da177e4SLinus Torvaldsifeq ($(qconf-target),1)
163b3a5225fSRoman Zippel$(obj)/.tmp_qtcheck: $(src)/Makefile
1641da177e4SLinus Torvalds-include $(obj)/.tmp_qtcheck
1651da177e4SLinus Torvalds
1661da177e4SLinus Torvalds# QT needs some extra effort...
1671da177e4SLinus Torvalds$(obj)/.tmp_qtcheck:
168b3a5225fSRoman Zippel	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
169b3a5225fSRoman Zippel	pkg-config --exists qt 2> /dev/null && pkg=qt; \
170b3a5225fSRoman Zippel	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
171b3a5225fSRoman Zippel	if [ -n "$$pkg" ]; then \
172b3a5225fSRoman Zippel	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
173b3a5225fSRoman Zippel	  libs="\$$(shell pkg-config $$pkg --libs)"; \
174b3a5225fSRoman Zippel	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
175b3a5225fSRoman Zippel	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
176b3a5225fSRoman Zippel	else \
177b3a5225fSRoman Zippel	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
178b3a5225fSRoman Zippel	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
1791da177e4SLinus Torvalds	  done; \
180b3a5225fSRoman Zippel	  if [ -z "$$dir" ]; then \
1811da177e4SLinus Torvalds	    echo "*"; \
182b3a5225fSRoman Zippel	    echo "* Unable to find the QT installation. Please make sure that"; \
183b3a5225fSRoman Zippel	    echo "* the QT development package is correctly installed and"; \
184b3a5225fSRoman Zippel	    echo "* either install pkg-config or set the QTDIR environment"; \
185b3a5225fSRoman Zippel	    echo "* variable to the correct location."; \
1861da177e4SLinus Torvalds	    echo "*"; \
1871da177e4SLinus Torvalds	    false; \
1881da177e4SLinus Torvalds	  fi; \
189b3a5225fSRoman Zippel	  libpath=$$dir/lib; lib=qt; osdir=""; \
1901da177e4SLinus Torvalds	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
191b3a5225fSRoman Zippel	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
192b3a5225fSRoman Zippel	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
193b3a5225fSRoman Zippel	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
194b3a5225fSRoman Zippel	  cflags="-I$$dir/include"; \
195b3a5225fSRoman Zippel	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
196b3a5225fSRoman Zippel	  moc="$$dir/bin/moc"; \
197ab919c06SSam Ravnborg	fi; \
198b3a5225fSRoman Zippel	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
1991da177e4SLinus Torvalds	  echo "*"; \
200b3a5225fSRoman Zippel	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
2011da177e4SLinus Torvalds	  echo "*"; \
202b3a5225fSRoman Zippel	  moc="/usr/bin/moc"; \
203b3a5225fSRoman Zippel	fi; \
204b3a5225fSRoman Zippel	echo "KC_QT_CFLAGS=$$cflags" > $@; \
205b3a5225fSRoman Zippel	echo "KC_QT_LIBS=$$libs" >> $@; \
206b3a5225fSRoman Zippel	echo "KC_QT_MOC=$$moc" >> $@
2071da177e4SLinus Torvaldsendif
2081da177e4SLinus Torvalds
2091da177e4SLinus Torvalds$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
2101da177e4SLinus Torvalds
2111da177e4SLinus Torvaldsifeq ($(gconf-target),1)
2121da177e4SLinus Torvalds-include $(obj)/.tmp_gtkcheck
2131da177e4SLinus Torvalds
2141da177e4SLinus Torvalds# GTK needs some extra effort, too...
2151da177e4SLinus Torvalds$(obj)/.tmp_gtkcheck:
21637193147SAdrian Bunk	@if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then		\
21737193147SAdrian Bunk		if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then			\
2181da177e4SLinus Torvalds			touch $@;								\
2191da177e4SLinus Torvalds		else									\
2201da177e4SLinus Torvalds			echo "*"; 							\
2211da177e4SLinus Torvalds			echo "* GTK+ is present but version >= 2.0.0 is required.";	\
2221da177e4SLinus Torvalds			echo "*";							\
2231da177e4SLinus Torvalds			false;								\
2241da177e4SLinus Torvalds		fi									\
2251da177e4SLinus Torvalds	else										\
2261da177e4SLinus Torvalds		echo "*"; 								\
2271da177e4SLinus Torvalds		echo "* Unable to find the GTK+ installation. Please make sure that"; 	\
2281da177e4SLinus Torvalds		echo "* the GTK+ 2.0 development package is correctly installed..."; 	\
2291da177e4SLinus Torvalds		echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; 		\
2301da177e4SLinus Torvalds		echo "*"; 								\
2311da177e4SLinus Torvalds		false;									\
2321da177e4SLinus Torvalds	fi
2331da177e4SLinus Torvaldsendif
2341da177e4SLinus Torvalds
2357a88488bSRoman Zippel$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
2361da177e4SLinus Torvalds
2371da177e4SLinus Torvalds$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
2381da177e4SLinus Torvalds
2391da177e4SLinus Torvalds$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
2401da177e4SLinus Torvalds
2411da177e4SLinus Torvalds$(obj)/gconf.o: $(obj)/lkc_defs.h
2421da177e4SLinus Torvalds
2431da177e4SLinus Torvalds$(obj)/%.moc: $(src)/%.h
244b3a5225fSRoman Zippel	$(KC_QT_MOC) -i $< -o $@
2451da177e4SLinus Torvalds
2461da177e4SLinus Torvalds$(obj)/lkc_defs.h: $(src)/lkc_proto.h
2471da177e4SLinus Torvalds	sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
2481da177e4SLinus Torvalds
2491da177e4SLinus Torvalds
2501da177e4SLinus Torvalds###
2517a88488bSRoman Zippel# The following requires flex/bison/gperf
2521da177e4SLinus Torvalds# By default we use the _shipped versions, uncomment the following line if
2531da177e4SLinus Torvalds# you are modifying the flex/bison src.
2541da177e4SLinus Torvalds# LKC_GENPARSER := 1
2551da177e4SLinus Torvalds
2561da177e4SLinus Torvaldsifdef LKC_GENPARSER
2571da177e4SLinus Torvalds
258491d7110SRoman Zippel$(obj)/zconf.tab.c: $(src)/zconf.y
259491d7110SRoman Zippel$(obj)/lex.zconf.c: $(src)/zconf.l
2607a88488bSRoman Zippel$(obj)/zconf.hash.c: $(src)/zconf.gperf
2611da177e4SLinus Torvalds
2621da177e4SLinus Torvalds%.tab.c: %.y
263491d7110SRoman Zippel	bison -l -b $* -p $(notdir $*) $<
264491d7110SRoman Zippel	cp $@ $@_shipped
2651da177e4SLinus Torvalds
2661da177e4SLinus Torvaldslex.%.c: %.l
267491d7110SRoman Zippel	flex -L -P$(notdir $*) -o$@ $<
268491d7110SRoman Zippel	cp $@ $@_shipped
2691da177e4SLinus Torvalds
2707a88488bSRoman Zippel%.hash.c: %.gperf
2717a88488bSRoman Zippel	gperf < $< > $@
2727a88488bSRoman Zippel	cp $@ $@_shipped
2737a88488bSRoman Zippel
2741da177e4SLinus Torvaldsendif
275