droid-makefile 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. APP := lib$(PROJECT)_$(MARCH).$(EXT)
  2. THIRDPARTIES_INC := ../thirdparties/android/include
  3. THIRDPARTIES_INC_COMMON := ../thirdparties/common/include
  4. THIRDPARTIES_LIB := ../thirdparties/android/lib
  5. THIRDPARTIES_MARCH_LIB := ../thirdparties/android/lib/$(MARCH)
  6. ##########
  7. # Before starting to set parmeters we will override those provided by the user
  8. #
  9. ifeq ($(LICENSE),lgpl)
  10. H264 := no
  11. endif
  12. ##########
  13. # Set LD and CFLAGS according to the user parameters
  14. #
  15. # FFMPEG (Default: enabled)
  16. ifeq ($(FFMPEG), no)
  17. FFMPEG_CFLAGS := -DHAVE_FFMPEG=0
  18. FFMPEG_LDFLAGS :=
  19. else
  20. FFMPEG_CFLAGS := -DHAVE_FFMPEG=1
  21. FFMPEG_LDFLAGS := -lavutil-$(LICENSE) -lswscale-$(LICENSE) -lavcore-$(LICENSE) -lavcodec-$(LICENSE)
  22. endif
  23. # LibYUV (Default: enabled)
  24. ifeq ($(LIBYUV), no)
  25. LIBYUV_CFLAGS := -DHAVE_LIBYUV=0
  26. LIBYUV_LDFLAGS :=
  27. else
  28. LIBYUV_CFLAGS := -DHAVE_LIBYUV=1 -I$(THIRDPARTIES_INC_COMMON)/libyuv
  29. LIBYUV_LDFLAGS := -lyuv_$(MARCH)
  30. endif
  31. # H264 (Default: enabled)
  32. ifeq ($(H264),no) # TODO: should depend on FFMPEG
  33. FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_H264=0
  34. else
  35. FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_H264=1
  36. FFMPEG_LDFLAGS := $(FFMPEG_LDFLAGS) -lx264
  37. endif
  38. # THEORA (Default: enabled)
  39. ifeq ($(THEORA),no) # TODO: should depend on FFMPEG
  40. FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_THEORA=0
  41. else
  42. FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_THEORA=1
  43. FFMPEG_LDFLAGS := $(FFMPEG_LDFLAGS) -ltheora -logg
  44. endif
  45. # VP8 (Default: disabled because of NEON)
  46. ifeq ($(VPX),yes)
  47. VPX_CFLAGS := -DHAVE_LIBVPX=1
  48. VPX_LDFLAGS := -lvpx_$(MARCH)
  49. else
  50. VPX_CFLAGS := -DHAVE_LIBVPX=0
  51. endif
  52. # OPUS (Default: enabled)
  53. ifeq ($(OPUS), no)
  54. OPUS_CFLAGS := -DHAVE_LIBOPUS=0
  55. else
  56. OPUS_CFLAGS := -DHAVE_LIBOPUS=1
  57. OPUS_LDFLAGS := -lopus
  58. endif
  59. # AMR (Default: enabled)
  60. ifeq ($(OPENCORE_AMR), no)
  61. OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=0
  62. else
  63. OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=1
  64. OPENCORE_AMR_LDFLAGS := -lopencore-amrnb
  65. endif
  66. # SPEEX_DSP (Default: disabled)
  67. ifeq ($(SPEEX_DSP), yes)
  68. SPEEX_DSP_CFLAGS := -DHAVE_SPEEX_DSP=1
  69. SPEEX_DSP_LDFLAGS := -lspeexdsp
  70. # Speex audio resampler (Default: enabled)
  71. ifneq ($(SPEEX_RESAMPLER), no)
  72. SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_RESAMPLER=1
  73. else
  74. SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_RESAMPLER=0
  75. endif
  76. # Speex audio/video jitterbuffer (Default: enabled)
  77. ifneq ($(SPEEX_JB), no)
  78. SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_JB=1
  79. else
  80. SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_JB=0
  81. endif
  82. # Speex audio denoiser (Default: disabled)
  83. ifeq ($(SPEEX_DENOISE), yes)
  84. SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_DENOISE=1
  85. else
  86. SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_DENOISE=0
  87. endif
  88. else
  89. SPEEX_DSP_CFLAGS := -DHAVE_SPEEX_DSP=0
  90. endif
  91. # SPEEX (Default: disabled)
  92. ifeq ($(SPEEX), yes)
  93. SPEEX_CFLAGS := -DHAVE_LIB_SPEEX=1
  94. SPEEX_LDFLAGS := -lspeex
  95. else
  96. SPEEX_CFLAGS := -DHAVE_LIB_SPEEX=0
  97. endif
  98. # Google WebRTC (Default: enabled)
  99. ifeq ($(WEBRTC), yes)
  100. WEBRTC_CFLAGS := -DHAVE_WEBRTC=1
  101. WEBRTC_LDFLAGS := -lwebrtc_aec_$(MARCH) -lwebrtc_spl_$(MARCH) -lwebrtc_apm_utility_$(MARCH) -lwebrtc_nsx_$(MARCH) -lwebrtc_system_wrappers_$(MARCH)
  102. else
  103. WEBRTC_CFLAGS := -DHAVE_WEBRTC=0
  104. endif
  105. ifeq ($(WEBRTC_DENOISE), yes)
  106. WEBRTC_CFLAGS += -DHAVE_WEBRTC_DENOISE=1
  107. endif
  108. # ILBC (Default: disabled)
  109. ifeq ($(ILBC), yes)
  110. ILBC_CFLAGS := -DHAVE_ILBC=1
  111. ILBC_LDFLAGS := -liLBC
  112. else
  113. ILBC_CFLAGS := -DHAVE_ILBC=0
  114. endif
  115. # GSM (Default: enabled)
  116. ifeq ($(LIBGSM),no)
  117. LIBGSM_CFLAGS := -DHAVE_LIBGSM=0
  118. else
  119. LIBGSM_CFLAGS := -DHAVE_LIBGSM=1
  120. LIBGSM_LDFLAGS := -lgsm
  121. endif
  122. # BV16 (Always disabled)
  123. #BV16_CFLAGS := -DHAVE_BV16=0 -I$(THIRDPARTIES_INC)/BroadVoice16/bv16 -I$(THIRDPARTIES_INC)/BroadVoice16/bvcommon
  124. #BV16_LDFLAGS := -lbv16
  125. # G.729 (Default: Disabled)
  126. ifeq ($(G729), yes)
  127. G729_CFLAGS := -DHAVE_G729=1 -DG729_ENABLE_VAD=0 -D__unix__
  128. G729_LDFLAGS := -lg729b_$(MARCH)
  129. # Reset all other ITU CODECS
  130. OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=0
  131. OPENCORE_AMR_LDFLAGS :=
  132. BV16_CFLAGS := -DHAVE_BV16=0
  133. BV16_LDFLAGS :=
  134. else
  135. G729_CFLAGS := -DHAVE_G729=0
  136. G729_LDFLAGS :=
  137. endif
  138. # SRTP (Default: enabled)
  139. ifeq ($(SRTP),no)
  140. LIBSRTP_CFLAGS := -DHAVE_SRTP=0
  141. else
  142. LIBSRTP_CFLAGS := -DHAVE_SRTP=1
  143. LIBSRTP_LDFLAGS := -lsrtp
  144. endif
  145. ################################
  146. CFLAGS := $(CFLAGS_LIB) -I$(THIRDPARTIES_INC) -I$(THIRDPARTIES_INC_COMMON) $(ILBC_CFLAGS) $(LIBGSM_CFLAGS) \
  147. $(FFMPEG_CFLAGS) $(LIBYUV_CFLAGS) $(VPX_CFLAGS) $(SPEEX_CFLAGS) $(SPEEX_DSP_CFLAGS) $(WEBRTC_CFLAGS) $(OPUS_CFLAGS) $(OPENCORE_AMR_CFLAGS) $(BV16_CFLAGS) $(G729_CFLAGS) \
  148. $(LIBSRTP_CFLAGS) \
  149. -I../tinySAK/src -I../tinyNET/src -I../tinyIPSec/src -I../tinySDP/include -I../tinyRTP/include -I../tinyMEDIA/include -I../tinyMSRP/include -I./include \
  150. -DJB_HISTORY_SIZE=500
  151. LDFLAGS := $(LDFLAGS_LIB) -L$(THIRDPARTIES_LIB) -L$(THIRDPARTIES_MARCH_LIB) \
  152. $(FFMPEG_LDFLAGS) $(LIBYUV_LDFLAGS) $(VPX_LDFLAGS) $(SPEEX_LDFLAGS) $(SPEEX_DSP_LDFLAGS) $(WEBRTC_LDFLAGS) $(OPUS_LDFLAGS) $(OPENCORE_AMR_LDFLAGS) $(ILBC_LDFLAGS) $(LIBGSM_LDFLAGS) $(BV16_LDFLAGS) $(G729_LDFLAGS) \
  153. $(LIBSRTP_LDFLAGS) \
  154. -ltinySAK_$(MARCH) -ltinyNET_$(MARCH) -ltinyIPSec_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -lm -lgcc
  155. all: $(APP)
  156. OBJS = \
  157. src/tdav.o \
  158. src/tdav_session_av.o
  159. ### audio
  160. OBJS += src/audio/tdav_consumer_audio.o \
  161. src/audio/tdav_speakup_jitterbuffer.o \
  162. src/audio/tdav_jitterbuffer.o \
  163. src/audio/tdav_producer_audio.o \
  164. src/audio/tdav_session_audio.o \
  165. src/audio/tdav_speex_denoise.o \
  166. src/audio/tdav_speex_jitterbuffer.o \
  167. src/audio/tdav_speex_resampler.o \
  168. src/audio/tdav_webrtc_denoise.o
  169. ### video
  170. OBJS += src/video/tdav_consumer_video.o \
  171. src/video/tdav_converter_video.o \
  172. src/video/tdav_runnable_video.o \
  173. src/video/tdav_session_video.o \
  174. src/video/jb/tdav_video_frame.o \
  175. src/video/jb/tdav_video_jb.o
  176. ### T.140
  177. OBJS += src/t140/tdav_consumer_t140.o \
  178. src/t140/tdav_producer_t140.o \
  179. src/t140/tdav_session_t140.o
  180. ### msrp
  181. OBJS += src/msrp/tdav_consumer_msrp.o \
  182. src/msrp/tdav_producer_msrp.o \
  183. src/msrp/tdav_session_msrp.o
  184. ### codecs (OPUS)
  185. OBJS += src/codecs/opus/tdav_codec_opus.o
  186. ### codecs (AMR)
  187. OBJS += src/codecs/amr/tdav_codec_amr.o
  188. ### codecs (G.711)
  189. OBJS += src/codecs/g711/g711.o \
  190. src/codecs/g711/tdav_codec_g711.o
  191. ### codecs (G.722)
  192. OBJS += src/codecs/g722/g722_decode.o \
  193. src/codecs/g722/g722_encode.o \
  194. src/codecs/g722/tdav_codec_g722.o
  195. ### codecs (G.729)
  196. OBJS += src/codecs/g729/tdav_codec_g729.o
  197. ### codecs (GSM)
  198. OBJS += src/codecs/gsm/tdav_codec_gsm.o
  199. ### codecs (BV16)
  200. OBJS += src/codecs/bv/tdav_codec_bv16.o \
  201. src/codecs/bv/tdav_codec_bv32.o
  202. ### codecs (iLBC)
  203. OBJS += src/codecs/ilbc/tdav_codec_ilbc.o
  204. ### codecs (Speex)
  205. OBJS += src/codecs/speex/tdav_codec_speex.o
  206. ### codecs (DTMF)
  207. OBJS += src/codecs/dtmf/tdav_codec_dtmf.o
  208. ### codecs (FEC)
  209. OBJS += src/codecs/fec/tdav_codec_red.o \
  210. src/codecs/fec/tdav_codec_ulpfec.o
  211. ### codecs (H.261)
  212. OBJS += src/codecs/h261/tdav_codec_h261.o
  213. ### codecs (H.263)
  214. OBJS += src/codecs/h263/tdav_codec_h263.o
  215. ### codecs (H.264)
  216. OBJS += src/codecs/h264/tdav_codec_h264.o \
  217. src/codecs/h264/tdav_codec_h264_rtp.o
  218. ### codecs (Theora)
  219. OBJS += src/codecs/theora/tdav_codec_theora.o
  220. ### codecs (VPX)
  221. OBJS += src/codecs/vpx/tdav_codec_vp8.o
  222. ### codecs (MP4V-ES)
  223. OBJS += src/codecs/mp4ves/tdav_codec_mp4ves.o
  224. ### codecs (MSRP)
  225. OBJS += src/codecs/msrp/tdav_codec_msrp.o
  226. ### T.140
  227. OBJS += src/codecs/t140/tdav_codec_t140.o
  228. $(APP): $(OBJS)
  229. ifeq ($(EXT), a)
  230. $(AR) rcs $@ $^
  231. else
  232. $(CC) $(LDFLAGS) -o $@ $^
  233. endif
  234. %.o: %.c
  235. $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@
  236. %.o: %.cxx
  237. $(CPP) -c $(INCLUDE) $(CFLAGS) $< -o $@
  238. install: $(APP)
  239. $(ANDROID_SDK_ROOT)/tools/adb remount
  240. $(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(LIB_DIR)/$(APP)
  241. $(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(LIB_DIR)/$(APP)
  242. clean:
  243. @rm -f $(OBJS) $(APP)