mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
1. Replase ln by cp for windows. 2. Refine OS and CPU arch detecting. 3. Support configure from any directory by `SRS_WORKDIR`. 4. Support output to any directory by `SRS_OUTPUT`. 5. Disable sanitizer for gperf. 6. Use parallels build for make. 7. Refine bash variable check.
This commit is contained in:
parent
368356c223
commit
e9503a9c9a
13 changed files with 535 additions and 555 deletions
|
@ -2,26 +2,25 @@
|
|||
#
|
||||
# params:
|
||||
# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
|
||||
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
|
||||
# $SRS_MAKEFILE the makefile name. ie. Makefile
|
||||
# $SRS_OBJS the objs directory for Makefile. ie. objs
|
||||
#
|
||||
# $APP_NAME the app name to output. ie. srs_utest
|
||||
# $MODULE_DIR the src dir of utest code. ie. src/utest
|
||||
# $LINK_OPTIONS the link options for utest. ie. -lpthread -ldl
|
||||
|
||||
FILE=${SRS_OBJS}/utest/${SRS_MAKEFILE}
|
||||
FILE=${SRS_OBJS}/${SRS_PLATFORM}/utest/Makefile
|
||||
# create dir for Makefile
|
||||
mkdir -p ${SRS_OBJS}/utest
|
||||
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/utest
|
||||
|
||||
# the prefix to generate the objs/utest/Makefile
|
||||
# dirs relative to current dir(objs/utest), it's trunk/objs/utest
|
||||
# trunk of srs, which contains the src dir, relative to objs/utest, it's trunk
|
||||
SRS_TRUNK_PREFIX=../../..
|
||||
# gest dir, relative to objs/utest, it's trunk/objs/gtest
|
||||
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/gtest
|
||||
# gest dir, relative to objs/utest, it's trunk/objs/{Platform}/gtest
|
||||
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${SRS_PLATFORM}/3rdpatry/gtest/googletest
|
||||
|
||||
cat << END > ${FILE}
|
||||
# user must run make the ${SRS_OBJS_DIR}/utest dir
|
||||
# user must run make the ${SRS_OBJS}/utest dir
|
||||
# at the same dir of Makefile.
|
||||
|
||||
# A sample Makefile for building Google Test and using it in user
|
||||
|
@ -58,7 +57,7 @@ CXXFLAGS += -std=c++11
|
|||
|
||||
# All tests produced by this Makefile. Remember to add new tests you
|
||||
# created to the list.
|
||||
TESTS = ${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/${APP_NAME}
|
||||
TESTS = ${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${APP_NAME}
|
||||
|
||||
# All Google Test headers. Usually you shouldn't change this
|
||||
# definition.
|
||||
|
@ -139,7 +138,7 @@ echo "# Depends, the depends objects" >> ${FILE}
|
|||
echo -n "SRS_UTEST_DEPS = " >> ${FILE}
|
||||
for item in ${MODULE_OBJS[*]}; do
|
||||
FILE_NAME=${item%.*}
|
||||
echo -n "${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/${FILE_NAME}.o " >> ${FILE}
|
||||
echo -n "${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${FILE_NAME}.o " >> ${FILE}
|
||||
done
|
||||
echo "" >> ${FILE}; echo "" >> ${FILE}
|
||||
#
|
||||
|
@ -183,12 +182,12 @@ echo "" >> ${FILE}; echo "" >> ${FILE}
|
|||
#
|
||||
echo "# generate the utest binary" >> ${FILE}
|
||||
cat << END >> ${FILE}
|
||||
${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/${APP_NAME} : \$(SRS_UTEST_DEPS) ${MODULE_OBJS} gtest.a
|
||||
${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${APP_NAME} : \$(SRS_UTEST_DEPS) ${MODULE_OBJS} gtest.a
|
||||
\$(CXX) -o \$@ \$(CPPFLAGS) \$(CXXFLAGS) \$^ \$(DEPS_LIBRARIES_FILES) ${LINK_OPTIONS}
|
||||
END
|
||||
|
||||
#####################################################################################
|
||||
# parent Makefile, to create module output dir before compile it.
|
||||
echo " @mkdir -p ${SRS_OBJS_DIR}/utest" >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||
echo " @mkdir -p ${SRS_OBJS}/utest" >> ${SRS_MAKEFILE}
|
||||
|
||||
echo -n "Generate utest ok"; echo '!';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue