diff --git a/Makefile b/Makefile index 1c904f8a..b64d8859 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ export AR export EXE export CFLAGS export LDFLAGS -export LDLIBS +export LDLIBS_EXTRA export CONFIG_HOST_OS -include config.mak @@ -98,8 +98,6 @@ N2N_OBJS=\ src/tuntap_osx.o \ src/wire.o \ -N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) config.mak - # As source files pass the linter, they can be added here (If all the source # is passing the linter tests, this can be refactored) LINT_CCODE=\ @@ -112,9 +110,6 @@ LINT_CCODE=\ # TODO: change either the files or the linter to remove these failures LINT_EXCLUDE=include/uthash.h|include/lzodefs.h|src/minilzo.c -LDLIBS+=-ln3n -LDLIBS+=$(LDLIBS_EXTRA) - DOCS=edge.8.gz supernode.1.gz n3n.7.gz # This is the list of Debian/Ubuntu packages that are needed during the build. @@ -249,12 +244,11 @@ distclean: rm -f packages/rpm/config.log packages/rpm/config.status .PHONY: install -install: apps/edge$(EXE) apps/supernode$(EXE) edge.8.gz supernode.1.gz n3n.7.gz +install: apps tools edge.8.gz supernode.1.gz n3n.7.gz echo "MANDIR=$(MANDIR)" $(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR) - $(INSTALL_PROG) apps/supernode$(EXE) $(SBINDIR)/ - $(INSTALL_PROG) apps/edge$(EXE) $(SBINDIR)/ + $(MAKE) -C apps install SBINDIR=$(abspath $(SBINDIR)) + $(MAKE) -C tools install SBINDIR=$(abspath $(SBINDIR)) $(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ $(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ $(INSTALL_DOC) n3n.7.gz $(MAN7DIR)/ - $(MAKE) -C tools install SBINDIR=$(abspath $(SBINDIR)) diff --git a/apps/Makefile b/apps/Makefile index 9bad099f..1a2189ae 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -19,10 +19,17 @@ EXAMPLES+=example_edge_embed_quick_edge_init EXAMPLES+=example_edge_embed EXAMPLES+=example_sn_embed -all: $(APPS) $(EXAMPLES) - CFLAGS+=-I$(INCDIR) LDFLAGS+=-L$(LIBDIR) +LDLIBS+=-ln3n +LDLIBS+=$(LDLIBS_EXTRA) + +all: $(APPS) $(EXAMPLES) + +.PHONY: install +install: $(addsuffix $(EXE),$APPS) + $(INSTALL_PROG) supernode$(EXE) $(SBINDIR)/ + $(INSTALL_PROG) edge$(EXE) $(SBINDIR)/ clean: rm -f $(APPS) $(EXAMPLES) diff --git a/tools/Makefile b/tools/Makefile index 5aa120b4..b28b46ed 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -4,51 +4,29 @@ DEBUG?=-g3 -HEADERS=$(wildcard include/*.h) -CFLAGS+=-I../include - CFLAGS+=$(DEBUG) -LDFLAGS+=-L.. - -N2N_LIB=../libn3n.a -TOOLS+=n3n-benchmark$(EXE) -TOOLS+=n3n-keygen$(EXE) -TOOLS+=n3n-route$(EXE) -TOOLS+=n3n-portfwd$(EXE) -TOOLS+=n3n-decode$(EXE) - -TESTS=tests-compress$(EXE) -TESTS+=tests-elliptic$(EXE) -TESTS+=tests-hashing$(EXE) -TESTS+=tests-transform$(EXE) -TESTS+=tests-wire$(EXE) -TESTS+=tests-auth$(EXE) +CFLAGS+=-I../include +LDFLAGS+=-L.. +LDLIBS+=-ln3n +LDLIBS+=$(LDLIBS_EXTRA) + +TOOLS+=n3n-benchmark +TOOLS+=n3n-keygen +TOOLS+=n3n-route +TOOLS+=n3n-portfwd +TOOLS+=n3n-decode + +TESTS=tests-compress +TESTS+=tests-elliptic +TESTS+=tests-hashing +TESTS+=tests-transform +TESTS+=tests-wire +TESTS+=tests-auth .PHONY: all clean install all: $(TOOLS) $(TESTS) -n3n-benchmark.o: $(N2N_LIB) $(HEADERS) ../config.mak -n3n-keygen.o: $(N2N_LIB) $(HEADERS) ../config.mak -n3n-route.o: $(N2N_LIB) $(HEADERS) ../config.mak -n3n-portfwd.o: $(N2N_LIB) $(HEADERS) ../config.mak -n3n-decode.o: $(N2N_LIB) $(HEADERS) ../config.mak - -ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) -# HACK for windows. -n3n-benchmark.exe: n3n-benchmark -n3n-keygen.exe: n3n-keygen -n3n-route.exe: n3n-route -n3n-portfwd.exe: n3n-portfwd -n3n-decode.exe: n3n-decode -tests-compress.exe: tests-compress -tests-elliptic.exe: tests-elliptic -tests-hashing.exe: tests-hashing -tests-transform.exe: tests-transform -tests-wire.exe: tests-wire -tests-auth.exe: tests-auth -endif - # See comments in the topdir Makefile about how to generate coverage # data. gcov: @@ -59,4 +37,4 @@ clean: rm -f $(TESTS) *.gcno *.gcda install: $(TOOLS) - $(INSTALL_PROG) $(TOOLS) $(SBINDIR)/ + $(INSTALL_PROG) $(addsuffix $(EXE),$(TOOLS)) $(SBINDIR)/