Makefile 8.6 KB

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