Makefile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. include ../../build.mak
  2. include ../../version.mak
  3. THIRD_PARTY:=$(PJDIR)/third_party
  4. include $(PJDIR)/build/common.mak
  5. export LIBDIR := ../lib
  6. export BINDIR := ../bin
  7. RULES_MAK := $(PJDIR)/build/rules.mak
  8. PJLIB_LIB:=$(PJDIR)/pjlib/lib/libpj-$(TARGET_NAME)$(LIBEXT)
  9. PJLIB_UTIL_LIB:=$(PJDIR)/pjlib-util/lib/libpjlib-util-$(TARGET_NAME)$(LIBEXT)
  10. PJNATH_LIB:=$(PJDIR)/pjnath/lib/libpjnath-$(TARGET_NAME)$(LIBEXT)
  11. export PJMEDIA_LIB:=libpjmedia-$(TARGET_NAME)$(LIBEXT)
  12. export PJMEDIA_CODEC_LIB:=libpjmedia-codec-$(TARGET_NAME)$(LIBEXT)
  13. export PJSDP_LIB:=libpjsdp-$(TARGET_NAME)$(LIBEXT)
  14. export PJMEDIA_AUDIODEV_LIB:=libpjmedia-audiodev-$(TARGET_NAME)$(LIBEXT)
  15. export PJMEDIA_VIDEODEV_LIB:=libpjmedia-videodev-$(TARGET_NAME)$(LIBEXT)
  16. ifeq ($(PJ_SHARED_LIBRARIES),)
  17. else
  18. export PJMEDIA_SONAME:=libpjmedia.$(SHLIB_SUFFIX)
  19. export PJMEDIA_SHLIB:=$(PJMEDIA_SONAME).$(PJ_VERSION_MAJOR)
  20. export PJMEDIA_CODEC_SONAME:=libpjmedia-codec.$(SHLIB_SUFFIX)
  21. export PJMEDIA_CODEC_SHLIB:=$(PJMEDIA_CODEC_SONAME).$(PJ_VERSION_MAJOR)
  22. export PJSDP_SONAME:=libpjsdp.$(SHLIB_SUFFIX)
  23. export PJSDP_SHLIB:=$(PJSDP_SONAME).$(PJ_VERSION_MAJOR)
  24. export PJMEDIA_AUDIODEV_SONAME:=libpjmedia-audiodev.$(SHLIB_SUFFIX)
  25. export PJMEDIA_AUDIODEV_SHLIB:=$(PJMEDIA_AUDIODEV_SONAME).$(PJ_VERSION_MAJOR)
  26. export PJMEDIA_VIDEODEV_SONAME:=libpjmedia-videodev.$(SHLIB_SUFFIX)
  27. export PJMEDIA_VIDEODEV_SHLIB:=$(PJMEDIA_VIDEODEV_SONAME).$(PJ_VERSION_MAJOR)
  28. endif
  29. ###############################################################################
  30. # Gather all flags.
  31. #
  32. export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
  33. $(CFLAGS) $(CC_INC)../include \
  34. $(CC_INC)../../pjlib/include \
  35. $(CC_INC)../../pjlib-util/include \
  36. $(CC_INC)../../pjmedia/include \
  37. $(CC_INC)../../pjnath/include \
  38. $(CC_INC)../..
  39. export _CXXFLAGS:= $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
  40. $(HOST_CXXFLAGS) $(CXXFLAGS) $(_CFLAGS)
  41. export _LDFLAGS := $(APP_THIRD_PARTY_LIBS) \
  42. $(APP_THIRD_PARTY_EXT) \
  43. $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
  44. $(APP_LDFLAGS) $(LDFLAGS)
  45. ###############################################################################
  46. # Defines for building PJMEDIA library
  47. #
  48. export PJMEDIA_SRCDIR = ../src/pjmedia
  49. export PJMEDIA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
  50. alaw_ulaw.o alaw_ulaw_table.o avi_player.o \
  51. bidirectional.o clock_thread.o codec.o conference.o \
  52. conf_switch.o converter.o converter_libswscale.o converter_libyuv.o \
  53. delaybuf.o echo_common.o \
  54. echo_port.o echo_suppress.o echo_webrtc.o echo_webrtc_aec3.o \
  55. endpoint.o errno.o event.o format.o ffmpeg_util.o \
  56. g711.o jbuf.o master_port.o mem_capture.o mem_player.o \
  57. null_port.o plc_common.o port.o splitcomb.o \
  58. resample_resample.o resample_libsamplerate.o resample_speex.o \
  59. resample_port.o rtcp.o rtcp_xr.o rtcp_fb.o rtp.o \
  60. sdp.o sdp_cmp.o sdp_neg.o session.o silencedet.o \
  61. sound_legacy.o sound_port.o stereo_port.o stream_common.o \
  62. stream.o stream_info.o tonegen.o transport_adapter_sample.o \
  63. transport_ice.o transport_loop.o transport_srtp.o transport_udp.o \
  64. types.o vid_codec.o vid_codec_util.o \
  65. vid_port.o vid_stream.o vid_stream_info.o vid_conf.o \
  66. wav_player.o wav_playlist.o wav_writer.o wave.o \
  67. wsola.o audiodev.o videodev.o
  68. export PJMEDIA_CFLAGS += $(_CFLAGS)
  69. export PJMEDIA_CXXFLAGS += $(_CXXFLAGS)
  70. export PJMEDIA_LDFLAGS += $(PJLIB_LDLIB) \
  71. $(PJLIB_UTIL_LDLIB) \
  72. $(PJNATH_LDLIB) \
  73. $(_LDFLAGS)
  74. ###############################################################################
  75. # Defines for building PJMEDIA-AUDIODEV library
  76. #
  77. export PJMEDIA_AUDIODEV_SRCDIR = ../src/pjmedia-audiodev
  78. export PJMEDIA_AUDIODEV_OBJS += audiodev.o audiotest.o errno.o \
  79. legacy_dev.o null_dev.o pa_dev.o wmme_dev.o \
  80. alsa_dev.o bb10_dev.o bdimad_dev.o \
  81. android_jni_dev.o opensl_dev.o oboe_dev.o
  82. export PJMEDIA_AUDIODEV_CFLAGS += $(_CFLAGS)
  83. export PJMEDIA_AUDIODEV_CXXFLAGS += $(_CXXFLAGS)
  84. export PJMEDIA_AUDIODEV_LDFLAGS += $(PJMEDIA_LDLIB) \
  85. $(PJLIB_LDLIB) \
  86. $(_LDFLAGS)
  87. ###############################################################################
  88. # Defines for building PJMEDIA-VIDEODEV library
  89. #
  90. export PJMEDIA_VIDEODEV_SRCDIR = ../src/pjmedia-videodev
  91. export PJMEDIA_VIDEODEV_OBJS += videodev.o errno.o avi_dev.o ffmpeg_dev.o \
  92. colorbar_dev.o v4l2_dev.o opengl_dev.o \
  93. util.o
  94. export PJMEDIA_VIDEODEV_CFLAGS += $(_CFLAGS)
  95. export PJMEDIA_VIDEODEV_CXXFLAGS += $(_CXXFLAGS)
  96. export PJMEDIA_VIDEODEV_LDFLAGS += $(PJMEDIA_LDLIB) \
  97. $(PJLIB_LDLIB) \
  98. $(_LDFLAGS)
  99. ###############################################################################
  100. # Defines for building PJSDP library
  101. # Note that SDP functionality is already INCLUDED in PJMEDIA.
  102. # The PJSDP library should only be used for applications that want SDP
  103. # but don't want to use the rest of the media framework.
  104. #
  105. export PJSDP_SRCDIR = ../src/pjmedia
  106. export PJSDP_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
  107. errno.o sdp.o sdp_cmp.o sdp_neg.o
  108. export PJSDP_CFLAGS += $(_CFLAGS)
  109. export PJSDP_CXXFLAGS += $(_CXXFLAGS)
  110. export PJSDP_LDFLAGS += $(PJMEDIA_LDLIB) \
  111. $(PJLIB_LDLIB) \
  112. $(PJLIB_UTIL_LDLIB) \
  113. $(_LDFLAGS)
  114. ###############################################################################
  115. # Defines for building PJMEDIA-Codec library
  116. #
  117. export PJMEDIA_CODEC_SRCDIR = ../src/pjmedia-codec
  118. export PJMEDIA_CODEC_OBJS += audio_codecs.o ffmpeg_vid_codecs.o openh264.o \
  119. h263_packetizer.o h264_packetizer.o vpx_packetizer.o \
  120. $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
  121. ipp_codecs.o silk.o opus.o $(CODEC_OBJS) \
  122. g7221_sdp_match.o amr_sdp_match.o passthrough.o \
  123. vpx.o
  124. export PJMEDIA_CODEC_CFLAGS += $(_CFLAGS) $(GSM_CFLAGS) $(SPEEX_CFLAGS) \
  125. $(ILBC_CFLAGS) $(IPP_CFLAGS) $(G7221_CFLAGS)
  126. export PJMEDIA_CODEC_CXXFLAGS += $(_CXXFLAGS) $(GSM_CFLAGS) $(SPEEX_CFLAGS) \
  127. $(ILBC_CFLAGS) $(IPP_CFLAGS) $(G7221_CFLAGS)
  128. export PJMEDIA_CODEC_LDFLAGS += $(PJMEDIA_LDLIB) \
  129. $(PJLIB_LDLIB) \
  130. $(_LDFLAGS)
  131. ###############################################################################
  132. # Defines for building test application
  133. #
  134. export PJMEDIA_TEST_SRCDIR = ../src/test
  135. export PJMEDIA_TEST_OBJS += codec_vectors.o jbuf_test.o main.o mips_test.o \
  136. vid_codec_test.o vid_dev_test.o vid_port_test.o \
  137. rtp_test.o test.o
  138. export PJMEDIA_TEST_OBJS += sdp_neg_test.o
  139. export PJMEDIA_TEST_CFLAGS += $(_CFLAGS)
  140. export PJMEDIA_TEST_CXXFLAGS += $(_CXXFLAGS)
  141. export PJMEDIA_TEST_LDFLAGS += $(PJMEDIA_CODEC_LDLIB) \
  142. $(PJMEDIA_VIDEODEV_LDLIB) \
  143. $(PJMEDIA_AUDIODEV_LDLIB) \
  144. $(PJMEDIA_LDLIB) \
  145. $(PJNATH_LDLIB) \
  146. $(PJLIB_UTIL_LDLIB) \
  147. $(PJLIB_LDLIB) \
  148. $(_LDFLAGS)
  149. ifeq ($(EXCLUDE_APP),0)
  150. export PJMEDIA_TEST_EXE:=pjmedia-test-$(TARGET_NAME)$(HOST_EXE)
  151. endif
  152. export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
  153. ###############################################################################
  154. # Main entry
  155. #
  156. # $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
  157. #
  158. TARGETS := $(PJMEDIA_LIB) $(PJMEDIA_SONAME) \
  159. $(PJMEDIA_CODEC_LIB) $(PJMEDIA_CODEC_SONAME)\
  160. $(PJMEDIA_VIDEODEV_LIB) $(PJMEDIA_VIDEODEV_SONAME) \
  161. $(PJMEDIA_AUDIODEV_LIB) $(PJMEDIA_AUDIODEV_SONAME) \
  162. $(PJSDP_LIB) $(PJSDP_SONAME)
  163. TARGETS_EXE := $(PJMEDIA_TEST_EXE)
  164. all: $(TARGETS) $(TARGETS_EXE)
  165. lib: $(TARGETS)
  166. doc:
  167. cd .. && rm -rf docs/$(PJ_VERSION) && doxygen docs/doxygen.cfg
  168. @if [ -n "$(WWWDIR)" ] && ! [ -d "$(WWWDIR)/docs/$(PJ_VERSION)/pjmedia/docs/html" ] ; then \
  169. echo "Creating docs/$(PJ_VERSION)/pjmedia/docs/html" ; \
  170. mkdir -p $(WWWDIR)/docs/$(PJ_VERSION)/pjmedia/docs/html ; \
  171. fi
  172. @if [ -n "$(WWWDIR)" ] && [ -d "$(WWWDIR)/docs/$(PJ_VERSION)/pjmedia/docs/html" ] ; then \
  173. echo "Copying docs/$(PJ_VERSION) to $(WWWDIR)/docs/$(PJ_VERSION)/pjmedia/docs/html.." ; \
  174. cp -v -a ../docs/$(PJ_VERSION)/html/* $(WWWDIR)/docs/$(PJ_VERSION)/pjmedia/docs/html/ ; \
  175. fi
  176. dep: depend
  177. distclean: realclean
  178. .PHONY: all dep depend clean realclean distclean
  179. .PHONY: $(TARGETS)
  180. .PHONY: $(PJMEDIA_LIB) $(PJMEDIA_SONAME)
  181. .PHONY: $(PJMEDIA_CODEC_LIB) $(PJMEDIA_CODEC_SONAME)
  182. .PHONY: $(PJMEDIA_VIDEODEV_LIB) $(PJMEDIA_VIDEODEV_SONAME)
  183. .PHONY: $(PJMEDIA_AUDIODEV_LIB) $(PJMEDIA_AUDIODEV_SONAME)
  184. .PHONY: $(PJSDP_LIB) $(PJSDP_SONAME)
  185. .PHONY: $(PJMEDIA_TEST_EXE)
  186. pjmedia: $(PJMEDIA_LIB)
  187. $(PJMEDIA_SONAME): $(PJMEDIA_LIB)
  188. $(PJMEDIA_LIB) $(PJMEDIA_SONAME):
  189. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
  190. pjmedia-codec: $(PJMEDIA_CODEC_LIB)
  191. $(PJMEDIA_CODEC_SONAME): $(PJMEDIA_CODEC_LIB)
  192. $(PJMEDIA_CODEC_LIB) $(PJMEDIA_CODEC_SONAME): $(PJMEDIA_LIB) $(PJMEDIA_SONAME)
  193. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
  194. pjmedia-videodev: $(PJMEDIA_VIDEODEV_LIB)
  195. $(PJMEDIA_VIDEODEV_SONAME): $(PJMEDIA_VIDEODEV_LIB)
  196. $(PJMEDIA_VIDEODEV_LIB) $(PJMEDIA_VIDEODEV_SONAME): $(PJMEDIA_LIB) $(PJMEDIA_SONAME)
  197. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_VIDEODEV app=pjmedia-videodev $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
  198. pjmedia-audiodev: $(PJMEDIA_AUDIODEV_LIB)
  199. $(PJMEDIA_AUDIODEV_SONAME): $(PJMEDIA_AUDIODEV_LIB)
  200. $(PJMEDIA_AUDIODEV_LIB) $(PJMEDIA_AUDIODEV_SONAME): $(PJMEDIA_LIB) $(PJMEDIA_SONAME)
  201. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_AUDIODEV app=pjmedia-audiodev $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
  202. pjsdp: $(PJSDP_LIB)
  203. $(PJSDP_SONAME): $(PJSDP_LIB)
  204. $(PJSDP_LIB) $(PJSDP_SONAME): $(PJMEDIA_LIB) $(PJMEDIA_SONAME)
  205. $(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $(LIBDIR)/$@
  206. pjmedia-test: $(PJMEDIA_TEST_EXE)
  207. $(PJMEDIA_TEST_EXE): $(PJMEDIA_LIB) $(PJMEDIA_SONAME)
  208. $(PJMEDIA_TEST_EXE): $(PJMEDIA_AUDIODEV_LIB) $(PJMEDIA_AUDIODEV_SONAME)
  209. $(PJMEDIA_TEST_EXE): $(PJMEDIA_VIDEODEV_LIB) $(PJMEDIA_VIDEODEV_SONAME)
  210. $(PJMEDIA_TEST_EXE): $(PJMEDIA_CODEC_LIB) $(PJMEDIA_CODEC_SONAME)
  211. $(PJMEDIA_TEST_EXE):
  212. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $(BINDIR)/$@
  213. .PHONY: pjmedia.ko
  214. pjmedia.ko:
  215. echo Making $@
  216. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $(LIBDIR)/$@
  217. .PHONY: pjmedia-codec.ko
  218. pjmedia-codec.ko:
  219. echo Making $@
  220. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $(LIBDIR)/$@
  221. .PHONY: pjmedia-test.ko
  222. pjmedia-test.ko:
  223. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $(LIBDIR)/$@
  224. clean:
  225. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@
  226. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@
  227. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_VIDEODEV app=pjmedia-videodev $@
  228. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_AUDIODEV app=pjmedia-audiodev $@
  229. $(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $@
  230. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@
  231. realclean:
  232. $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-$(TARGET_NAME).depend),$(HOST_RMR))
  233. $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-videodev-$(TARGET_NAME).depend),$(HOST_RMR))
  234. $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-audiodev-$(TARGET_NAME).depend),$(HOST_RMR))
  235. $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-codec-$(TARGET_NAME).depend),$(HOST_RMR))
  236. $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-test-$(TARGET_NAME).depend),$(HOST_RMR))
  237. $(subst @@,$(subst /,$(HOST_PSEP),.pjsdp-$(TARGET_NAME).depend),$(HOST_RMR))
  238. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@
  239. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_VIDEODEV app=pjmedia-videodev $@
  240. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_AUDIODEV app=pjmedia-audiodev $@
  241. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@
  242. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@
  243. $(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $@
  244. depend:
  245. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@
  246. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_VIDEODEV app=pjmedia-videodev $@
  247. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_AUDIODEV app=pjmedia-audiodev $@
  248. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@
  249. $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@
  250. $(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $@
  251. echo '$(BINDIR)/$(PJMEDIA_TEST_EXE): $(LIBDIR)/$(PJMEDIA_LIB) $(LIBDIR)/$(PJMEDIA_CODEC_LIB) $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjmedia-test-$(TARGET_NAME).depend