Makefile 11 KB

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