2
0

Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # ===========================================================================
  2. # OpenWrt 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. $(CXX) -o $@ $^ $(HOSTLOADLIBES_qconf)
  34. clean:
  35. rm -f *.o lxdialog/*.o $(clean-files) conf mconf
  36. zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c
  37. kconfig_load.o: lkc_defs.h
  38. zconf.tab.c: zconf.y $(wildcard zconf.tab.c_shipped)
  39. zconf.lex.c: zconf.l $(wildcard zconf.lex.c_shipped)
  40. zconf.hash.c: zconf.gperf $(wildcard zconf.hash.c_shipped)
  41. %.tab.c: %.y
  42. cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<
  43. %.lex.c: %.l
  44. cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $<
  45. %.hash.c: %.gperf
  46. cp $@_shipped $@ || gperf < $< > $@
  47. ifeq ($(MAKECMDGOALS),qconf)
  48. qconf.o: .tmp_qtcheck
  49. .tmp_qtcheck: Makefile
  50. -include .tmp_qtcheck
  51. # Qt needs some extra effort...
  52. .tmp_qtcheck:
  53. @set -e; echo " CHECK qt"; \
  54. if pkg-config --exists Qt5Core; then \
  55. cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \
  56. libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \
  57. moc=`pkg-config --variable=host_bins Qt5Core`/moc; \
  58. elif pkg-config --exists QtCore; then \
  59. cflags=`pkg-config --cflags QtCore QtGui`; \
  60. libs=`pkg-config --libs QtCore QtGui`; \
  61. moc=`pkg-config --variable=moc_location QtCore`; \
  62. else \
  63. echo >&2 "*"; \
  64. echo >&2 "* Could not find Qt via pkg-config."; \
  65. echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \
  66. echo >&2 "*"; \
  67. exit 1; \
  68. fi; \
  69. echo "KC_QT_CFLAGS=$$cflags" > $@; \
  70. echo "KC_QT_LIBS=$$libs" >> $@; \
  71. echo "KC_QT_MOC=$$moc" >> $@
  72. endif
  73. #Define compiler flags to build qconf
  74. HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
  75. HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
  76. qconf.o: qconf.moc
  77. qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o)
  78. moc = $(KC_QT_MOC) -i $< -o $@
  79. %.moc: %.h .tmp_qtcheck
  80. $(call moc)