updated makefiles
This commit is contained in:
@@ -97,7 +97,7 @@ ifeq ($(ZT_DEBUG),1)
|
||||
STRIP?=echo
|
||||
# The following line enables optimization for the crypto code, since
|
||||
# C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -Werror -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||
else
|
||||
CFLAGS?=-O3 -fstack-protector
|
||||
CFLAGS+=-Wall -Werror -fPIE -fvisibility=hidden -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||
@@ -218,20 +218,15 @@ linux_service_and_intercept: linux_intercept linux_sdk_service
|
||||
|
||||
# Builds a single static library which contains everything
|
||||
linux_static_lib: pico $(OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(STACK_FLAGS) $(DEFS) $(INCLUDES) $(ZTFLAGS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED $(PICO_DRIVER_FILES) $(SDK_INTERCEPT_C_FILES) $(SDK_SERVICE_CPP_FILES) src/service.cpp -c
|
||||
$(CC) $(CFLAGS) $(STACK_FLAGS) $(DEFS) $(INCLUDES) $(ZTFLAGS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED $(SDK_INTERCEPT_C_FILES) -c
|
||||
$(CXX) $(CXXFLAGS) $(STACK_FLAGS) $(DEFS) $(INCLUDES) $(ZTFLAGS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED $(PICO_DRIVER_FILES) $(SDK_SERVICE_CPP_FILES) src/service.cpp -c
|
||||
ar -rcs build/libzt.a picotcp.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o $(OBJS)
|
||||
|
||||
# Builds zts_* library tests
|
||||
linux_static_lib_tests:
|
||||
linux_static_lib_tests_6:
|
||||
mkdir -p $(TEST_OBJDIR)
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.tcpserver4.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.tcpserver4.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.tcpclient4.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.tcpclient4.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.tcpserver6.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.tcpserver6.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.tcpclient6.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.tcpclient6.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.udpserver4.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.udpserver4.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.udpclient4.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.udpclient4.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.udpserver6.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.udpserver6.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.udpclient6.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.udpclient6.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/zts/zts.udpserver6.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.udpserver6.out -Lbuild -lzt -ldl
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/zts/zts.udpclient6.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.udpclient6.out -Lbuild -lzt -ldl
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# --------------------------------- Android ------------------------------------
|
||||
@@ -359,4 +354,4 @@ clean_thorough: clean_basic
|
||||
clean: clean_basic
|
||||
|
||||
clean_for_production:
|
||||
-find . -type f \( -name '*.identity'\) -delete
|
||||
-find . -type f \( -name '*.identity'\) -delete
|
||||
@@ -195,7 +195,6 @@ int (*realclose)(CLOSE_SIG);
|
||||
ssize_t zts_sendto(SENDTO_SIG) // Used as internal implementation
|
||||
#endif
|
||||
{
|
||||
//DEBUG_EXTRA("fd=%d", fd);
|
||||
if(len > ZT_UDP_DEFAULT_PAYLOAD_MTU) {
|
||||
errno = EMSGSIZE; // Msg is too large
|
||||
return -1;
|
||||
@@ -318,17 +317,16 @@ int (*realclose)(CLOSE_SIG);
|
||||
// Read the entire SDK_MTU-sized chunk from the service socket
|
||||
while(total_read < SDK_MTU) {
|
||||
n = read(fd, tmpbuf+total_read, SDK_MTU);
|
||||
if(n>0)
|
||||
|
||||
if(n>0) {
|
||||
total_read += n;
|
||||
else
|
||||
total_socket_rx += n;
|
||||
}
|
||||
else if (n < 0)
|
||||
return n;
|
||||
}
|
||||
|
||||
if(n > 0) {
|
||||
// No matter how much we read from the service, only copy 'read_chunk_sz'
|
||||
// into the app's buffer
|
||||
read_chunk_sz = len < SDK_MTU ? len : SDK_MTU;
|
||||
|
||||
if(n > 0) {
|
||||
// TODO: case for address size mismatch?
|
||||
memcpy(addr, tmpbuf, *addrlen);
|
||||
memcpy(&tmpsz, tmpbuf + sizeof(struct sockaddr_storage), sizeof(tmpsz));
|
||||
@@ -338,6 +336,11 @@ int (*realclose)(CLOSE_SIG);
|
||||
return -1;
|
||||
}
|
||||
payload_offset = sizeof(int) + sizeof(struct sockaddr_storage);
|
||||
|
||||
// No matter how much we read from the service, only copy 'read_chunk_sz'
|
||||
// into the app's buffer
|
||||
read_chunk_sz = len < SDK_MTU ? len : SDK_MTU;
|
||||
read_chunk_sz = tmpsz < read_chunk_sz ? tmpsz : read_chunk_sz; // FIXME
|
||||
memcpy(buf, tmpbuf + payload_offset, read_chunk_sz);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user