better makefile

This commit is contained in:
wangyu 2017-08-13 02:14:50 +08:00
parent 00a3955de0
commit 2af94823e3
3 changed files with 34 additions and 26 deletions

View File

@ -1155,7 +1155,7 @@ int client_on_timer(conn_info_t &conn_info) //for client
{ {
conn_info.state.client_current_state=client_idle; conn_info.state.client_current_state=client_idle;
conn_info.my_id=get_true_random_number_nz(); conn_info.my_id=get_true_random_number_nz();
mylog(log_info,"state back to client_idle from client_ready bc of recv-direction timeout\n"); mylog(log_info,"state back to client_idle from client_ready bc of server-->client direction timeout\n");
return 0; return 0;
} }
@ -1168,7 +1168,7 @@ int client_on_timer(conn_info_t &conn_info) //for client
{ {
conn_info.state.client_current_state=client_idle; conn_info.state.client_current_state=client_idle;
conn_info.my_id=get_true_random_number_nz(); conn_info.my_id=get_true_random_number_nz();
mylog(log_info,"state back to client_idle from client_ready bc of send-direction timeout\n"); mylog(log_info,"state back to client_idle from client_ready bc of client-->server direction timeout\n");
} }
mylog(log_debug,"heartbeat sent <%x,%x>\n",conn_info.oppsite_id,conn_info.my_id); mylog(log_debug,"heartbeat sent <%x,%x>\n",conn_info.oppsite_id,conn_info.my_id);

View File

@ -1,29 +1,37 @@
cc_cross=/home/wangyu/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++ cc_cross=/home/wangyu/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++
FLAGS=-Wall -Wextra -Wno-unused-variable -Wno-unused-parameter cc_local=g++
FLAGS2= -O3 cc_ar71xx=/home/wangyu/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++
cc_bcm2708=/home/wangyu/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
FLAGS= -std=c++11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter
SOURCES=main.cpp lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp
TAR=udp2raw_binaries.tar.gz udp2raw_amd64 udp2raw_x86 udp2raw_ar71xx udp2raw_bcm2708
all: all:
sudo killall udp2raw||true rm -f udp2raw
sleep 0.2 ${cc_local} -o udp2raw -I. ${SOURCES} ${FLAGS} -lrt -static -O3
g++ main.cpp -o udp2raw -static -ggdb -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -lrt -std=c++11 ${FLAGS} ${FLAGS2}
# ${ccmips} main.cpp -o udp2raw_ar71xx -lrt -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -std=c++11 ${FLAGS} ${FLAGS2}
fast: fast:
sudo killall udp2raw||true rm -f udp2raw
sleep 0.2 ${cc_local} -o udp2raw -I. ${SOURCES} ${FLAGS} -lrt
g++ main.cpp -o udp2raw -ggdb -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -lrt -std=c++11 ${FLAGS}
debug: debug:
g++ main.cpp -o udp2raw -static -ggdb -I. -Ilib lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -lrt -std=c++11 ${FLAGS} -Wformat-nonliteral -D MY_DEBUG rm -f udp2raw
${cc_local} -o udp2raw -I. ${SOURCES} ${FLAGS} -lrt -Wformat-nonliteral -D MY_DEBUG
ar71xx:
${cc_ar71xx} -o udp2raw_ar71xx -I. ${SOURCES} ${FLAGS} -lrt -lgcc_eh -static -O3
bcm2708:
${cc_bcm2708} -o udp2raw_bcm2708 -I. ${SOURCES} ${FLAGS} -lrt -static -O3
cross: cross:
${cc_cross} main.cpp -o udp2raw_ar71xx -lrt -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -std=c++11 ${FLAGS} ${FLAGS2} ${cc_cross} -o udp2raw_cross -I. ${SOURCES} ${FLAGS} -lrt -static -lgcc_eh -O3
cross2: cross2:
${cc_cross} main.cpp -o udp2raw_ar71xx -lrt -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -std=c++11 ${FLAGS} -static -lgcc_eh -O3 ${cc_cross} -o udp2raw_cross -I. ${SOURCES} ${FLAGS} -lrt -O3
cross3:
${cc_cross} main.cpp -o udp2raw_ar71xx -lrt -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -std=c++11 ${FLAGS} -static -lgcc_eh
release: release: ar71xx bcm2708
g++ main.cpp -o udp2raw_amd64 -static -ggdb -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -lrt -std=c++11 ${FLAGS} ${FLAGS2} ${cc_local} -o udp2raw_amd64 -I. ${SOURCES} ${FLAGS} -lrt -static -O3
g++ main.cpp -o udp2raw_x86 -static -ggdb -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -lrt -std=c++11 ${FLAGS} ${FLAGS2} -m32 ${cc_local} -o udp2raw_x86 -I. ${SOURCES} ${FLAGS} -lrt -m32 -static -O3
${cc_cross} main.cpp -o udp2raw_ar71xx -lrt -I. lib/aes.c lib/md5.c encrypt.cpp log.cpp network.cpp common.cpp -std=c++11 ${FLAGS} -static -lgcc_eh -O3 tar -zcvf ${TAR}
tar -zcvf udp2raw_binaries.tar.gz udp2raw_amd64 udp2raw_x86 udp2raw_ar71xx
clean:
rm -f ${TAR}

View File

@ -987,7 +987,7 @@ int recv_raw_udp(raw_info_t &raw_info, char *&payload, int &payloadlen)
} }
udphdr *udph=(struct udphdr*)ip_payload; udphdr *udph=(struct udphdr*)ip_payload;
if(ntohs(udph->len)!=ip_payloadlen) if(int(ntohs(udph->len))!=ip_payloadlen)
{ {
mylog(log_debug,"udp length error %d %d \n",ntohs(udph->len),ip_payloadlen); mylog(log_debug,"udp length error %d %d \n",ntohs(udph->len),ip_payloadlen);