Makefile 7.6 KB

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