build.mak 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. export PJDIR := /code
  2. include $(PJDIR)/version.mak
  3. export PJ_DIR := $(PJDIR)
  4. # build.mak. Generated from build.mak.in by configure.
  5. export MACHINE_NAME := auto
  6. export OS_NAME := auto
  7. export HOST_NAME := unix
  8. export CC_NAME := gcc
  9. export TARGET_ARCH :=
  10. export STD_CPP_LIB :=
  11. export TARGET_NAME := x86_64-unknown-linux-gnu
  12. export CROSS_COMPILE :=
  13. export LINUX_POLL := select
  14. export SHLIB_SUFFIX := so
  15. export prefix := /usr/local
  16. export exec_prefix := ${prefix}
  17. export includedir := ${prefix}/include
  18. export libdir := ${exec_prefix}/lib
  19. LIB_SUFFIX := $(TARGET_NAME).a
  20. ifeq (,1)
  21. export PJ_SHARED_LIBRARIES := 1
  22. endif
  23. ifeq (,1)
  24. export PJ_EXCLUDE_PJSUA2 := 1
  25. endif
  26. ifndef EXCLUDE_APP
  27. ifeq ($(findstring android,$(TARGET_NAME)),)
  28. export EXCLUDE_APP := 0
  29. else
  30. export EXCLUDE_APP := 1
  31. endif
  32. endif
  33. # Determine which party libraries to use
  34. export APP_THIRD_PARTY_EXT :=
  35. export APP_THIRD_PARTY_LIBS :=
  36. export APP_THIRD_PARTY_LIB_FILES :=
  37. ifneq (,1)
  38. ifneq (0,0)
  39. # External SRTP library
  40. APP_THIRD_PARTY_EXT += -l
  41. else
  42. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
  43. ifeq ($(PJ_SHARED_LIBRARIES),)
  44. APP_THIRD_PARTY_LIBS += -lsrtp-$(TARGET_NAME)
  45. else
  46. APP_THIRD_PARTY_LIBS += -lsrtp
  47. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX)
  48. endif
  49. endif
  50. endif
  51. ifeq (libresample,libresample)
  52. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX)
  53. ifeq ($(PJ_SHARED_LIBRARIES),)
  54. ifeq (,1)
  55. export PJ_RESAMPLE_DLL := 1
  56. APP_THIRD_PARTY_LIBS += -lresample
  57. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFIX)
  58. else
  59. APP_THIRD_PARTY_LIBS += -lresample-$(TARGET_NAME)
  60. endif
  61. else
  62. APP_THIRD_PARTY_LIBS += -lresample
  63. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFIX)
  64. endif
  65. endif
  66. ifneq (,1)
  67. ifeq (0,1)
  68. # External GSM library
  69. APP_THIRD_PARTY_EXT += -lgsm
  70. else
  71. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libgsmcodec-$(LIB_SUFFIX)
  72. ifeq ($(PJ_SHARED_LIBRARIES),)
  73. APP_THIRD_PARTY_LIBS += -lgsmcodec-$(TARGET_NAME)
  74. else
  75. APP_THIRD_PARTY_LIBS += -lgsmcodec
  76. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libgsmcodec.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libgsmcodec.$(SHLIB_SUFFIX)
  77. endif
  78. endif
  79. endif
  80. ifneq (,1)
  81. ifeq (0,1)
  82. APP_THIRD_PARTY_EXT += -lspeex -lspeexdsp
  83. else
  84. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libspeex-$(LIB_SUFFIX)
  85. ifeq ($(PJ_SHARED_LIBRARIES),)
  86. APP_THIRD_PARTY_LIBS += -lspeex-$(TARGET_NAME)
  87. else
  88. APP_THIRD_PARTY_LIBS += -lspeex
  89. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libspeex.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libspeex.$(SHLIB_SUFFIX)
  90. endif
  91. endif
  92. endif
  93. ifneq (,1)
  94. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libilbccodec-$(LIB_SUFFIX)
  95. ifeq ($(PJ_SHARED_LIBRARIES),)
  96. APP_THIRD_PARTY_LIBS += -lilbccodec-$(TARGET_NAME)
  97. else
  98. APP_THIRD_PARTY_LIBS += -lilbccodec
  99. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libilbccodec.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libilbccodec.$(SHLIB_SUFFIX)
  100. endif
  101. endif
  102. ifneq (,1)
  103. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libg7221codec-$(LIB_SUFFIX)
  104. ifeq ($(PJ_SHARED_LIBRARIES),)
  105. APP_THIRD_PARTY_LIBS += -lg7221codec-$(TARGET_NAME)
  106. else
  107. APP_THIRD_PARTY_LIBS += -lg7221codec
  108. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libg7221codec.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libg7221codec.$(SHLIB_SUFFIX)
  109. endif
  110. endif
  111. ifeq (0,1)
  112. # External PA
  113. APP_THIRD_PARTY_EXT += -lportaudio
  114. endif
  115. ifneq (,1)
  116. ifeq (0,1)
  117. APP_THIRD_PARTY_EXT += -lyuv
  118. else
  119. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libyuv-$(LIB_SUFFIX)
  120. ifeq ($(PJ_SHARED_LIBRARIES),)
  121. APP_THIRD_PARTY_LIBS += -lyuv-$(TARGET_NAME)
  122. else
  123. APP_THIRD_PARTY_LIBS += -lyuv
  124. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libyuv.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libyuv.$(SHLIB_SUFFIX)
  125. endif
  126. endif
  127. endif
  128. ifneq (,1)
  129. ifeq (0,1)
  130. APP_THIRD_PARTY_EXT += -lwebrtc
  131. else
  132. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libwebrtc-$(LIB_SUFFIX)
  133. ifeq ($(PJ_SHARED_LIBRARIES),)
  134. APP_THIRD_PARTY_LIBS += -lwebrtc-$(TARGET_NAME)
  135. else
  136. APP_THIRD_PARTY_LIBS += -lwebrtc
  137. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libwebrtc.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libwebrtc.$(SHLIB_SUFFIX)
  138. endif
  139. endif
  140. endif
  141. ifneq (1,1)
  142. ifeq (0,1)
  143. APP_THIRD_PARTY_EXT += -lwebrtc-aec3
  144. else
  145. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libwebrtc-aec3-$(LIB_SUFFIX)
  146. ifeq ($(PJ_SHARED_LIBRARIES),)
  147. APP_THIRD_PARTY_LIBS += -lwebrtc-aec3-$(TARGET_NAME)
  148. else
  149. APP_THIRD_PARTY_LIBS += -lwebrtc-aec3
  150. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libwebrtc-aec3.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libwebrtc.$(SHLIB_SUFFIX)
  151. endif
  152. endif
  153. endif
  154. # Additional flags
  155. #
  156. # Video
  157. # Note: there are duplicated macros in pjmedia/os-auto.mak.in (and that's not
  158. # good!
  159. # SDL flags
  160. SDL_CFLAGS =
  161. SDL_LDFLAGS =
  162. # FFMPEG flags
  163. FFMPEG_CFLAGS = -DPJMEDIA_USE_OLD_FFMPEG=1
  164. FFMPEG_LDFLAGS =
  165. # Video4Linux2
  166. V4L2_CFLAGS =
  167. V4L2_LDFLAGS =
  168. # OPENH264 flags
  169. OPENH264_CFLAGS =
  170. OPENH264_LDFLAGS =
  171. # VPX flags
  172. VPX_CFLAGS =
  173. VPX_LDFLAGS =
  174. # QT
  175. AC_PJMEDIA_VIDEO_HAS_QT =
  176. # QT_CFLAGS =
  177. # Darwin (Mac and iOS)
  178. AC_PJMEDIA_VIDEO_HAS_DARWIN =
  179. AC_PJMEDIA_VIDEO_HAS_METAL =
  180. AC_PJMEDIA_VIDEO_HAS_VTOOLBOX =
  181. AC_PJMEDIA_VIDEO_HAS_IOS_OPENGL =
  182. DARWIN_CFLAGS =
  183. # mingw
  184. AC_PJMEDIA_VIDEO_DEV_HAS_DSHOW =
  185. ifeq (,yes)
  186. DSHOW_CFLAGS =
  187. DSHOW_LDFLAGS =
  188. APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libbaseclasses-$(LIB_SUFFIX)
  189. APP_THIRD_PARTY_LIBS += -lbaseclasses-$(TARGET_NAME)
  190. endif
  191. # Android
  192. ANDROID_CFLAGS =
  193. OBOE_CFLAGS =
  194. # PJMEDIA features exclusion
  195. PJ_VIDEO_CFLAGS += $(SDL_CFLAGS) $(FFMPEG_CFLAGS) $(V4L2_CFLAGS) $(DSHOW_CFLAGS) $(QT_CFLAGS) \
  196. $(OPENH264_CFLAGS) $(VPX_CFLAGS) $(DARWIN_CFLAGS)
  197. PJ_VIDEO_LDFLAGS += $(SDL_LDFLAGS) $(FFMPEG_LDFLAGS) $(V4L2_LDFLAGS) $(DSHOW_LDFLAGS) \
  198. $(OPENH264_LDFLAGS) $(VPX_LDFLAGS)
  199. # CFLAGS, LDFLAGS, and LIBS to be used by applications
  200. export APP_CC := gcc
  201. export APP_CXX := g++
  202. export APP_CFLAGS := -DPJ_AUTOCONF=1\
  203. -fPIC -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1\
  204. $(PJ_VIDEO_CFLAGS) \
  205. -I$(PJDIR)/pjlib/include\
  206. -I$(PJDIR)/pjlib-util/include\
  207. -I$(PJDIR)/pjnath/include\
  208. -I$(PJDIR)/pjmedia/include\
  209. -I$(PJDIR)/pjsip/include
  210. export APP_CXXFLAGS := -g -O2 $(APP_CFLAGS)
  211. export APP_LDFLAGS := -L$(PJDIR)/pjlib/lib\
  212. -L$(PJDIR)/pjlib-util/lib\
  213. -L$(PJDIR)/pjnath/lib\
  214. -L$(PJDIR)/pjmedia/lib\
  215. -L$(PJDIR)/pjsip/lib\
  216. -L$(PJDIR)/third_party/lib\
  217. $(PJ_VIDEO_LDFLAGS) \
  218. export APP_LDXXFLAGS := $(APP_LDFLAGS)
  219. export APP_LIB_FILES := \
  220. $(PJ_DIR)/pjsip/lib/libpjsua-$(LIB_SUFFIX) \
  221. $(PJ_DIR)/pjsip/lib/libpjsip-ua-$(LIB_SUFFIX) \
  222. $(PJ_DIR)/pjsip/lib/libpjsip-simple-$(LIB_SUFFIX) \
  223. $(PJ_DIR)/pjsip/lib/libpjsip-$(LIB_SUFFIX) \
  224. $(PJ_DIR)/pjmedia/lib/libpjmedia-codec-$(LIB_SUFFIX) \
  225. $(PJ_DIR)/pjmedia/lib/libpjmedia-videodev-$(LIB_SUFFIX) \
  226. $(PJ_DIR)/pjmedia/lib/libpjmedia-$(LIB_SUFFIX) \
  227. $(PJ_DIR)/pjmedia/lib/libpjmedia-audiodev-$(LIB_SUFFIX) \
  228. $(PJ_DIR)/pjnath/lib/libpjnath-$(LIB_SUFFIX) \
  229. $(PJ_DIR)/pjlib-util/lib/libpjlib-util-$(LIB_SUFFIX) \
  230. $(APP_THIRD_PARTY_LIB_FILES) \
  231. $(PJ_DIR)/pjlib/lib/libpj-$(LIB_SUFFIX)
  232. export APP_LIBXX_FILES := \
  233. $(PJ_DIR)/pjsip/lib/libpjsua2-$(LIB_SUFFIX) \
  234. $(APP_LIB_FILES)
  235. ifeq ($(PJ_SHARED_LIBRARIES),)
  236. export PJLIB_LDLIB := -lpj-$(TARGET_NAME)
  237. export PJLIB_UTIL_LDLIB := -lpjlib-util-$(TARGET_NAME)
  238. export PJNATH_LDLIB := -lpjnath-$(TARGET_NAME)
  239. export PJMEDIA_AUDIODEV_LDLIB := -lpjmedia-audiodev-$(TARGET_NAME)
  240. export PJMEDIA_VIDEODEV_LDLIB := -lpjmedia-videodev-$(TARGET_NAME)
  241. export PJMEDIA_LDLIB := -lpjmedia-$(TARGET_NAME)
  242. export PJMEDIA_CODEC_LDLIB := -lpjmedia-codec-$(TARGET_NAME)
  243. export PJSIP_LDLIB := -lpjsip-$(TARGET_NAME)
  244. export PJSIP_SIMPLE_LDLIB := -lpjsip-simple-$(TARGET_NAME)
  245. export PJSIP_UA_LDLIB := -lpjsip-ua-$(TARGET_NAME)
  246. export PJSUA_LIB_LDLIB := -lpjsua-$(TARGET_NAME)
  247. export PJSUA2_LIB_LDLIB := -lpjsua2-$(TARGET_NAME)
  248. else
  249. export PJLIB_LDLIB := -lpj
  250. export PJLIB_UTIL_LDLIB := -lpjlib-util
  251. export PJNATH_LDLIB := -lpjnath
  252. export PJMEDIA_AUDIODEV_LDLIB := -lpjmedia-audiodev
  253. export PJMEDIA_VIDEODEV_LDLIB := -lpjmedia-videodev
  254. export PJMEDIA_LDLIB := -lpjmedia
  255. export PJMEDIA_CODEC_LDLIB := -lpjmedia-codec
  256. export PJSIP_LDLIB := -lpjsip
  257. export PJSIP_SIMPLE_LDLIB := -lpjsip-simple
  258. export PJSIP_UA_LDLIB := -lpjsip-ua
  259. export PJSUA_LIB_LDLIB := -lpjsua
  260. export PJSUA2_LIB_LDLIB := -lpjsua2
  261. export ADD_LIB_FILES := $(PJ_DIR)/pjsip/lib/libpjsua.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjsip/lib/libpjsua.$(SHLIB_SUFFIX) \
  262. $(PJ_DIR)/pjsip/lib/libpjsip-ua.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjsip/lib/libpjsip-ua.$(SHLIB_SUFFIX) \
  263. $(PJ_DIR)/pjsip/lib/libpjsip-simple.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjsip/lib/libpjsip-simple.$(SHLIB_SUFFIX) \
  264. $(PJ_DIR)/pjsip/lib/libpjsip.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjsip/lib/libpjsip.$(SHLIB_SUFFIX) \
  265. $(PJ_DIR)/pjmedia/lib/libpjmedia-codec.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjmedia/lib/libpjmedia-codec.$(SHLIB_SUFFIX) \
  266. $(PJ_DIR)/pjmedia/lib/libpjmedia-videodev.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjmedia/lib/libpjmedia-videodev.$(SHLIB_SUFFIX) \
  267. $(PJ_DIR)/pjmedia/lib/libpjmedia.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjmedia/lib/libpjmedia.$(SHLIB_SUFFIX) \
  268. $(PJ_DIR)/pjmedia/lib/libpjmedia-audiodev.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjmedia/lib/libpjmedia-audiodev.$(SHLIB_SUFFIX) \
  269. $(PJ_DIR)/pjnath/lib/libpjnath.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjnath/lib/libpjnath.$(SHLIB_SUFFIX) \
  270. $(PJ_DIR)/pjlib-util/lib/libpjlib-util.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjlib-util/lib/libpjlib-util.$(SHLIB_SUFFIX) \
  271. $(PJ_DIR)/pjlib/lib/libpj.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjlib/lib/libpj.$(SHLIB_SUFFIX)
  272. APP_LIB_FILES += $(ADD_LIB_FILES)
  273. APP_LIBXX_FILES += $(PJ_DIR)/pjsip/lib/libpjsua2.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjsip/lib/libpjsua2.$(SHLIB_SUFFIX) \
  274. $(ADD_LIB_FILES)
  275. endif
  276. ifeq ($(PJ_EXCLUDE_PJSUA2),1)
  277. export PJSUA2_LIB_LDLIB :=
  278. endif
  279. export APP_LDLIBS := $(PJSUA_LIB_LDLIB) \
  280. $(PJSIP_UA_LDLIB) \
  281. $(PJSIP_SIMPLE_LDLIB) \
  282. $(PJSIP_LDLIB) \
  283. $(PJMEDIA_CODEC_LDLIB) \
  284. $(PJMEDIA_VIDEODEV_LDLIB) \
  285. $(PJMEDIA_AUDIODEV_LDLIB) \
  286. $(PJMEDIA_LDLIB) \
  287. $(PJNATH_LDLIB) \
  288. $(PJLIB_UTIL_LDLIB) \
  289. $(APP_THIRD_PARTY_LIBS)\
  290. $(APP_THIRD_PARTY_EXT)\
  291. $(PJLIB_LDLIB) \
  292. -lssl -lcrypto -luuid -lm -lrt -lpthread
  293. export APP_LDXXLIBS := $(PJSUA2_LIB_LDLIB) \
  294. -lstdc++ \
  295. $(APP_LDLIBS)
  296. # Here are the variables to use if application is using the library
  297. # from within the source distribution
  298. export PJ_CC := $(APP_CC)
  299. export PJ_CXX := $(APP_CXX)
  300. export PJ_CFLAGS := $(APP_CFLAGS)
  301. export PJ_CXXFLAGS := $(APP_CXXFLAGS)
  302. export PJ_LDFLAGS := $(APP_LDFLAGS)
  303. export PJ_LDXXFLAGS := $(APP_LDXXFLAGS)
  304. export PJ_LDLIBS := $(APP_LDLIBS)
  305. export PJ_LDXXLIBS := $(APP_LDXXLIBS)
  306. export PJ_LIB_FILES := $(APP_LIB_FILES)
  307. export PJ_LIBXX_FILES := $(APP_LIBXX_FILES)
  308. # And here are the variables to use if application is using the
  309. # library from the install location (i.e. --prefix)
  310. export PJ_INSTALL_DIR := /usr/local
  311. export PJ_INSTALL_INC_DIR := ${prefix}/include
  312. export PJ_INSTALL_LIB_DIR := ${exec_prefix}/lib
  313. export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1
  314. export PJ_INSTALL_LDFLAGS_PRIVATE := $(APP_THIRD_PARTY_LIBS) $(APP_THIRD_PARTY_EXT) -lssl -lcrypto -luuid -lm -lrt -lpthread
  315. export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(filter-out $(PJ_INSTALL_LDFLAGS_PRIVATE),$(APP_LDXXLIBS))