diff --git a/CMakeLists.txt b/CMakeLists.txt index 36344a6..bd63b74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,7 +166,7 @@ endif(DEFINED WIN32) add_executable(edge src/edge.c) target_link_libraries(edge n2n) -add_executable(supernode src/sn.c) +add_executable(supernode src/supernode.c) target_link_libraries(supernode n2n) add_executable(example_edge_embed_quick_edge_init src/example_edge_embed_quick_edge_init.c) @@ -196,15 +196,15 @@ install(TARGETS edge supernode # Tools -add_executable(n2n-benchmark tools/benchmark.c) +add_executable(n2n-benchmark tools/n2n-benchmark.c) target_link_libraries(n2n-benchmark n2n) -add_executable(n2n-keygen tools/keygen.c) +add_executable(n2n-keygen tools/n2n-keygen.c) target_link_libraries(n2n-keygen n2n) if(N2N_OPTION_USE_PCAPLIB) find_library(PCAP_LIB pcap) if(PCAP_LIB) - add_executable(n2n-decode tools/n2n_decode.c) + add_executable(n2n-decode tools/n2n-decode.c) target_link_libraries(n2n-decode n2n pcap) install(TARGETS n2n-decode RUNTIME DESTINATION bin) diff --git a/Makefile.in b/Makefile.in index 0df2cad..df60bb0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,9 +13,8 @@ AR=@AR@ PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs N2N_OBJS_OPT= -LIBS_EDGE_OPT=@N2N_LIBS@ CFLAGS=@CFLAGS@ -I ./include -LDFLAGS=@LDFLAGS@ +LDFLAGS=@LDFLAGS@ -L . OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?) ifeq ($(OPENSSL_CFLAGS), 0) @@ -48,15 +47,14 @@ MAN8DIR=$(MANDIR)/man8 N2N_LIB=libn2n.a N2N_OBJS=$(patsubst src/%.c, src/%.o, $(wildcard src/*.c)) -N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) Makefile $(N2N_LIB) +N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) Makefile -LIBS_EDGE+=$(LIBS_EDGE_OPT) -LIBS_SN= +LDLIBS+=-ln2n +LDLIBS+=@N2N_LIBS@ #For OpenSolaris (Solaris too?) ifeq ($(shell uname), SunOS) -LIBS_EDGE+=-lsocket -lnsl -LIBS_SN+=-lsocket -lnsl +LDLIBS+=-lsocket -lnsl endif APPS=edge @@ -73,20 +71,20 @@ all: $(APPS) $(DOCS) tools tools: $(N2N_LIB) $(MAKE) -C $@ -edge: src/edge.c $(N2N_LIB) $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ +src/edge.o: $(N2N_DEPS) +src/supernode.o: $(N2N_DEPS) +src/example_edge_embed_quick_edge_init.o: $(N2N_DEPS) +src/example_sn_embed.o: $(N2N_DEPS) +src/example_edge_embed.o: $(N2N_DEPS) -supernode: src/sn.c $(N2N_LIB) $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_SN) -o $@ +src/edge: $(N2N_LIB) +src/supernode: $(N2N_LIB) +src/example_edge_embed_quick_edge_init: $(N2N_LIB) +src/example_sn_embed: $(N2N_LIB) +src/example_edge_embed: $(N2N_LIB) -example_edge_embed_quick_edge_init: src/example_edge_embed_quick_edge_init.c $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ - -example_sn_embed: src/example_sn_embed.c $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ - -example_edge_embed: src/example_edge_embed.c $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ +%: src/% + cp $< $@ %.gz : % gzip -c $< > $@ @@ -96,7 +94,8 @@ $(N2N_LIB): $(N2N_OBJS) # $(RANLIB) $@ clean: - rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) test n2n-decode *.dSYM *~ + rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) test *.dSYM *~ + -rm src/*.gcno src/*.gcda $(MAKE) -C tools clean install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz diff --git a/src/sn.c b/src/supernode.c similarity index 100% rename from src/sn.c rename to src/supernode.c diff --git a/tools/Makefile.in b/tools/Makefile.in index 70c3139..78a5d2d 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -14,13 +14,13 @@ else SBINDIR=$(PREFIX)/sbin endif -LIBS_EDGE_OPT=@N2N_LIBS@ -LIBS_EDGE+=$(LIBS_EDGE_OPT) +LDLIBS+=-ln2n +LDLIBS+=@N2N_LIBS@ HEADERS=$(wildcard include/*.h) CFLAGS+=-I../include @CFLAGS@ LDFLAGS+=-L.. CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN) -LDFLAGS=@LDFLAGS@ +LDFLAGS+=@LDFLAGS@ N2N_LIB=../libn2n.a @@ -30,17 +30,12 @@ TOOLS+=@ADDITIONAL_TOOLS@ .PHONY: all clean install all: $(TOOLS) -n2n-benchmark: benchmark.c $(N2N_LIB) $(HEADERS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ -n2n-keygen: keygen.c $(N2N_LIB) $(HEADERS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ +n2n-benchmark.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile +n2n-keygen.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile -n2n-decode: n2n_decode.c $(N2N_LIB) $(HEADERS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -lpcap -o $@ - -.c.o: $(HEADERS) ../Makefile Makefile - $(CC) $(CFLAGS) -c $< -o $@ +n2n-decode: n2n-decode.c $(N2N_LIB) $(HEADERS) ../Makefile Makefile + $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDLIBS) -lpcap -o $@ clean: rm -rf $(TOOLS) *.o *.dSYM *~ diff --git a/tools/benchmark.c b/tools/n2n-benchmark.c similarity index 100% rename from tools/benchmark.c rename to tools/n2n-benchmark.c diff --git a/tools/n2n_decode.c b/tools/n2n-decode.c similarity index 100% rename from tools/n2n_decode.c rename to tools/n2n-decode.c diff --git a/tools/keygen.c b/tools/n2n-keygen.c similarity index 100% rename from tools/keygen.c rename to tools/n2n-keygen.c