正在显示
1 个修改的文件
包含
93 行增加
和
13 行删除
@@ -49,6 +49,35 @@ SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\"" | @@ -49,6 +49,35 @@ SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\"" | ||
49 | if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS_DIR}/utest; \$(MAKE))"; fi | 49 | if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS_DIR}/utest; \$(MAKE))"; fi |
50 | 50 | ||
51 | ##################################################################################### | 51 | ##################################################################################### |
52 | +# finger out modules to install. | ||
53 | +# where srs module is a dir which contains a config file. | ||
54 | +SRS_MODULES="" | ||
55 | +__mfiles=`find modules -name "config"` && for __mfile in $__mfiles; do | ||
56 | + SRS_MODULES="$SRS_MODULES `dirname $__mfile`" | ||
57 | +done | ||
58 | + | ||
59 | +# variables for makefile for all modules. | ||
60 | +__mphonys="" && __mdefaults="" && __mcleanups="" | ||
61 | +# add each modules for application | ||
62 | +for SRS_MODULE in $SRS_MODULES; do | ||
63 | + echo "install module at: $SRS_MODULE" | ||
64 | + . $SRS_MODULE/config | ||
65 | + __mphonys="$__mphonys $SRS_MODULE_NAME" | ||
66 | + __mdefaults="$__mdefaults $SRS_MODULE_NAME" | ||
67 | + __mcleanups="$__mcleanups $SRS_MODULE_NAME" | ||
68 | +done | ||
69 | + | ||
70 | +# clean the exists, when not export srs-librtmp. | ||
71 | +# do this only when the options is ok. | ||
72 | +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||
73 | + if [[ -f Makefile ]]; then | ||
74 | + make clean | ||
75 | + fi | ||
76 | +fi | ||
77 | +# remove makefile | ||
78 | +rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
79 | + | ||
80 | +##################################################################################### | ||
52 | # build tools or compiler args. | 81 | # build tools or compiler args. |
53 | # enable gdb debug | 82 | # enable gdb debug |
54 | GDBDebug=" -g -O0" | 83 | GDBDebug=" -g -O0" |
@@ -166,6 +195,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | @@ -166,6 +195,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||
166 | MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") | 195 | MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") |
167 | ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot}) | 196 | ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot}) |
168 | MODULE_FILES=("srs_main_server") | 197 | MODULE_FILES=("srs_main_server") |
198 | + # add each modules for main | ||
199 | + for SRS_MODULE in $SRS_MODULES; do | ||
200 | + . $SRS_MODULE/config | ||
201 | + MODULE_FILES="${MODULE_FILES[@]} $SRS_MODULE_MAIN" | ||
202 | + done | ||
169 | MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh | 203 | MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh |
170 | MAIN_OBJS="${MODULE_OBJS[@]}" | 204 | MAIN_OBJS="${MODULE_OBJS[@]}" |
171 | fi | 205 | fi |
@@ -178,6 +212,11 @@ fi | @@ -178,6 +212,11 @@ fi | ||
178 | if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | 212 | if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then |
179 | # all main entrances | 213 | # all main entrances |
180 | MAIN_ENTRANCES=("srs_main_server") | 214 | MAIN_ENTRANCES=("srs_main_server") |
215 | + # add each modules for main | ||
216 | + for SRS_MODULE in $SRS_MODULES; do | ||
217 | + . $SRS_MODULE/config | ||
218 | + MAIN_ENTRANCES="${MAIN_ENTRANCES[@]} $SRS_MODULE_MAIN" | ||
219 | + done | ||
181 | # | 220 | # |
182 | # all depends libraries | 221 | # all depends libraries |
183 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile}) | 222 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile}) |
@@ -185,9 +224,13 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | @@ -185,9 +224,13 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||
185 | MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}" | 224 | MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}" |
186 | LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}" | 225 | LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}" |
187 | # | 226 | # |
188 | - # srs: | ||
189 | - # srs(simple rtmp server) over st(state-threads) | 227 | + # srs: srs(simple rtmp server) over st(state-threads) |
190 | BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh | 228 | BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh |
229 | + # add each modules for application | ||
230 | + for SRS_MODULE in $SRS_MODULES; do | ||
231 | + . $SRS_MODULE/config | ||
232 | + BUILD_KEY="$SRS_MODULE_NAME" APP_MAIN="$SRS_MODULE_MAIN" APP_NAME="$SRS_MODULE_NAME" . auto/apps.sh | ||
233 | + done | ||
191 | fi | 234 | fi |
192 | # srs librtmp | 235 | # srs librtmp |
193 | if [ $SRS_LIBRTMP = YES ]; then | 236 | if [ $SRS_LIBRTMP = YES ]; then |
@@ -214,8 +257,14 @@ fi | @@ -214,8 +257,14 @@ fi | ||
214 | ##################################################################################### | 257 | ##################################################################################### |
215 | # makefile | 258 | # makefile |
216 | echo "generate Makefile" | 259 | echo "generate Makefile" |
260 | + | ||
261 | +# backup old makefile. | ||
262 | +rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}.bk && | ||
263 | +mv ${SRS_WORKDIR}/${SRS_MAKEFILE} ${SRS_WORKDIR}/${SRS_MAKEFILE}.bk | ||
264 | + | ||
265 | +# generate phony header | ||
217 | cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE} | 266 | cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE} |
218 | -.PHONY: default _default install install-api help clean server librtmp utest _prepare_dir | 267 | +.PHONY: default _default install install-api help clean server librtmp utest _prepare_dir $__mphonys |
219 | 268 | ||
220 | # install prefix. | 269 | # install prefix. |
221 | SRS_PREFIX=${SRS_PREFIX} | 270 | SRS_PREFIX=${SRS_PREFIX} |
@@ -243,22 +292,26 @@ fi | @@ -243,22 +292,26 @@ fi | ||
243 | # the server, librtmp and utest | 292 | # the server, librtmp and utest |
244 | # where the bellow will check and disable some entry by only echo. | 293 | # where the bellow will check and disable some entry by only echo. |
245 | cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | 294 | cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} |
246 | -_default: server librtmp utest | 295 | +_default: server librtmp utest $__mdefaults |
247 | @bash objs/_srs_build_summary.sh | 296 | @bash objs/_srs_build_summary.sh |
248 | 297 | ||
249 | help: | 298 | help: |
250 | @echo "Usage: make <help>|<clean>|<server>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>" | 299 | @echo "Usage: make <help>|<clean>|<server>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>" |
251 | - @echo " help display this help menu" | ||
252 | - @echo " clean cleanup project" | ||
253 | - @echo " server build the srs(simple rtmp server) over st(state-threads)" | ||
254 | - @echo " librtmp build the client publish/play library, and samples" | ||
255 | - @echo " utest build the utest for srs" | ||
256 | - @echo " install install srs to the prefix path" | ||
257 | - @echo " install-api install srs and api-server to the prefix path" | ||
258 | - @echo " uninstall uninstall srs from prefix path" | 300 | + @echo " help display this help menu" |
301 | + @echo " clean cleanup project" | ||
302 | + @echo " server build the srs(simple rtmp server) over st(state-threads)" | ||
303 | + @echo " librtmp build the client publish/play library, and samples" | ||
304 | + @echo " utest build the utest for srs" | ||
305 | + @echo " install install srs to the prefix path" | ||
306 | + @echo " install-api install srs and api-server to the prefix path" | ||
307 | + @echo " uninstall uninstall srs from prefix path" | ||
308 | + @echo "@remark all modules will auto genearted and build" | ||
309 | + @echo "For example:" | ||
310 | + @echo " make" | ||
311 | + @echo " make help" | ||
259 | 312 | ||
260 | clean: | 313 | clean: |
261 | - (cd ${SRS_OBJS_DIR}; rm -rf srs srs_utest) | 314 | + (cd ${SRS_OBJS_DIR}; rm -rf srs srs_utest $__mcleanups) |
262 | (cd ${SRS_OBJS_DIR}; rm -rf src research include lib) | 315 | (cd ${SRS_OBJS_DIR}; rm -rf src research include lib) |
263 | (cd ${SRS_OBJS_DIR}/utest; rm -rf *.o *.a) | 316 | (cd ${SRS_OBJS_DIR}/utest; rm -rf *.o *.a) |
264 | (cd research/librtmp; make clean) | 317 | (cd research/librtmp; make clean) |
@@ -281,6 +334,25 @@ server: _prepare_dir | @@ -281,6 +334,25 @@ server: _prepare_dir | ||
281 | 334 | ||
282 | END | 335 | END |
283 | fi | 336 | fi |
337 | +# generate all modules entry | ||
338 | +for SRS_MODULE in $SRS_MODULES; do | ||
339 | + . $SRS_MODULE/config | ||
340 | + # if export librtmp, donot build the bravo-ingest. | ||
341 | + if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then | ||
342 | + cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
343 | +$SRS_MODULE_NAME: _prepare_dir | ||
344 | + @echo "donot build the $SRS_MODULE_NAME for srs-librtmp" | ||
345 | + | ||
346 | +END | ||
347 | + else | ||
348 | + cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
349 | +$SRS_MODULE_NAME: _prepare_dir | ||
350 | + @echo "build the $SRS_MODULE_NAME over SRS" | ||
351 | + \$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} $SRS_MODULE_NAME | ||
352 | + | ||
353 | +END | ||
354 | + fi | ||
355 | +done | ||
284 | 356 | ||
285 | # disable install entry for srs-librtmp | 357 | # disable install entry for srs-librtmp |
286 | if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then | 358 | if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then |
@@ -390,6 +462,10 @@ _prepare_dir: | @@ -390,6 +462,10 @@ _prepare_dir: | ||
390 | @mkdir -p ${SRS_OBJS_DIR} | 462 | @mkdir -p ${SRS_OBJS_DIR} |
391 | END | 463 | END |
392 | 464 | ||
465 | +# generate makefile ok, append the tails. | ||
466 | +cat ${SRS_WORKDIR}/${SRS_MAKEFILE}.bk >> ${SRS_WORKDIR}/${SRS_MAKEFILE} && | ||
467 | +rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}.bk | ||
468 | + | ||
393 | echo 'configure ok! ' | 469 | echo 'configure ok! ' |
394 | 470 | ||
395 | ##################################################################################### | 471 | ##################################################################################### |
@@ -509,6 +585,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | @@ -509,6 +585,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||
509 | else | 585 | else |
510 | echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}" | 586 | echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}" |
511 | fi | 587 | fi |
588 | + # add each modules for application | ||
589 | + for SRS_MODULE in $SRS_MODULES; do | ||
590 | + echo -e "${GREEN}module: $SRS_MODULE${BLACK}" | ||
591 | + done | ||
512 | fi | 592 | fi |
513 | 593 | ||
514 | ##################################################################################### | 594 | ##################################################################################### |
-
请 注册 或 登录 后发表评论