Makefile 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog
  11. $< arch/$(ARCH)/Kconfig
  12. config: $(obj)/conf
  13. $< arch/$(ARCH)/Kconfig
  14. oldconfig: $(obj)/conf
  15. $< -o arch/$(ARCH)/Kconfig
  16. silentoldconfig: $(obj)/conf
  17. $< -s arch/$(ARCH)/Kconfig
  18. update-po-config: $(obj)/kxgettext
  19. xgettext --default-domain=linux \
  20. --add-comments --keyword=_ --keyword=N_ \
  21. --files-from=scripts/kconfig/POTFILES.in \
  22. --output scripts/kconfig/config.pot
  23. $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
  24. $(Q)for i in `ls arch/`; \
  25. do \
  26. scripts/kconfig/kxgettext arch/$$i/Kconfig \
  27. | msguniq -o scripts/kconfig/linux_$${i}.pot; \
  28. done
  29. $(Q)msgcat scripts/kconfig/config.pot \
  30. `find scripts/kconfig/ -type f -name linux_*.pot` \
  31. --output scripts/kconfig/linux_raw.pot
  32. $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
  33. --output scripts/kconfig/linux.pot
  34. $(Q)rm -f arch/um/Kconfig_arch
  35. $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/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. # ===========================================================================
  68. # Shared Makefile for the various kconfig executables:
  69. # conf: Used for defconfig, oldconfig and related targets
  70. # mconf: Used for the mconfig target.
  71. # Utilizes the lxdialog package
  72. # qconf: Used for the xconfig target
  73. # Based on QT which needs to be installed to compile it
  74. # gconf: Used for the gconfig target
  75. # Based on GTK which needs to be installed to compile it
  76. # object files used by all kconfig flavours
  77. hostprogs-y := conf mconf qconf gconf kxgettext
  78. conf-objs := conf.o zconf.tab.o
  79. mconf-objs := mconf.o zconf.tab.o
  80. kxgettext-objs := kxgettext.o zconf.tab.o
  81. ifeq ($(MAKECMDGOALS),xconfig)
  82. qconf-target := 1
  83. endif
  84. ifeq ($(MAKECMDGOALS),gconfig)
  85. gconf-target := 1
  86. endif
  87. ifeq ($(qconf-target),1)
  88. qconf-cxxobjs := qconf.o
  89. qconf-objs := kconfig_load.o zconf.tab.o
  90. endif
  91. ifeq ($(gconf-target),1)
  92. gconf-objs := gconf.o kconfig_load.o zconf.tab.o
  93. endif
  94. clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
  95. .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
  96. subdir- += lxdialog
  97. # Needed for systems without gettext
  98. KBUILD_HAVE_NLS := $(shell \
  99. if echo "\#include <libintl.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \
  100. then echo yes ; \
  101. else echo no ; fi)
  102. ifeq ($(KBUILD_HAVE_NLS),no)
  103. HOSTCFLAGS += -DKBUILD_NO_NLS
  104. endif
  105. # generated files seem to need this to find local include files
  106. HOSTCFLAGS_lex.zconf.o := -I$(src)
  107. HOSTCFLAGS_zconf.tab.o := -I$(src)
  108. HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
  109. HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
  110. HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
  111. HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
  112. -D LKC_DIRECT_LINK
  113. $(obj)/qconf.o: $(obj)/.tmp_qtcheck
  114. ifeq ($(qconf-target),1)
  115. $(obj)/.tmp_qtcheck: $(src)/Makefile
  116. -include $(obj)/.tmp_qtcheck
  117. # QT needs some extra effort...
  118. $(obj)/.tmp_qtcheck:
  119. @set -e; echo " CHECK qt"; dir=""; pkg=""; \
  120. pkg-config --exists qt 2> /dev/null && pkg=qt; \
  121. pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
  122. if [ -n "$$pkg" ]; then \
  123. cflags="\$$(shell pkg-config $$pkg --cflags)"; \
  124. libs="\$$(shell pkg-config $$pkg --libs)"; \
  125. moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
  126. dir="$$(pkg-config $$pkg --variable=prefix)"; \
  127. else \
  128. for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
  129. if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
  130. done; \
  131. if [ -z "$$dir" ]; then \
  132. echo "*"; \
  133. echo "* Unable to find the QT installation. Please make sure that"; \
  134. echo "* the QT development package is correctly installed and"; \
  135. echo "* either install pkg-config or set the QTDIR environment"; \
  136. echo "* variable to the correct location."; \
  137. echo "*"; \
  138. false; \
  139. fi; \
  140. libpath=$$dir/lib; lib=qt; osdir=""; \
  141. $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
  142. osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
  143. test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
  144. test -f $$libpath/libqt-mt.so && lib=qt-mt; \
  145. cflags="-I$$dir/include"; \
  146. libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
  147. moc="$$dir/bin/moc"; \
  148. fi; \
  149. if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
  150. echo "*"; \
  151. echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
  152. echo "*"; \
  153. moc="/usr/bin/moc"; \
  154. fi; \
  155. echo "KC_QT_CFLAGS=$$cflags" > $@; \
  156. echo "KC_QT_LIBS=$$libs" >> $@; \
  157. echo "KC_QT_MOC=$$moc" >> $@
  158. endif
  159. $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
  160. ifeq ($(gconf-target),1)
  161. -include $(obj)/.tmp_gtkcheck
  162. # GTK needs some extra effort, too...
  163. $(obj)/.tmp_gtkcheck:
  164. @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
  165. if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
  166. touch $@; \
  167. else \
  168. echo "*"; \
  169. echo "* GTK+ is present but version >= 2.0.0 is required."; \
  170. echo "*"; \
  171. false; \
  172. fi \
  173. else \
  174. echo "*"; \
  175. echo "* Unable to find the GTK+ installation. Please make sure that"; \
  176. echo "* the GTK+ 2.0 development package is correctly installed..."; \
  177. echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
  178. echo "*"; \
  179. false; \
  180. fi
  181. endif
  182. $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
  183. $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
  184. $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
  185. $(obj)/gconf.o: $(obj)/lkc_defs.h
  186. $(obj)/%.moc: $(src)/%.h
  187. $(KC_QT_MOC) -i $< -o $@
  188. $(obj)/lkc_defs.h: $(src)/lkc_proto.h
  189. sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  190. ###
  191. # The following requires flex/bison/gperf
  192. # By default we use the _shipped versions, uncomment the following line if
  193. # you are modifying the flex/bison src.
  194. # LKC_GENPARSER := 1
  195. ifdef LKC_GENPARSER
  196. $(obj)/zconf.tab.c: $(src)/zconf.y
  197. $(obj)/lex.zconf.c: $(src)/zconf.l
  198. $(obj)/zconf.hash.c: $(src)/zconf.gperf
  199. %.tab.c: %.y
  200. bison -l -b $* -p $(notdir $*) $<
  201. cp $@ $@_shipped
  202. lex.%.c: %.l
  203. flex -L -P$(notdir $*) -o$@ $<
  204. cp $@ $@_shipped
  205. %.hash.c: %.gperf
  206. gperf < $< > $@
  207. cp $@ $@_shipped
  208. endif