Makefile 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. # Add environment specific flags
  97. HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
  98. # generated files seem to need this to find local include files
  99. HOSTCFLAGS_lex.zconf.o := -I$(src)
  100. HOSTCFLAGS_zconf.tab.o := -I$(src)
  101. HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
  102. HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
  103. HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
  104. HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
  105. -D LKC_DIRECT_LINK
  106. $(obj)/qconf.o: $(obj)/.tmp_qtcheck
  107. ifeq ($(qconf-target),1)
  108. $(obj)/.tmp_qtcheck: $(src)/Makefile
  109. -include $(obj)/.tmp_qtcheck
  110. # QT needs some extra effort...
  111. $(obj)/.tmp_qtcheck:
  112. @set -e; echo " CHECK qt"; dir=""; pkg=""; \
  113. pkg-config --exists qt 2> /dev/null && pkg=qt; \
  114. pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
  115. if [ -n "$$pkg" ]; then \
  116. cflags="\$$(shell pkg-config $$pkg --cflags)"; \
  117. libs="\$$(shell pkg-config $$pkg --libs)"; \
  118. moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
  119. dir="$$(pkg-config $$pkg --variable=prefix)"; \
  120. else \
  121. for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
  122. if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
  123. done; \
  124. if [ -z "$$dir" ]; then \
  125. echo "*"; \
  126. echo "* Unable to find the QT installation. Please make sure that"; \
  127. echo "* the QT development package is correctly installed and"; \
  128. echo "* either install pkg-config or set the QTDIR environment"; \
  129. echo "* variable to the correct location."; \
  130. echo "*"; \
  131. false; \
  132. fi; \
  133. libpath=$$dir/lib; lib=qt; osdir=""; \
  134. $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
  135. osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
  136. test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
  137. test -f $$libpath/libqt-mt.so && lib=qt-mt; \
  138. cflags="-I$$dir/include"; \
  139. libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
  140. moc="$$dir/bin/moc"; \
  141. fi; \
  142. if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
  143. echo "*"; \
  144. echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
  145. echo "*"; \
  146. moc="/usr/bin/moc"; \
  147. fi; \
  148. echo "KC_QT_CFLAGS=$$cflags" > $@; \
  149. echo "KC_QT_LIBS=$$libs" >> $@; \
  150. echo "KC_QT_MOC=$$moc" >> $@
  151. endif
  152. $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
  153. ifeq ($(gconf-target),1)
  154. -include $(obj)/.tmp_gtkcheck
  155. # GTK needs some extra effort, too...
  156. $(obj)/.tmp_gtkcheck:
  157. @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
  158. if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
  159. touch $@; \
  160. else \
  161. echo "*"; \
  162. echo "* GTK+ is present but version >= 2.0.0 is required."; \
  163. echo "*"; \
  164. false; \
  165. fi \
  166. else \
  167. echo "*"; \
  168. echo "* Unable to find the GTK+ installation. Please make sure that"; \
  169. echo "* the GTK+ 2.0 development package is correctly installed..."; \
  170. echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
  171. echo "*"; \
  172. false; \
  173. fi
  174. endif
  175. $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
  176. $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
  177. $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
  178. $(obj)/gconf.o: $(obj)/lkc_defs.h
  179. $(obj)/%.moc: $(src)/%.h
  180. $(KC_QT_MOC) -i $< -o $@
  181. $(obj)/lkc_defs.h: $(src)/lkc_proto.h
  182. sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  183. ###
  184. # The following requires flex/bison/gperf
  185. # By default we use the _shipped versions, uncomment the following line if
  186. # you are modifying the flex/bison src.
  187. # LKC_GENPARSER := 1
  188. ifdef LKC_GENPARSER
  189. $(obj)/zconf.tab.c: $(src)/zconf.y
  190. $(obj)/lex.zconf.c: $(src)/zconf.l
  191. $(obj)/zconf.hash.c: $(src)/zconf.gperf
  192. %.tab.c: %.y
  193. bison -l -b $* -p $(notdir $*) $<
  194. cp $@ $@_shipped
  195. lex.%.c: %.l
  196. flex -L -P$(notdir $*) -o$@ $<
  197. cp $@ $@_shipped
  198. %.hash.c: %.gperf
  199. gperf < $< > $@
  200. cp $@ $@_shipped
  201. endif