112 lines
4.4 KiB
Makefile
Raw Normal View History

2017-09-10 04:04:07 -05:00
cc_cross=/home/wangyu/Desktop/arm-2014.05/bin/arm-none-linux-gnueabi-g++
2017-08-13 10:35:14 +08:00
cc_local=g++
2017-09-10 04:04:07 -05:00
cc_mips24kc_be=/toolchains/lede-sdk-17.01.2-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl-1.1.16/bin/mips-openwrt-linux-musl-g++
cc_mips24kc_le=/toolchains/lede-sdk-17.01.2-ramips-mt7621_gcc-5.4.0_musl-1.1.16.Linux-x86_64/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/bin/mipsel-openwrt-linux-musl-g++
cc_arm= /toolchains/arm-2014.05/bin/arm-none-linux-gnueabi-g++
2020-07-13 12:51:49 -04:00
cc_mingw_cross=i686-w64-mingw32-g++-posix
cc_mac_cross=o64-clang++ -stdlib=libc++ -std=c++11
2017-09-10 04:04:07 -05:00
#cc_bcm2708=/home/wangyu/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
2020-07-13 12:51:49 -04:00
2018-08-08 04:05:42 -05:00
FLAGS= -std=c++11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers ${OPT}
2017-09-10 04:04:07 -05:00
2020-07-13 12:51:49 -04:00
SOURCES0=main.cpp log.cpp common.cpp lib/fec.cpp lib/rs.cpp packet.cpp delay_manager.cpp fd_manager.cpp connection.cpp fec_manager.cpp misc.cpp tunnel_client.cpp tunnel_server.cpp
SOURCES=${SOURCES0} my_ev.cpp -isystem libev
2017-09-10 04:04:07 -05:00
NAME=speederv2
2020-07-13 12:51:49 -04:00
2017-09-10 04:04:07 -05:00
TARGETS=amd64 arm mips24kc_be x86 mips24kc_le
2017-08-13 10:35:14 +08:00
2020-07-13 12:51:49 -04:00
TAR=${NAME}_binaries.tar.gz `echo ${TARGETS}|sed -r 's/([^ ]+)/${NAME}_\1/g'` version.txt
2017-09-10 04:04:07 -05:00
2020-07-13 12:51:49 -04:00
# targets for nativei (non-cross) compile
2017-09-10 04:04:07 -05:00
all:git_version
2017-08-13 10:35:14 +08:00
rm -f ${NAME}
2020-07-13 12:51:49 -04:00
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -lrt -ggdb -static -O2
2018-06-23 07:51:36 +00:00
freebsd:git_version
rm -f ${NAME}
2020-07-13 12:51:49 -04:00
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -lrt -ggdb -static -O2
2018-06-03 20:39:31 -07:00
2018-06-19 18:06:28 +08:00
mingw:git_version
rm -f ${NAME}
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -ggdb -static -O2 -lws2_32
2020-07-13 12:51:49 -04:00
mingw_wepoll:git_version #to compile you need a pacthed version of libev with wepoll backend
rm -f ${NAME}
${cc_local} -o ${NAME} -I. ${SOURCES0} ${FLAGS} -ggdb -static -O2 -DNO_LIBEV_EMBED -D_WIN32 -lev -lws2_32
2018-06-03 20:39:31 -07:00
mac:git_version
rm -f ${NAME}
2020-07-13 12:51:49 -04:00
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -ggdb -O2
cygwin:git_version
rm -f ${NAME}
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -lrt -ggdb -static -O2 -D_GNU_SOURCE
#targes for general cross compile
2018-06-03 20:39:31 -07:00
2020-07-13 12:51:49 -04:00
cross:git_version
${cc_cross} -o ${NAME}_cross -I. ${SOURCES} ${FLAGS} -lrt -O2
cross2:git_version
${cc_cross} -o ${NAME}_cross -I. ${SOURCES} ${FLAGS} -lrt -static -lgcc_eh -O2
cross3:git_version
${cc_cross} -o ${NAME}_cross -I. ${SOURCES} ${FLAGS} -lrt -static -O2
#targets only for debug purpose
fast: git_version
rm -f ${NAME}
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -lrt -ggdb
2017-09-10 04:04:07 -05:00
debug: git_version
2017-08-13 10:35:14 +08:00
rm -f ${NAME}
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -lrt -Wformat-nonliteral -D MY_DEBUG
2017-09-10 04:04:07 -05:00
debug2: git_version
rm -f ${NAME}
${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -lrt -Wformat-nonliteral -ggdb
2017-08-13 10:35:14 +08:00
2020-07-13 12:51:49 -04:00
#targets only for cross compile windows targets on linux
2017-09-10 04:04:07 -05:00
2020-07-13 12:51:49 -04:00
mingw_cross:git_version #to build this and the below one you need 'mingw-w64' installed (the cross compile version on linux)
rm -f ${NAME}
${cc_mingw_cross} -o ${NAME}.exe -I. ${SOURCES} ${FLAGS} -ggdb -static -O2 -lws2_32
2020-07-13 12:51:49 -04:00
mingw_cross_wepoll:git_version #to compile you need a pacthed version of libev with wepoll backend installed
rm -f ${NAME}
${cc_mingw_cross} -o ${NAME}_wepoll.exe -I. ${SOURCES0} ${FLAGS} -ggdb -static -O2 -DNO_LIBEV_EMBED -D_WIN32 -lev -lws2_32
2017-09-10 04:04:07 -05:00
2020-07-13 12:51:49 -04:00
#targets only for cross compile macos targets on linux
2017-09-10 04:04:07 -05:00
2020-07-13 12:51:49 -04:00
mac_cross:git_version #need to install 'osxcross' first.
rm -f ${NAME}
${cc_mac_cross} -o ${NAME}_mac -I. ${SOURCES} ${FLAGS} -ggdb -O2
2020-07-13 12:51:49 -04:00
#targets only for 'make release'
2017-08-09 17:15:35 +08:00
2020-07-13 12:51:49 -04:00
mips24kc_be: git_version
${cc_mips24kc_be} -o ${NAME}_$@ -I. ${SOURCES} ${FLAGS} -lrt -lgcc_eh -static -O2
mips24kc_le: git_version
${cc_mips24kc_le} -o ${NAME}_$@ -I. ${SOURCES} ${FLAGS} -lrt -lgcc_eh -static -O2
amd64:git_version
${cc_local} -o ${NAME}_$@ -I. ${SOURCES} ${FLAGS} -lrt -static -O2
x86:git_version #to build this you need 'g++-multilib' installed
${cc_local} -o ${NAME}_$@ -I. ${SOURCES} ${FLAGS} -lrt -static -O2 -m32
arm:git_version
${cc_arm} -o ${NAME}_$@ -I. ${SOURCES} ${FLAGS} -lrt -static -O2 -ggdb
2017-08-13 10:35:14 +08:00
2020-07-13 12:51:49 -04:00
release: ${TARGETS}
2017-11-08 03:38:23 -06:00
cp git_version.h version.txt
2017-08-13 10:35:14 +08:00
tar -zcvf ${TAR}
2017-08-08 17:10:38 +08:00
2017-08-13 10:35:14 +08:00
clean:
rm -f ${TAR}
2020-07-13 12:51:49 -04:00
rm -f ${NAME} ${NAME}_cross ${NAME}.exe ${NAME}_wepoll.exe ${NAME}_mac
2017-09-10 04:04:07 -05:00
rm -f git_version.h
git_version:
2020-07-13 12:51:49 -04:00
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > git_version.h