Makefile.kconfig 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. # ===========================================================================
  2. # Kernel configuration targets
  3. # These targets are used from top-level makefile
  4. PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
  5. localmodconfig localyesconfig
  6. ifdef KBUILD_KCONFIG
  7. Kconfig := $(KBUILD_KCONFIG)
  8. else
  9. Kconfig := Kconfig
  10. endif
  11. # We need this, in case the user has it in its environment
  12. unexport CONFIG_
  13. xconfig: $(obj)/qconf
  14. $< $(Kconfig)
  15. gconfig: $(obj)/gconf
  16. $< $(Kconfig)
  17. menuconfig: $(obj)/mconf
  18. $< $(Kconfig)
  19. config: $(obj)/conf
  20. $< --oldaskconfig $(Kconfig)
  21. nconfig: $(obj)/nconf
  22. $< $(Kconfig)
  23. oldconfig: $(obj)/conf
  24. $< --$@ $(Kconfig)
  25. silentoldconfig: $(obj)/conf
  26. $(Q)mkdir -p include/generated
  27. $< --$@ $(Kconfig)
  28. localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
  29. $(Q)mkdir -p include/generated
  30. $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
  31. $(Q)if [ -f .config ]; then \
  32. cmp -s .tmp.config .config || \
  33. (mv -f .config .config.old.1; \
  34. mv -f .tmp.config .config; \
  35. $(obj)/conf --silentoldconfig $(Kconfig); \
  36. mv -f .config.old.1 .config.old) \
  37. else \
  38. mv -f .tmp.config .config; \
  39. $(obj)/conf --silentoldconfig $(Kconfig); \
  40. fi
  41. $(Q)rm -f .tmp.config
  42. # Create new linux.pot file
  43. # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
  44. update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
  45. $(Q)echo " GEN config.pot"
  46. $(Q)xgettext --default-domain=linux \
  47. --add-comments --keyword=_ --keyword=N_ \
  48. --from-code=UTF-8 \
  49. --files-from=$(srctree)/scripts/kconfig/POTFILES.in \
  50. --directory=$(srctree) --directory=$(objtree) \
  51. --output $(obj)/config.pot
  52. $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
  53. $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
  54. $(srctree)/arch/*/um/Kconfig`; \
  55. do \
  56. echo " GEN $$i"; \
  57. $(obj)/kxgettext $$i \
  58. >> $(obj)/config.pot; \
  59. done )
  60. $(Q)echo " GEN linux.pot"
  61. $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
  62. --output $(obj)/linux.pot
  63. $(Q)rm -f $(obj)/config.pot
  64. PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
  65. allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
  66. $< --$@ $(Kconfig)
  67. PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig
  68. listnewconfig olddefconfig: $(obj)/conf
  69. $< --$@ $(Kconfig)
  70. # oldnoconfig is an alias of olddefconfig, because people already are dependent
  71. # on its behavior(sets new symbols to their default value but not 'n') with the
  72. # counter-intuitive name.
  73. oldnoconfig: $(obj)/conf
  74. $< --olddefconfig $(Kconfig)
  75. savedefconfig: $(obj)/conf
  76. $< --$@=defconfig $(Kconfig)
  77. defconfig: $(obj)/conf
  78. ifeq ($(KBUILD_DEFCONFIG),)
  79. $< --defconfig $(Kconfig)
  80. else
  81. @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
  82. $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
  83. endif
  84. %_defconfig: $(obj)/conf
  85. $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
  86. # Help text used by make help
  87. help:
  88. @echo ' config - Update current config utilising a line-oriented program'
  89. @echo ' nconfig - Update current config utilising a ncurses menu based program'
  90. @echo ' menuconfig - Update current config utilising a menu based program'
  91. @echo ' xconfig - Update current config utilising a QT based front-end'
  92. @echo ' gconfig - Update current config utilising a GTK based front-end'
  93. @echo ' oldconfig - Update current config utilising a provided .config as base'
  94. @echo ' localmodconfig - Update current config disabling modules not loaded'
  95. @echo ' localyesconfig - Update current config converting local mods to core'
  96. @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
  97. @echo ' defconfig - New config with default from ARCH supplied defconfig'
  98. @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
  99. @echo ' allnoconfig - New config where all options are answered with no'
  100. @echo ' allyesconfig - New config where all options are accepted with yes'
  101. @echo ' allmodconfig - New config selecting modules when possible'
  102. @echo ' alldefconfig - New config with all symbols set to default'
  103. @echo ' randconfig - New config with random answer to all options'
  104. @echo ' listnewconfig - List new options'
  105. @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
  106. # lxdialog stuff
  107. check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
  108. # Use recursively expanded variables so we do not call gcc unless
  109. # we really need to do so. (Do not call gcc as part of make mrproper)
  110. HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
  111. -DLOCALE
  112. # ===========================================================================
  113. # Shared Makefile for the various kconfig executables:
  114. # conf: Used for defconfig, oldconfig and related targets
  115. # nconf: Used for the nconfig target.
  116. # Utilizes ncurses
  117. # mconf: Used for the menuconfig target
  118. # Utilizes the lxdialog package
  119. # qconf: Used for the xconfig target
  120. # Based on QT which needs to be installed to compile it
  121. # gconf: Used for the gconfig target
  122. # Based on GTK which needs to be installed to compile it
  123. # object files used by all kconfig flavours
  124. lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
  125. lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
  126. conf-objs := conf.o zconf.tab.o
  127. mconf-objs := mconf.o zconf.tab.o $(lxdialog)
  128. nconf-objs := nconf.o zconf.tab.o nconf.gui.o
  129. kxgettext-objs := kxgettext.o zconf.tab.o
  130. qconf-cxxobjs := qconf.o
  131. qconf-objs := zconf.tab.o
  132. gconf-objs := gconf.o zconf.tab.o
  133. hostprogs-y := conf
  134. ifeq ($(MAKECMDGOALS),nconfig)
  135. hostprogs-y += nconf
  136. endif
  137. ifeq ($(MAKECMDGOALS),menuconfig)
  138. hostprogs-y += mconf
  139. endif
  140. ifeq ($(MAKECMDGOALS),update-po-config)
  141. hostprogs-y += kxgettext
  142. endif
  143. ifeq ($(MAKECMDGOALS),xconfig)
  144. qconf-target := 1
  145. endif
  146. ifeq ($(MAKECMDGOALS),gconfig)
  147. gconf-target := 1
  148. endif
  149. ifeq ($(qconf-target),1)
  150. hostprogs-y += qconf
  151. endif
  152. ifeq ($(gconf-target),1)
  153. hostprogs-y += gconf
  154. endif
  155. clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck
  156. clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
  157. clean-files += mconf qconf gconf nconf
  158. clean-files += config.pot linux.pot
  159. # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
  160. PHONY += $(obj)/dochecklxdialog
  161. $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
  162. $(obj)/dochecklxdialog:
  163. $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
  164. always := dochecklxdialog
  165. # Add environment specific flags
  166. HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
  167. # generated files seem to need this to find local include files
  168. HOSTCFLAGS_zconf.lex.o := -I$(src)
  169. HOSTCFLAGS_zconf.tab.o := -I$(src)
  170. LEX_PREFIX_zconf := zconf
  171. YACC_PREFIX_zconf := zconf
  172. HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
  173. HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
  174. HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
  175. HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
  176. -Wno-missing-prototypes
  177. HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
  178. HOSTLOADLIBES_nconf = $(shell \
  179. pkg-config --libs menu panel ncurses 2>/dev/null \
  180. || echo "-lmenu -lpanel -lncurses" )
  181. $(obj)/qconf.o: $(obj)/.tmp_qtcheck
  182. ifeq ($(qconf-target),1)
  183. $(obj)/.tmp_qtcheck: $(src)/Makefile
  184. -include $(obj)/.tmp_qtcheck
  185. # QT needs some extra effort...
  186. $(obj)/.tmp_qtcheck:
  187. @set -e; echo " CHECK qt"; dir=""; pkg=""; \
  188. if ! pkg-config --exists QtCore 2> /dev/null; then \
  189. echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
  190. pkg-config --exists qt 2> /dev/null && pkg=qt; \
  191. pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
  192. if [ -n "$$pkg" ]; then \
  193. cflags="\$$(shell pkg-config $$pkg --cflags)"; \
  194. libs="\$$(shell pkg-config $$pkg --libs)"; \
  195. moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
  196. dir="$$(pkg-config $$pkg --variable=prefix)"; \
  197. else \
  198. for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
  199. if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
  200. done; \
  201. if [ -z "$$dir" ]; then \
  202. echo >&2 "*"; \
  203. echo >&2 "* Unable to find any QT installation. Please make sure that"; \
  204. echo >&2 "* the QT4 or QT3 development package is correctly installed and"; \
  205. echo >&2 "* either qmake can be found or install pkg-config or set"; \
  206. echo >&2 "* the QTDIR environment variable to the correct location."; \
  207. echo >&2 "*"; \
  208. false; \
  209. fi; \
  210. libpath=$$dir/lib; lib=qt; osdir=""; \
  211. $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
  212. osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
  213. test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
  214. test -f $$libpath/libqt-mt.so && lib=qt-mt; \
  215. cflags="-I$$dir/include"; \
  216. libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
  217. moc="$$dir/bin/moc"; \
  218. fi; \
  219. if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
  220. echo "*"; \
  221. echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
  222. echo "*"; \
  223. moc="/usr/bin/moc"; \
  224. fi; \
  225. else \
  226. cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
  227. libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
  228. moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \
  229. [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \
  230. fi; \
  231. echo "KC_QT_CFLAGS=$$cflags" > $@; \
  232. echo "KC_QT_LIBS=$$libs" >> $@; \
  233. echo "KC_QT_MOC=$$moc" >> $@
  234. endif
  235. $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
  236. ifeq ($(gconf-target),1)
  237. -include $(obj)/.tmp_gtkcheck
  238. # GTK needs some extra effort, too...
  239. $(obj)/.tmp_gtkcheck:
  240. @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
  241. if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
  242. touch $@; \
  243. else \
  244. echo >&2 "*"; \
  245. echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \
  246. echo >&2 "*"; \
  247. false; \
  248. fi \
  249. else \
  250. echo >&2 "*"; \
  251. echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \
  252. echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \
  253. echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
  254. echo >&2 "*"; \
  255. false; \
  256. fi
  257. endif
  258. $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c
  259. $(obj)/qconf.o: $(obj)/qconf.moc
  260. quiet_cmd_moc = MOC $@
  261. cmd_moc = $(KC_QT_MOC) -i $< -o $@
  262. $(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck
  263. $(call cmd,moc)
  264. # Extract gconf menu items for I18N support
  265. $(obj)/gconf.glade.h: $(obj)/gconf.glade
  266. $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
  267. $(obj)/gconf.glade