Makefile 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. -o scripts/kconfig/linux.pot
  23. scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot
  24. .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
  25. randconfig: $(obj)/conf
  26. $< -r arch/$(ARCH)/Kconfig
  27. allyesconfig: $(obj)/conf
  28. $< -y arch/$(ARCH)/Kconfig
  29. allnoconfig: $(obj)/conf
  30. $< -n arch/$(ARCH)/Kconfig
  31. allmodconfig: $(obj)/conf
  32. $< -m arch/$(ARCH)/Kconfig
  33. defconfig: $(obj)/conf
  34. ifeq ($(KBUILD_DEFCONFIG),)
  35. $< -d arch/$(ARCH)/Kconfig
  36. else
  37. @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
  38. $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig
  39. endif
  40. %_defconfig: $(obj)/conf
  41. $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
  42. # Help text used by make help
  43. help:
  44. @echo ' config - Update current config utilising a line-oriented program'
  45. @echo ' menuconfig - Update current config utilising a menu based program'
  46. @echo ' xconfig - Update current config utilising a QT based front-end'
  47. @echo ' gconfig - Update current config utilising a GTK based front-end'
  48. @echo ' oldconfig - Update current config utilising a provided .config as base'
  49. @echo ' randconfig - New config with random answer to all options'
  50. @echo ' defconfig - New config with default answer to all options'
  51. @echo ' allmodconfig - New config selecting modules when possible'
  52. @echo ' allyesconfig - New config where all options are accepted with yes'
  53. @echo ' allnoconfig - New minimal config'
  54. # ===========================================================================
  55. # Shared Makefile for the various kconfig executables:
  56. # conf: Used for defconfig, oldconfig and related targets
  57. # mconf: Used for the mconfig target.
  58. # Utilizes the lxdialog package
  59. # qconf: Used for the xconfig target
  60. # Based on QT which needs to be installed to compile it
  61. # gconf: Used for the gconfig target
  62. # Based on GTK which needs to be installed to compile it
  63. # object files used by all kconfig flavours
  64. hostprogs-y := conf mconf qconf gconf kxgettext
  65. conf-objs := conf.o zconf.tab.o
  66. mconf-objs := mconf.o zconf.tab.o
  67. kxgettext-objs := kxgettext.o zconf.tab.o
  68. ifeq ($(MAKECMDGOALS),xconfig)
  69. qconf-target := 1
  70. endif
  71. ifeq ($(MAKECMDGOALS),gconfig)
  72. gconf-target := 1
  73. endif
  74. ifeq ($(qconf-target),1)
  75. qconf-cxxobjs := qconf.o
  76. qconf-objs := kconfig_load.o zconf.tab.o
  77. endif
  78. ifeq ($(gconf-target),1)
  79. gconf-objs := gconf.o kconfig_load.o zconf.tab.o
  80. endif
  81. clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
  82. .tmp_gtkcheck zconf.tab.c zconf.tab.h lex.zconf.c
  83. # generated files seem to need this to find local include files
  84. HOSTCFLAGS_lex.zconf.o := -I$(src)
  85. HOSTCFLAGS_zconf.tab.o := -I$(src)
  86. HOSTLOADLIBES_qconf = -L$(QTLIBPATH) -Wl,-rpath,$(QTLIBPATH) -l$(QTLIB) -ldl
  87. HOSTCXXFLAGS_qconf.o = -I$(QTDIR)/include -D LKC_DIRECT_LINK
  88. HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
  89. HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
  90. -D LKC_DIRECT_LINK
  91. $(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h
  92. $(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped
  93. $(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped
  94. $(obj)/lex.zconf.c: $(src)/lex.zconf.c_shipped
  95. $(obj)/qconf.o: $(obj)/.tmp_qtcheck
  96. ifeq ($(qconf-target),1)
  97. MOC = $(QTDIR)/bin/moc
  98. QTLIBPATH = $(QTDIR)/lib
  99. -include $(obj)/.tmp_qtcheck
  100. # QT needs some extra effort...
  101. $(obj)/.tmp_qtcheck:
  102. @set -e; for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
  103. if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \
  104. done; \
  105. if [ -z "$$DIR" ]; then \
  106. echo "*"; \
  107. echo "* Unable to find the QT installation. Please make sure that the"; \
  108. echo "* QT development package is correctly installed and the QTDIR"; \
  109. echo "* environment variable is set to the correct location."; \
  110. echo "*"; \
  111. false; \
  112. fi; \
  113. LIBPATH=$$DIR/lib; LIB=qt; \
  114. $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
  115. LIBPATH=$$DIR/lib/$$($(HOSTCXX) -print-multi-os-directory); \
  116. if [ -f $$LIBPATH/libqt-mt.so ]; then LIB=qt-mt; fi; \
  117. echo "QTDIR=$$DIR" > $@; echo "QTLIBPATH=$$LIBPATH" >> $@; \
  118. echo "QTLIB=$$LIB" >> $@; \
  119. if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \
  120. echo "*"; \
  121. echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \
  122. echo "*"; \
  123. echo "MOC=/usr/bin/moc" >> $@; \
  124. fi
  125. endif
  126. $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
  127. ifeq ($(gconf-target),1)
  128. -include $(obj)/.tmp_gtkcheck
  129. # GTK needs some extra effort, too...
  130. $(obj)/.tmp_gtkcheck:
  131. @if `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --exists`; then \
  132. if `pkg-config gtk+-2.0 --atleast-version=2.0.0`; then \
  133. touch $@; \
  134. else \
  135. echo "*"; \
  136. echo "* GTK+ is present but version >= 2.0.0 is required."; \
  137. echo "*"; \
  138. false; \
  139. fi \
  140. else \
  141. echo "*"; \
  142. echo "* Unable to find the GTK+ installation. Please make sure that"; \
  143. echo "* the GTK+ 2.0 development package is correctly installed..."; \
  144. echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
  145. echo "*"; \
  146. false; \
  147. fi
  148. endif
  149. $(obj)/zconf.tab.o: $(obj)/lex.zconf.c
  150. $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
  151. $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
  152. $(obj)/gconf.o: $(obj)/lkc_defs.h
  153. $(obj)/%.moc: $(src)/%.h
  154. $(MOC) -i $< -o $@
  155. $(obj)/lkc_defs.h: $(src)/lkc_proto.h
  156. sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  157. ###
  158. # The following requires flex/bison
  159. # By default we use the _shipped versions, uncomment the following line if
  160. # you are modifying the flex/bison src.
  161. # LKC_GENPARSER := 1
  162. ifdef LKC_GENPARSER
  163. $(obj)/zconf.tab.c: $(obj)/zconf.y
  164. $(obj)/zconf.tab.h: $(obj)/zconf.tab.c
  165. %.tab.c: %.y
  166. bison -t -d -v -b $* -p $(notdir $*) $<
  167. lex.%.c: %.l
  168. flex -P$(notdir $*) -o$@ $<
  169. endif