Makefile 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 objs/srs_ingest_mp4
  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_mp4 ingest mp4 file and publish to RTMP server."
  30. @echo " srs_ingest_rtmp ingest RTMP and publish to RTMP server."
  31. @echo " srs_detect_rtmp detect RTMP stream info."
  32. @echo " srs_bandwidth_check bandwidth check/test tool."
  33. @echo " srs_rtmp_dump dump rtmp stream to flv file."
  34. @echo "Remark: about simple/complex handshake, see: http://blog.csdn.net/win_lin/article/details/13006803"
  35. @echo "Remark: srs Makefile will auto invoke this by --with/without-ssl, "
  36. @echo " that is, if user specified ssl(by --with-ssl), srs will make this by 'make ssl'"
  37. @echo " that is, if user not use ssl(by --without-ssl), use 'make nossl'"
  38. @echo " see: https://github.com/ossrs/srs/wiki/v1_CN_v1_Build"
  39. @echo "Remark: before make this sample, user must make the srs, with/without ssl"
  40. clean:
  41. @rm -rf objs
  42. # srs library root
  43. SRS_OBJS = ../../objs
  44. # srs-librtmp for publish/play, built by srs.
  45. SRS_LIBRTMP_I = $(SRS_OBJS)/include/srs_librtmp.h
  46. SRS_LIBRTMP_L = $(SRS_OBJS)/lib/srs_librtmp.a
  47. # openssl for complex handshake, built by srs.
  48. SRS_LIBSSL_L =
  49. # public depends, the Makefile or public headers.
  50. SRS_RESEARCH_DEPS = Makefile
  51. # for x86/x64 platform
  52. ifeq ($(GCC), gcc)
  53. OTHER_FLAGS += -g -O0 -ldl -lstdc++ -lm
  54. endif
  55. # for arm.
  56. ifeq ($(GCC), arm-linux-gnueabi-gcc)
  57. OTHER_FLAGS += -g -O0 -ldl -static -lstdc++ -lm
  58. endif
  59. # for mips, add -lgcc_eh, or stl compile failed.
  60. ifeq ($(GCC), mipsel-openwrt-linux-gcc)
  61. OTHER_FLAGS += -g -O0 -ldl -lstdc++ -lm -lgcc_eh
  62. endif
  63. # for ssl or nossl
  64. ifeq ($(HANDSHAKE), SSL)
  65. SRS_LIBSSL_L = $(SRS_OBJS)/openssl/lib/libssl.a $(SRS_OBJS)/openssl/lib/libcrypto.a
  66. ifneq ($(shell test -f $(SRS_OBJS)/openssl/lib/libssl.a && echo yes), yes)
  67. SRS_LIBSSL_L = -lssl -lcrypto
  68. endif
  69. endif
  70. ssl:
  71. @mkdir -p objs
  72. $(MAKE) HANDSHAKE="SSL"
  73. nossl:
  74. @mkdir -p objs
  75. $(MAKE) HANDSHAKE="NOSSL"
  76. CXXFLAGS += $(OTHER_FLAGS) $(EXTRA_CXXFLAGS)
  77. objs/srs_flv_parser: srs_flv_parser.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
  78. $(GCC) srs_flv_parser.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_flv_parser
  79. objs/srs_flv_injecter: srs_flv_injecter.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
  80. $(GCC) srs_flv_injecter.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_flv_injecter
  81. objs/srs_publish: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  82. $(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_publish
  83. objs/srs_h264_raw_publish: srs_h264_raw_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  84. $(GCC) srs_h264_raw_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_h264_raw_publish
  85. objs/srs_audio_raw_publish: srs_audio_raw_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  86. $(GCC) srs_audio_raw_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_audio_raw_publish
  87. objs/srs_aac_raw_publish: srs_aac_raw_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  88. $(GCC) srs_aac_raw_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_aac_raw_publish
  89. objs/srs_play: srs_play.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  90. $(GCC) srs_play.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_play
  91. objs/srs_ingest_flv: srs_ingest_flv.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  92. $(GCC) srs_ingest_flv.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_ingest_flv
  93. objs/srs_ingest_mp4: srs_ingest_mp4.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  94. $(GCC) srs_ingest_mp4.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_ingest_mp4
  95. objs/srs_ingest_rtmp: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  96. $(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_ingest_rtmp
  97. objs/srs_detect_rtmp: srs_detect_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  98. $(GCC) srs_detect_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_detect_rtmp
  99. objs/srs_bandwidth_check: srs_bandwidth_check.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  100. $(GCC) srs_bandwidth_check.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_bandwidth_check
  101. objs/srs_rtmp_dump: srs_rtmp_dump.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
  102. $(GCC) srs_rtmp_dump.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(CXXFLAGS) -o objs/srs_rtmp_dump