3
0

Makefile 8.4 KB

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