2
0

Makefile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. GCC = gcc
  2. ifeq ($(HANDSHAKE),)
  3. ST_ALL = help
  4. else
  5. ST_ALL = objs/srs_flv_parser \
  6. objs/srs_flv_injecter objs/srs_publish objs/srs_play \
  7. objs/srs_ingest_flv objs/srs_ingest_rtmp objs/srs_detect_rtmp \
  8. objs/srs_bandwidth_check objs/srs_h264_raw_publish \
  9. objs/srs_audio_raw_publish objs/srs_aac_raw_publish \
  10. objs/srs_rtmp_dump
  11. endif
  12. .PHONY: default clean help ssl nossl
  13. default: $(ST_ALL)
  14. help:
  15. @echo "Usage: make <help>|<clean>|<ssl>|<nossl>"
  16. @echo " help display this help"
  17. @echo " clean cleanup build"
  18. @echo " ssl all tools link ssl"
  19. @echo " nossl all tools never link ssl"
  20. @echo "ssl/nossl will build the following tools:"
  21. @echo " srs_flv_parser parse flv file, print detail info."
  22. @echo " srs_flv_injecter inject keyframes information to metadata."
  23. @echo " srs_publish publish program using srs-librtmp"
  24. @echo " srs_h264_raw_publish publish raw h.264 stream to SSR by srs-librtmp"
  25. @echo " srs_audio_raw_publish publish raw audio stream to SSR by srs-librtmp"
  26. @echo " srs_aac_raw_publish publish raw aac stream to SSR by srs-librtmp"
  27. @echo " srs_play play program using srs-librtmp"
  28. @echo " srs_ingest_flv ingest flv file and publish to RTMP server."
  29. @echo " srs_ingest_rtmp ingest RTMP and publish to RTMP server."
  30. @echo " srs_detect_rtmp detect RTMP stream info."
  31. @echo " srs_bandwidth_check bandwidth check/test tool."
  32. @echo " srs_rtmp_dump dump rtmp stream to flv file."
  33. @echo "Remark: about simple/complex handshake, see: http://blog.csdn.net/win_lin/article/details/13006803"
  34. @echo "Remark: srs Makefile will auto invoke this by --with/without-ssl, "
  35. @echo " that is, if user specified ssl(by --with-ssl), srs will make this by 'make ssl'"
  36. @echo " that is, if user not use ssl(by --without-ssl), use 'make nossl'"
  37. @echo " see: https://github.com/ossrs/srs/wiki/v1_CN_v1_Build"
  38. @echo "Remark: before make this sample, user must make the srs, with/without ssl"
  39. clean:
  40. @rm -rf objs
  41. # srs library root
  42. SRS_OBJS = ../../objs
  43. # srs-librtmp for publish/play, built by srs.
  44. SRS_LIBRTMP_I = $(SRS_OBJS)/include/srs_librtmp.h
  45. SRS_LIBRTMP_L = $(SRS_OBJS)/lib/srs_librtmp.a
  46. # openssl for complex handshake, built by srs.
  47. SRS_LIBSSL_L =
  48. # public depends, the Makefile or public headers.
  49. SRS_RESEARCH_DEPS = Makefile
  50. # for x86/x64 platform
  51. ifeq ($(GCC), gcc)
  52. EXTRA_CXX_FLAG = -g -O0 -ldl -lstdc++
  53. endif
  54. # for arm.
  55. ifeq ($(GCC), arm-linux-gnueabi-gcc)
  56. EXTRA_CXX_FLAG = -g -O0 -ldl -static -lstdc++
  57. endif
  58. # for mips, add -lgcc_eh, or stl compile failed.
  59. ifeq ($(GCC), mipsel-openwrt-linux-gcc)
  60. EXTRA_CXX_FLAG = -g -O0 -ldl -lstdc++ -lgcc_eh
  61. endif
  62. # for ssl or nossl
  63. ifeq ($(HANDSHAKE), SSL)
  64. SRS_LIBSSL_L = $(SRS_OBJS)/openssl/lib/libssl.a $(SRS_OBJS)/openssl/lib/libcrypto.a
  65. endif
  66. ifneq ($(shell test -f $(SRS_OBJS)/openssl/lib/libssl.a && echo yes), yes)
  67. SRS_LIBSSL_L = -lssl -lcrypto
  68. endif
  69. ssl:
  70. @mkdir -p objs
  71. $(MAKE) HANDSHAKE="SSL"
  72. nossl:
  73. @mkdir -p objs
  74. $(MAKE) HANDSHAKE="NOSSL"
  75. objs/srs_flv_parser: srs_flv_parser.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
  76. $(GCC) srs_flv_parser.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_flv_parser
  77. objs/srs_flv_injecter: srs_flv_injecter.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
  78. $(GCC) srs_flv_injecter.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_flv_injecter
  79. objs/srs_publish: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  80. $(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_publish
  81. objs/srs_h264_raw_publish: srs_h264_raw_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  82. $(GCC) srs_h264_raw_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_h264_raw_publish
  83. objs/srs_audio_raw_publish: srs_audio_raw_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  84. $(GCC) srs_audio_raw_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_audio_raw_publish
  85. objs/srs_aac_raw_publish: srs_aac_raw_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  86. $(GCC) srs_aac_raw_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_aac_raw_publish
  87. objs/srs_play: srs_play.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  88. $(GCC) srs_play.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_play
  89. objs/srs_ingest_flv: srs_ingest_flv.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  90. $(GCC) srs_ingest_flv.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_ingest_flv
  91. objs/srs_ingest_rtmp: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  92. $(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_ingest_rtmp
  93. objs/srs_detect_rtmp: srs_detect_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  94. $(GCC) srs_detect_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_detect_rtmp
  95. objs/srs_bandwidth_check: srs_bandwidth_check.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  96. $(GCC) srs_bandwidth_check.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_bandwidth_check
  97. objs/srs_rtmp_dump: srs_rtmp_dump.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  98. $(GCC) srs_rtmp_dump.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o objs/srs_rtmp_dump