Makefile.kconfig 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. xconfig: $(obj)/qconf
  6. $< arch/$(ARCH)/Kconfig
  7. gconfig: $(obj)/gconf
  8. $< arch/$(ARCH)/Kconfig
  9. menuconfig: $(obj)/mconf
  10. $< arch/$(ARCH)/Kconfig
  11. config: $(obj)/conf
  12. $< arch/$(ARCH)/Kconfig
  13. oldconfig: $(obj)/conf
  14. $< -o arch/$(ARCH)/Kconfig
  15. silentoldconfig: $(obj)/conf
  16. $< -s arch/$(ARCH)/Kconfig
  17. update-po-config: $(obj)/kxgettext
  18. xgettext --default-domain=linux \
  19. --add-comments --keyword=_ --keyword=N_ \
  20. --files-from=scripts/kconfig/POTFILES.in \
  21. --output scripts/kconfig/config.pot
  22. $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
  23. $(Q)for i in `ls arch/`; \
  24. do \
  25. scripts/kconfig/kxgettext arch/$$i/Kconfig \
  26. | msguniq -o scripts/kconfig/linux_$${i}.pot; \
  27. done
  28. $(Q)msgcat scripts/kconfig/config.pot \
  29. `find scripts/kconfig/ -type f -name linux_*.pot` \
  30. --output scripts/kconfig/linux_raw.pot
  31. $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
  32. --output scripts/kconfig/linux.pot
  33. $(Q)rm -f arch/um/Kconfig_arch
  34. $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
  35. PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
  36. randconfig: $(obj)/conf
  37. $< -r arch/$(ARCH)/Kconfig
  38. allyesconfig: $(obj)/conf
  39. $< -y arch/$(ARCH)/Kconfig
  40. allnoconfig: $(obj)/conf
  41. $< -n arch/$(ARCH)/Kconfig
  42. allmodconfig: $(obj)/conf
  43. $< -m arch/$(ARCH)/Kconfig
  44. defconfig: $(obj)/conf
  45. ifeq ($(KBUILD_DEFCONFIG),)
  46. $< -d arch/$(ARCH)/Kconfig
  47. else
  48. @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
  49. $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
  50. endif
  51. %_defconfig: $(obj)/conf
  52. $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
  53. # Help text used by make help
  54. help:
  55. @echo ' config - Update current config utilising a line-oriented program'
  56. @echo ' menuconfig - Update current config utilising a menu based program'
  57. @echo ' xconfig - Update current config utilising a QT based front-end'
  58. @echo ' gconfig - Update current config utilising a GTK based front-end'
  59. @echo ' oldconfig - Update current config utilising a provided .config as base'
  60. @echo ' silentoldconfig - Same as oldconfig, but quietly'
  61. @echo ' randconfig - New config with random answer to all options'
  62. @echo ' defconfig - New config with default answer to all options'
  63. @echo ' allmodconfig - New config selecting modules when possible'
  64. @echo ' allyesconfig - New config where all options are accepted with yes'
  65. @echo ' allnoconfig - New config where all options are answered with no'
  66. # lxdialog stuff
  67. check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
  68. # Use reursively expanded variables so we do not call gcc unless
  69. # we really need to do so. (Do not call gcc as part of make mrproper)
  70. HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
  71. HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
  72. HOST_EXTRACFLAGS += -DLOCALE
  73. PHONY += $(obj)/dochecklxdialog
  74. $(obj)/dochecklxdialog:
  75. $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
  76. always := dochecklxdialog
  77. # ===========================================================================
  78. # Shared Makefile for the various kconfig executables:
  79. # conf: Used for defconfig, oldconfig and related targets
  80. # mconf: Used for the mconfig target.
  81. # Utilizes the lxdialog package
  82. # qconf: Used for the xconfig target
  83. # Based on QT which needs to be installed to compile it
  84. # gconf: Used for the gconfig target
  85. # Based on GTK which needs to be installed to compile it
  86. # object files used by all kconfig flavours
  87. lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
  88. lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
  89. conf-objs := conf.o zconf.tab.o
  90. mconf-objs := mconf.o zconf.tab.o $(lxdialog)
  91. kxgettext-objs := kxgettext.o zconf.tab.o
  92. hostprogs-y := conf qconf gconf kxgettext
  93. #ifeq ($(MAKECMDGOALS),menuconfig)
  94. hostprogs-y += mconf
  95. #endif
  96. ifeq ($(MAKECMDGOALS),xconfig)
  97. qconf-target := 1
  98. endif
  99. ifeq ($(MAKECMDGOALS),gconfig)
  100. gconf-target := 1
  101. endif
  102. ifeq ($(qconf-target),1)
  103. qconf-cxxobjs := qconf.o
  104. qconf-objs := kconfig_load.o zconf.tab.o
  105. endif
  106. ifeq ($(gconf-target),1)
  107. gconf-objs := gconf.o kconfig_load.o zconf.tab.o
  108. endif
  109. clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
  110. .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
  111. # Needed for systems without gettext
  112. KBUILD_HAVE_NLS := $(shell \
  113. if echo "\#include <libintl.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \
  114. then echo yes ; \
  115. else echo no ; fi)
  116. ifeq ($(KBUILD_HAVE_NLS),no)
  117. HOSTCFLAGS += -DKBUILD_NO_NLS
  118. endif
  119. # generated files seem to need this to find local include files
  120. HOSTCFLAGS_lex.zconf.o := -I$(src)
  121. HOSTCFLAGS_zconf.tab.o := -I$(src)
  122. HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
  123. HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
  124. HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
  125. HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
  126. -D LKC_DIRECT_LINK
  127. $(obj)/qconf.o: $(obj)/.tmp_qtcheck
  128. ifeq ($(qconf-target),1)
  129. $(obj)/.tmp_qtcheck: $(src)/Makefile
  130. -include $(obj)/.tmp_qtcheck
  131. # QT needs some extra effort...
  132. $(obj)/.tmp_qtcheck:
  133. @set -e; echo " CHECK qt"; dir=""; pkg=""; \
  134. pkg-config --exists qt 2> /dev/null && pkg=qt; \
  135. pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
  136. if [ -n "$$pkg" ]; then \
  137. cflags="\$$(shell pkg-config $$pkg --cflags)"; \
  138. libs="\$$(shell pkg-config $$pkg --libs)"; \
  139. moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
  140. dir="$$(pkg-config $$pkg --variable=prefix)"; \
  141. else \
  142. for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
  143. if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
  144. done; \
  145. if [ -z "$$dir" ]; then \
  146. echo "*"; \
  147. echo "* Unable to find the QT installation. Please make sure that"; \
  148. echo "* the QT development package is correctly installed and"; \
  149. echo "* either install pkg-config or set the QTDIR environment"; \
  150. echo "* variable to the correct location."; \
  151. echo "*"; \
  152. false; \
  153. fi; \
  154. libpath=$$dir/lib; lib=qt; osdir=""; \
  155. $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
  156. osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
  157. test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
  158. test -f $$libpath/libqt-mt.so && lib=qt-mt; \
  159. cflags="-I$$dir/include"; \
  160. libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
  161. moc="$$dir/bin/moc"; \
  162. fi; \
  163. if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
  164. echo "*"; \
  165. echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
  166. echo "*"; \
  167. moc="/usr/bin/moc"; \
  168. fi; \
  169. echo "KC_QT_CFLAGS=$$cflags" > $@; \
  170. echo "KC_QT_LIBS=$$libs" >> $@; \
  171. echo "KC_QT_MOC=$$moc" >> $@
  172. endif
  173. $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
  174. ifeq ($(gconf-target),1)
  175. -include $(obj)/.tmp_gtkcheck
  176. # GTK needs some extra effort, too...
  177. $(obj)/.tmp_gtkcheck:
  178. @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
  179. if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
  180. touch $@; \
  181. else \
  182. echo "*"; \
  183. echo "* GTK+ is present but version >= 2.0.0 is required."; \
  184. echo "*"; \
  185. false; \
  186. fi \
  187. else \
  188. echo "*"; \
  189. echo "* Unable to find the GTK+ installation. Please make sure that"; \
  190. echo "* the GTK+ 2.0 development package is correctly installed..."; \
  191. echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
  192. echo "*"; \
  193. false; \
  194. fi
  195. endif
  196. $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
  197. $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
  198. $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
  199. $(obj)/gconf.o: $(obj)/lkc_defs.h
  200. $(obj)/%.moc: $(src)/%.h
  201. $(KC_QT_MOC) -i $< -o $@
  202. $(obj)/lkc_defs.h: $(src)/lkc_proto.h
  203. sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  204. ###
  205. # The following requires flex/bison/gperf
  206. # By default we use the _shipped versions, uncomment the following line if
  207. # you are modifying the flex/bison src.
  208. # LKC_GENPARSER := 1
  209. ifdef LKC_GENPARSER
  210. $(obj)/zconf.tab.c: $(src)/zconf.y
  211. $(obj)/lex.zconf.c: $(src)/zconf.l
  212. $(obj)/zconf.hash.c: $(src)/zconf.gperf
  213. %.tab.c: %.y
  214. bison -l -b $* -p $(notdir $*) $<
  215. cp $@ $@_shipped
  216. lex.%.c: %.l
  217. flex -L -P$(notdir $*) -o$@ $<
  218. cp $@ $@_shipped
  219. %.hash.c: %.gperf
  220. gperf < $< > $@
  221. cp $@ $@_shipped
  222. endif