Makefile 6.9 KB

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