mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
simplified the makefiles (#795)
* Move the makefiles towards a clearer arrangement * Break circular make dependancy and start using implicit rules for most compilation * Fix old cmake to compile again after renames
This commit is contained in:
parent
593387fe30
commit
35ec7336a6
|
@ -166,7 +166,7 @@ endif(DEFINED WIN32)
|
||||||
add_executable(edge src/edge.c)
|
add_executable(edge src/edge.c)
|
||||||
target_link_libraries(edge n2n)
|
target_link_libraries(edge n2n)
|
||||||
|
|
||||||
add_executable(supernode src/sn.c)
|
add_executable(supernode src/supernode.c)
|
||||||
target_link_libraries(supernode n2n)
|
target_link_libraries(supernode n2n)
|
||||||
|
|
||||||
add_executable(example_edge_embed_quick_edge_init src/example_edge_embed_quick_edge_init.c)
|
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
|
# Tools
|
||||||
add_executable(n2n-benchmark tools/benchmark.c)
|
add_executable(n2n-benchmark tools/n2n-benchmark.c)
|
||||||
target_link_libraries(n2n-benchmark n2n)
|
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)
|
target_link_libraries(n2n-keygen n2n)
|
||||||
|
|
||||||
if(N2N_OPTION_USE_PCAPLIB)
|
if(N2N_OPTION_USE_PCAPLIB)
|
||||||
find_library(PCAP_LIB pcap)
|
find_library(PCAP_LIB pcap)
|
||||||
if(PCAP_LIB)
|
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)
|
target_link_libraries(n2n-decode n2n pcap)
|
||||||
install(TARGETS n2n-decode RUNTIME DESTINATION bin)
|
install(TARGETS n2n-decode RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
|
|
39
Makefile.in
39
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
|
PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs
|
||||||
|
|
||||||
N2N_OBJS_OPT=
|
N2N_OBJS_OPT=
|
||||||
LIBS_EDGE_OPT=@N2N_LIBS@
|
|
||||||
CFLAGS=@CFLAGS@ -I ./include
|
CFLAGS=@CFLAGS@ -I ./include
|
||||||
LDFLAGS=@LDFLAGS@
|
LDFLAGS=@LDFLAGS@ -L .
|
||||||
|
|
||||||
OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?)
|
OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?)
|
||||||
ifeq ($(OPENSSL_CFLAGS), 0)
|
ifeq ($(OPENSSL_CFLAGS), 0)
|
||||||
|
@ -48,15 +47,14 @@ MAN8DIR=$(MANDIR)/man8
|
||||||
|
|
||||||
N2N_LIB=libn2n.a
|
N2N_LIB=libn2n.a
|
||||||
N2N_OBJS=$(patsubst src/%.c, src/%.o, $(wildcard src/*.c))
|
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)
|
LDLIBS+=-ln2n
|
||||||
LIBS_SN=
|
LDLIBS+=@N2N_LIBS@
|
||||||
|
|
||||||
#For OpenSolaris (Solaris too?)
|
#For OpenSolaris (Solaris too?)
|
||||||
ifeq ($(shell uname), SunOS)
|
ifeq ($(shell uname), SunOS)
|
||||||
LIBS_EDGE+=-lsocket -lnsl
|
LDLIBS+=-lsocket -lnsl
|
||||||
LIBS_SN+=-lsocket -lnsl
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
APPS=edge
|
APPS=edge
|
||||||
|
@ -73,20 +71,20 @@ all: $(APPS) $(DOCS) tools
|
||||||
tools: $(N2N_LIB)
|
tools: $(N2N_LIB)
|
||||||
$(MAKE) -C $@
|
$(MAKE) -C $@
|
||||||
|
|
||||||
edge: src/edge.c $(N2N_LIB) $(N2N_DEPS)
|
src/edge.o: $(N2N_DEPS)
|
||||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@
|
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)
|
src/edge: $(N2N_LIB)
|
||||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_SN) -o $@
|
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)
|
%: src/%
|
||||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@
|
cp $< $@
|
||||||
|
|
||||||
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 $@
|
|
||||||
|
|
||||||
%.gz : %
|
%.gz : %
|
||||||
gzip -c $< > $@
|
gzip -c $< > $@
|
||||||
|
@ -96,7 +94,8 @@ $(N2N_LIB): $(N2N_OBJS)
|
||||||
# $(RANLIB) $@
|
# $(RANLIB) $@
|
||||||
|
|
||||||
clean:
|
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
|
$(MAKE) -C tools clean
|
||||||
|
|
||||||
install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
|
install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
|
||||||
|
|
|
@ -14,13 +14,13 @@ else
|
||||||
SBINDIR=$(PREFIX)/sbin
|
SBINDIR=$(PREFIX)/sbin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS_EDGE_OPT=@N2N_LIBS@
|
LDLIBS+=-ln2n
|
||||||
LIBS_EDGE+=$(LIBS_EDGE_OPT)
|
LDLIBS+=@N2N_LIBS@
|
||||||
HEADERS=$(wildcard include/*.h)
|
HEADERS=$(wildcard include/*.h)
|
||||||
CFLAGS+=-I../include @CFLAGS@
|
CFLAGS+=-I../include @CFLAGS@
|
||||||
LDFLAGS+=-L..
|
LDFLAGS+=-L..
|
||||||
CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN)
|
CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN)
|
||||||
LDFLAGS=@LDFLAGS@
|
LDFLAGS+=@LDFLAGS@
|
||||||
|
|
||||||
N2N_LIB=../libn2n.a
|
N2N_LIB=../libn2n.a
|
||||||
|
|
||||||
|
@ -30,17 +30,12 @@ TOOLS+=@ADDITIONAL_TOOLS@
|
||||||
.PHONY: all clean install
|
.PHONY: all clean install
|
||||||
all: $(TOOLS)
|
all: $(TOOLS)
|
||||||
|
|
||||||
n2n-benchmark: benchmark.c $(N2N_LIB) $(HEADERS)
|
|
||||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@
|
|
||||||
|
|
||||||
n2n-keygen: keygen.c $(N2N_LIB) $(HEADERS)
|
n2n-benchmark.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@
|
n2n-keygen.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||||
|
|
||||||
n2n-decode: n2n_decode.c $(N2N_LIB) $(HEADERS)
|
n2n-decode: n2n-decode.c $(N2N_LIB) $(HEADERS) ../Makefile Makefile
|
||||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -lpcap -o $@
|
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDLIBS) -lpcap -o $@
|
||||||
|
|
||||||
.c.o: $(HEADERS) ../Makefile Makefile
|
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(TOOLS) *.o *.dSYM *~
|
rm -rf $(TOOLS) *.o *.dSYM *~
|
||||||
|
|
Loading…
Reference in New Issue
Block a user