Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # ===========================================================================
  2. # libreCMC configuration targets
  3. # These targets are used from top-level makefile
  4. # ===========================================================================
  5. # Shared Makefile for the various kconfig executables:
  6. # conf: Used for defconfig, oldconfig and related targets
  7. # mconf: Used for the mconfig target.
  8. # Utilizes the lxdialog package
  9. # qconf: Used for the xconfig target
  10. # Based on Qt which needs to be installed to compile it
  11. # object files used by all kconfig flavours
  12. # Platform specific fixes
  13. #
  14. # FreeBSD
  15. check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1))
  16. export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags)
  17. export CXXFLAGS += -DKBUILD_NO_NLS
  18. conf-objs := conf.o zconf.tab.o
  19. mconf-objs := mconf.o zconf.tab.o
  20. qconf-cxxobjs := qconf.o
  21. qconf-objs := zconf.tab.o
  22. lxdialog-objs := \
  23. lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \
  24. lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
  25. clean-files := zconf.tab.c zconf.lex.c zconf.hash.c
  26. # Remove qconf junk files
  27. clean-files += $(qconf-cxxobjs) qconf.moc .tmp_qtcheck qconf
  28. all: conf mconf
  29. conf: $(conf-objs)
  30. mconf: $(mconf-objs) $(lxdialog-objs)
  31. $(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC))
  32. qconf: $(qconf-cxxobjs) $(qconf-objs)
  33. ifneq ($(DISTRO-PKG-CONFIG),)
  34. $(CXX) -o $@ $^ $(HOSTLOADLIBES_qconf)
  35. else
  36. echo "You don't have 'pkg-config' installed. Cannot continue"
  37. echo "For now, you may use 'make menuconfig' instead of 'make xconfig'"
  38. endif
  39. clean:
  40. rm -f *.o lxdialog/*.o $(clean-files) conf mconf
  41. zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c
  42. kconfig_load.o: lkc_defs.h
  43. zconf.tab.c: zconf.y $(wildcard zconf.tab.c_shipped)
  44. zconf.lex.c: zconf.l $(wildcard zconf.lex.c_shipped)
  45. zconf.hash.c: zconf.gperf $(wildcard zconf.hash.c_shipped)
  46. %.tab.c: %.y
  47. cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<
  48. %.lex.c: %.l
  49. cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $<
  50. %.hash.c: %.gperf
  51. cp $@_shipped $@ || gperf < $< > $@
  52. ifeq ($(MAKECMDGOALS),qconf)
  53. qconf.o: .tmp_qtcheck
  54. .tmp_qtcheck: Makefile
  55. -include .tmp_qtcheck
  56. # Qt needs some extra effort...
  57. .tmp_qtcheck:
  58. @set -e; echo " CHECK qt"; \
  59. if $(DISTRO-PKG-CONFIG) --exists Qt5Core; then \
  60. cflags="-std=c++11 -fPIC `$(DISTRO-PKG-CONFIG) --cflags Qt5Core Qt5Gui Qt5Widgets`"; \
  61. libs=`$(DISTRO-PKG-CONFIG) --libs Qt5Core Qt5Gui Qt5Widgets`; \
  62. moc=`$(DISTRO-PKG-CONFIG) --variable=host_bins Qt5Core`/moc; \
  63. elif $(DISTRO-PKG-CONFIG) --exists QtCore; then \
  64. cflags=`$(DISTRO-PKG-CONFIG) --cflags QtCore QtGui`; \
  65. libs=`$(DISTRO-PKG-CONFIG) --libs QtCore QtGui`; \
  66. moc=`$(DISTRO-PKG-CONFIG) --variable=moc_location QtCore`; \
  67. else \
  68. echo >&2 "*"; \
  69. echo >&2 "* Could not find Qt via $(DISTRO-PKG-CONFIG)."; \
  70. echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \
  71. echo >&2 "*"; \
  72. exit 1; \
  73. fi; \
  74. echo "KC_QT_CFLAGS=$$cflags" > $@; \
  75. echo "KC_QT_LIBS=$$libs" >> $@; \
  76. echo "KC_QT_MOC=$$moc" >> $@
  77. endif
  78. #Define compiler flags to build qconf
  79. HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
  80. HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
  81. qconf.o: qconf.moc
  82. qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o)
  83. moc = $(KC_QT_MOC) -i $< -o $@
  84. %.moc: %.h .tmp_qtcheck
  85. $(call moc)