Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. include ../../build.mak
  2. include $(PJDIR)/build/common.mak
  3. export LIBDIR := ../lib
  4. export BINDIR := ../bin
  5. RULES_MAK := $(PJDIR)/build/rules.mak
  6. ###############################################################################
  7. # Gather all flags.
  8. #
  9. export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
  10. $(PJ_CFLAGS) $(CFLAGS) $(CC_INC)../../pjsip/include \
  11. $(CC_INC)../../pjlib/include \
  12. $(CC_INC)../../pjlib-util/include \
  13. $(CC_INC)../../pjnath/include \
  14. $(CC_INC)../../pjmedia/include
  15. export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
  16. $(HOST_CXXFLAGS) $(CXXFLAGS)
  17. export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
  18. $(APP_LDFLAGS) $(APP_LDLIBS) $(LDFLAGS)
  19. ###############################################################################
  20. # Defines for building PJSUA
  21. #
  22. export PJSUA_SRCDIR = ../src/pjsua
  23. export PJSUA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
  24. main.o pjsua_app.o pjsua_app_cli.o pjsua_app_common.o \
  25. pjsua_app_config.o pjsua_app_legacy.o
  26. export PJSUA_CFLAGS += $(PJ_CFLAGS) $(CFLAGS)
  27. export PJSUA_CXXFLAGS += $(PJ_CXXFLAGS) $(CFLAGS)
  28. export PJSUA_LDFLAGS += $(PJ_LDFLAGS) $(PJ_LDLIBS) $(LDFLAGS)
  29. ifeq ($(EXCLUDE_APP),0)
  30. export PJSUA_EXE:=pjsua-$(TARGET_NAME)$(HOST_EXE)
  31. endif
  32. ###############################################################################
  33. # Defines for building pjsystest
  34. #
  35. export PJSYSTEST_SRCDIR = ../src/pjsystest
  36. export PJSYSTEST_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
  37. systest.o main_console.o
  38. export PJSYSTEST_CFLAGS += $(PJ_CFLAGS) $(CFLAGS)
  39. export PJSYSTEST_CXXFLAGS += $(PJ_CXXFLAGS) $(CFLAGS)
  40. export PJSYSTEST_LDFLAGS += $(PJ_LDFLAGS) $(PJ_LDLIBS) $(LDFLAGS)
  41. ifeq ($(EXCLUDE_APP),0)
  42. export PJSYSTEST_EXE:=pjsystest-$(TARGET_NAME)$(HOST_EXE)
  43. endif
  44. export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
  45. TARGETS := $(PJSUA_EXE) $(PJSYSTEST_EXE) samples
  46. all: $(TARGETS)
  47. swig:
  48. $(MAKE) -C ../src/swig
  49. doc:
  50. dep: depend
  51. distclean: realclean
  52. .PHONY: all dep depend clean realclean distclean
  53. .PHONY: $(TARGETS)
  54. .PHONY: $(PJSUA_EXE) $(PJSYSTEST_EXE)
  55. pjsua: $(PJSUA_EXE)
  56. $(PJSUA_EXE):
  57. $(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(subst /,$(HOST_PSEP),$(BINDIR)/$@)
  58. @if echo "$(TARGET_NAME)" | grep -q "apple-darwin_ios$$"; then \
  59. mkdir ../src/pjsua/ios-swift/Libraries ; \
  60. mkdir ../src/pjsua2/ios-swift-pjsua2/Libraries ; \
  61. for F in $(filter %$(TARGET_NAME).a,$(PJ_LIBXX_FILES)); do \
  62. if test -f $$F; then \
  63. tmp=`echo $${F##*/} | sed -e "s/\-$(TARGET_NAME)\.a/.a/"`; \
  64. ln -sf $$F ../src/pjsua/ios/$$tmp; \
  65. ln -sf $$F ../src/pjsua/ios-swift/Libraries/$$tmp; \
  66. ln -sf $$F ../src/pjsua2/ios-swift-pjsua2/Libraries/$$tmp; \
  67. fi; \
  68. done; \
  69. fi;
  70. pjsystest: $(PJSYSTEST_EXE)
  71. $(PJSYSTEST_EXE):
  72. $(MAKE) -f $(RULES_MAK) APP=PJSYSTEST app=pjsystest $(subst /,$(HOST_PSEP),$(BINDIR)/$@)
  73. samples:
  74. $(MAKE) -f Samples.mak
  75. .PHONY: pjsua.ko
  76. pjsua.ko:
  77. $(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
  78. clean depend realclean:
  79. $(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $@
  80. $(MAKE) -f $(RULES_MAK) APP=PJSYSTEST app=pjsystest $@
  81. $(MAKE) -f Samples.mak $@
  82. @if test "$@" = "depend"; then \
  83. echo '$(BINDIR)/$(PJSUA_EXE): $(APP_LIB_FILES)' >> .pjsua-$(TARGET_NAME).depend; \
  84. echo '$(BINDIR)/$(PJSYSTEST_EXE): $(APP_LIB_FILES)' >> .pjsystest-$(TARGET_NAME).depend; \
  85. fi
  86. @if echo "$(TARGET_NAME)" | grep -q "apple-darwin_ios$$"; then \
  87. for F in $(filter %$(TARGET_NAME).a,$(PJ_LIBXX_FILES)); do \
  88. tmp=`echo $${F##*/} | sed -e "s/\-$(TARGET_NAME)\.a/.a/"`; \
  89. rm -f ../src/pjsua/ios/$$tmp; \
  90. rm -f ../src/pjsua/ios-swift/Libraries/$$tmp; \
  91. done; \
  92. fi;