Browse Source

Fixed cmake

Minor code cleanup
pull/26/head
Luca Deri 6 years ago
parent
commit
6c611ea306
  1. 8
      CMakeLists.txt
  2. 2
      Makefile
  3. 9
      benchmark.c

8
CMakeLists.txt

@ -28,10 +28,6 @@ endif(NOT DEFINED CMAKE_BUILD_TYPE)
#set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_BUILD_TYPE Release)
#Ultrasparc64 users experiencing SIGBUS should try the following gcc options
#(thanks to Robert Gibbon)
#PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs
# None
set(CMAKE_C_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs")
set(CMAKE_CXX_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs")
@ -51,6 +47,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
add_library(n2n n2n.c
n2n_keyfile.c
edge_utils.c
wire.c
minilzo.c
twofish.c
@ -73,9 +70,6 @@ if(N2N_OPTION_AES)
target_link_libraries(n2n crypto)
endif(N2N_OPTION_AES)
# For Solaris (or OpenSolaris?)
#target_link_libraries(n2n socket nsl)
add_executable(edge edge.c)
target_link_libraries(edge n2n)

2
Makefile

@ -64,7 +64,7 @@ APPS+=example_edge_embed
DOCS=edge.8.gz supernode.1.gz n2n_v2.7.gz
all: $(APPS) $(DOCS)
all: $(APPS) $(DOCS) benchmark
edge: edge.c $(N2N_LIB) n2n_wire.h n2n.h Makefile
$(CC) $(CFLAGS) edge.c $(N2N_LIB) $(LIBS_EDGE) -o edge

9
benchmark.c

@ -46,8 +46,7 @@ uint8_t PKT_CONTENT[]={
/* Prototypes */
static ssize_t do_encode_packet( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c );
int main( int argc, char * argv[] )
{
int main(int argc, char * argv[]) {
uint8_t pktbuf[N2N_PKT_BUF_SIZE];
n2n_trans_op_t transop_null;
@ -95,7 +94,11 @@ int main( int argc, char * argv[] )
tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec);
fprintf( stderr, "\nrun %u times. (%u -> %u nsec each) %u.%06u -> %u.%06u.\n", i, tdiff, (tdiff *1000)/i, (uint32_t)t1.tv_sec, (uint32_t)t1.tv_usec, (uint32_t)t2.tv_sec, (uint32_t)t2.tv_usec );
fprintf( stderr, "\nrun %u times. (%u -> %u nsec each) %u.%06u -> %u.%06u.\n",
(unsigned int)i, (unsigned int)tdiff,
(unsigned int)((tdiff *1000)/i),
(uint32_t)t1.tv_sec, (uint32_t)t1.tv_usec,
(uint32_t)t2.tv_sec, (uint32_t)t2.tv_usec );
return 0;
}

Loading…
Cancel
Save