winlin

support ubuntu make colorful display

@@ -47,6 +47,8 @@ echo "" >> $SRS_AUTO_HEADERS_H @@ -47,6 +47,8 @@ echo "" >> $SRS_AUTO_HEADERS_H
47 # generate Makefile. 47 # generate Makefile.
48 ##################################################################################### 48 #####################################################################################
49 SRS_MAKEFILE="Makefile" 49 SRS_MAKEFILE="Makefile"
  50 +# ubuntu echo in Makefile cannot display color, use bash instead
  51 +SRS_BUILD_SUMMARY="_srs_build_summary.sh"
50 52
51 ##################################################################################### 53 #####################################################################################
52 # srs-librtmp sample entry 54 # srs-librtmp sample entry
@@ -58,20 +60,78 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE) @@ -58,20 +60,78 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE)
58 60
59 ##################################################################################### 61 #####################################################################################
60 # colorful summary 62 # colorful summary
61 -SrsHlsSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\$(GREEN)"; fi  
62 -SrsSslSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\$(GREEN)"; fi  
63 -SrsFfmpegSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_FFMPEG = YES ]; then SrsFfmpegSummaryColor="\$(GREEN)"; fi  
64 -SrsHttpCallbackSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\$(GREEN)"; fi  
65 -SrsLibrtmpSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\$(GREEN)"; fi  
66 -SrsLibrtmpSSLSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\$(GREEN)"; fi fi  
67 -SrsBWTCSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_BWTC = YES ]; then SrsBWTCSummaryColor="\$(GREEN)"; fi  
68 -SrsResearchSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\$(GREEN)"; fi  
69 -SrsUtestSummaryColor="\$(YELLOW)(disabled) "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\$(GREEN)"; fi  
70 -SrsGperfSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\$(GREEN)"; fi  
71 -SrsGperfMCSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\$(YELLOW)"; fi  
72 -SrsGperfMPSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\$(YELLOW)"; fi  
73 -SrsGperfCPSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\$(YELLOW)"; fi  
74 -SrsGprofSummaryColor="\$(GREEN)(disabled) "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\$(YELLOW)"; fi 63 +SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi
  64 +SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi
  65 +SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi
  66 +SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi
  67 +SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi
  68 +SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi
  69 +SrsBWTCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_BWTC = YES ]; then SrsBWTCSummaryColor="\${GREEN}"; fi
  70 +SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi
  71 +SrsUtestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\${GREEN}"; fi
  72 +SrsGperfSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\${GREEN}"; fi
  73 +SrsGperfMCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\${YELLOW}"; fi
  74 +SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\${YELLOW}"; fi
  75 +SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
  76 +SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
  77 +cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
  78 +#!/bin/bash
  79 +
  80 +#####################################################################################
  81 +# linux shell color support.
  82 +RED="\\${RED}"
  83 +GREEN="\\${GREEN}"
  84 +YELLOW="\\${YELLOW}"
  85 +BLACK="\\${BLACK}"
  86 +
  87 +echo -e "\${GREEN}build summary:\${BLACK}"
  88 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  89 +echo -e " |${SrsGperfSummaryColor}gperf @see: https://github.com/winlinvip/simple-rtmp-server/wiki/GPERF\${BLACK}"
  90 +echo -e " | ${SrsGperfMCSummaryColor}gmc @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\${BLACK}"
  91 +echo -e " | ${SrsGperfMCSummaryColor}gmc: gperf memory check\${BLACK}"
  92 +echo -e " | ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\${BLACK}"
  93 +echo -e " | ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\${BLACK}"
  94 +echo -e " | ${SrsGperfMPSummaryColor}gmp @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\${BLACK}"
  95 +echo -e " | ${SrsGperfMPSummaryColor}gmp: gperf memory profile\${BLACK}"
  96 +echo -e " | ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/srs.conf # start gmp\${BLACK}"
  97 +echo -e " | ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\${BLACK}"
  98 +echo -e " | ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\${BLACK}"
  99 +echo -e " | ${SrsGperfCPSummaryColor}gcp @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\${BLACK}"
  100 +echo -e " | ${SrsGperfCPSummaryColor}gcp: gperf cpu profile\${BLACK}"
  101 +echo -e " | ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/srs.conf # start gcp\${BLACK}"
  102 +echo -e " | ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\${BLACK}"
  103 +echo -e " | ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\${BLACK}"
  104 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  105 +echo -e " |${SrsGprofSummaryColor}gprof @see: https://github.com/winlinvip/simple-rtmp-server/wiki/GPROF\${BLACK}"
  106 +echo -e " |${SrsGprofSummaryColor}gprof: GNU profile tool, @see: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html\${BLACK}"
  107 +echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/srs.conf # start gprof\${BLACK}"
  108 +echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
  109 +echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
  110 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  111 +echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info.\${BLACK}"
  112 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  113 +echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
  114 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  115 +echo -e " |${SrsBWTCSummaryColor}bandwidth: ./objs/bandwidth, the bandwidth test client\${BLACK}"
  116 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  117 +echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLibrtmp\${BLACK}"
  118 +echo -e " |${SrsLibrtmpSummaryColor}librtmp: ./objs/include, ./objs/lib, the srs-librtmp library\${BLACK}"
  119 +echo -e " | ${SrsLibrtmpSummaryColor}simple handshake: publish/play stream with simple handshake to server\${BLACK}"
  120 +echo -e " | ${SrsLibrtmpSSLSummaryColor}complex handshake: it's not required for client, recommend disable it\${BLACK}"
  121 +echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp, the srs-librtmp client sample\${BLACK}"
  122 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  123 +echo -e " |\${GREEN}server: ./objs/srs, the srs server\${BLACK}"
  124 +echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}"
  125 +echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts, delivery HLS stream by nginx\${BLACK}"
  126 +echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\${BLACK}"
  127 +echo -e " | ${SrsSslSummaryColor}ssl: support RTMP complex handshake for client required, for instance, flash\${BLACK}"
  128 +echo -e " | ${SrsFfmpegSummaryColor}ffmpeg @see: https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG\${BLACK}"
  129 +echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: support transcoding RTMP stream with FFMPEG\${BLACK}"
  130 +echo -e " | ${SrsHttpCallbackSummaryColor}http @see: https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback\${BLACK}"
  131 +echo -e " | ${SrsHttpCallbackSummaryColor}http: support http callback for authentication and event injection\${BLACK}"
  132 +echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
  133 +echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\${BLACK}"
  134 +END
75 135
76 ##################################################################################### 136 #####################################################################################
77 # makefile 137 # makefile
@@ -86,53 +146,7 @@ YELLOW="\\${YELLOW}" @@ -86,53 +146,7 @@ YELLOW="\\${YELLOW}"
86 BLACK="\\${BLACK}" 146 BLACK="\\${BLACK}"
87 147
88 default: bandwidth librtmp-sample utest 148 default: bandwidth librtmp-sample utest
89 - @echo -e "\$(GREEN)build summary:\$(BLACK)"  
90 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
91 - @echo -e " |${SrsGperfSummaryColor}gperf @see: https://github.com/winlinvip/simple-rtmp-server/wiki/GPERF\$(BLACK)"  
92 - @echo -e " | ${SrsGperfMCSummaryColor}gmc @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\$(BLACK)"  
93 - @echo -e " | ${SrsGperfMCSummaryColor}gmc: gperf memory check\$(BLACK)"  
94 - @echo -e " | ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf # start gmc\$(BLACK)"  
95 - @echo -e " | ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\$(BLACK)"  
96 - @echo -e " | ${SrsGperfMPSummaryColor}gmp @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\$(BLACK)"  
97 - @echo -e " | ${SrsGperfMPSummaryColor}gmp: gperf memory profile\$(BLACK)"  
98 - @echo -e " | ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/srs.conf # start gmp\$(BLACK)"  
99 - @echo -e " | ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\$(BLACK)"  
100 - @echo -e " | ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\$(BLACK)"  
101 - @echo -e " | ${SrsGperfCPSummaryColor}gcp @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\$(BLACK)"  
102 - @echo -e " | ${SrsGperfCPSummaryColor}gcp: gperf cpu profile\$(BLACK)"  
103 - @echo -e " | ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/srs.conf # start gcp\$(BLACK)"  
104 - @echo -e " | ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\$(BLACK)"  
105 - @echo -e " | ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\$(BLACK)"  
106 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
107 - @echo -e " |${SrsGprofSummaryColor}gprof @see: https://github.com/winlinvip/simple-rtmp-server/wiki/GPROF\$(BLACK)"  
108 - @echo -e " |${SrsGprofSummaryColor}gprof: GNU profile tool, @see: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html\$(BLACK)"  
109 - @echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/srs.conf # start gprof\$(BLACK)"  
110 - @echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\$(BLACK)"  
111 - @echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\$(BLACK)"  
112 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
113 - @echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info.\$(BLACK)"  
114 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
115 - @echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\$(BLACK)"  
116 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
117 - @echo -e " |${SrsBWTCSummaryColor}bandwidth: ./objs/bandwidth, the bandwidth test client\$(BLACK)"  
118 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
119 - @echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLibrtmp\$(BLACK)"  
120 - @echo -e " |${SrsLibrtmpSummaryColor}librtmp: ./objs/include, ./objs/lib, the srs-librtmp library\$(BLACK)"  
121 - @echo -e " | ${SrsLibrtmpSummaryColor}simple handshake: publish/play stream with simple handshake to server\$(BLACK)"  
122 - @echo -e " | ${SrsLibrtmpSSLSummaryColor}complex handshake: it's not required for client, recommend disable it\$(BLACK)"  
123 - @echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp, the srs-librtmp client sample\$(BLACK)"  
124 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
125 - @echo -e " |\$(GREEN)server: ./objs/srs, the srs server\$(BLACK)"  
126 - @echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\$(BLACK)"  
127 - @echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts, delivery HLS stream by nginx\$(BLACK)"  
128 - @echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\$(BLACK)"  
129 - @echo -e " | ${SrsSslSummaryColor}ssl: support RTMP complex handshake for client required, for instance, flash\$(BLACK)"  
130 - @echo -e " | ${SrsFfmpegSummaryColor}ffmpeg @see: https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG\$(BLACK)"  
131 - @echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: support transcoding RTMP stream with FFMPEG\$(BLACK)"  
132 - @echo -e " | ${SrsHttpCallbackSummaryColor}http @see: https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback\$(BLACK)"  
133 - @echo -e " | ${SrsHttpCallbackSummaryColor}http: support http callback for authentication and event injection\$(BLACK)"  
134 - @echo -e " \$(BLACK)+------------------------------------------------------------------------------------\$(BLACK)"  
135 - @echo -e "\$(GREEN)binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build\$(BLACK)" 149 + @bash ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
136 150
137 help: 151 help:
138 @echo "Usage: make <help>|<clean>|<server>|<bandwidth>|<librtmp>|<librtmp-sample>|<utest>" 152 @echo "Usage: make <help>|<clean>|<server>|<bandwidth>|<librtmp>|<librtmp-sample>|<utest>"
@@ -146,7 +160,7 @@ help: @@ -146,7 +160,7 @@ help:
146 160
147 clean: 161 clean:
148 (rm -f Makefile) 162 (rm -f Makefile)
149 - (cd ${SRS_OBJS}; rm -rf srs bandwidth *.hpp srs_utest) 163 + (cd ${SRS_OBJS}; rm -rf ${SRS_BUILD_SUMMARY} srs bandwidth *.hpp srs_utest)
150 (cd ${SRS_OBJS}; rm -rf src research include lib utest) 164 (cd ${SRS_OBJS}; rm -rf src research include lib utest)
151 (cd research/librtmp; make clean) 165 (cd research/librtmp; make clean)
152 166