Makefile 6.1 KB

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