Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build improvements #1141

Merged
merged 3 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 16 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ N2N_OBJS=\
src/curve25519.o \
src/edge_management.o \
src/edge_utils.o \
src/edge_utils_win32.o \
src/header_encryption.o \
src/hexdump.o \
src/json.o \
Expand Down Expand Up @@ -103,8 +102,8 @@ 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=\
examples/example_edge_embed_quick_edge_init.c \
include/curve25519.h \
include/edge_utils_win32.h \
include/header_encryption.h \
include/hexdump.h \
include/n2n_define.h \
Expand All @@ -116,8 +115,6 @@ LINT_CCODE=\
include/speck.h \
include/tf.h \
src/edge_management.c \
src/edge_utils_win32.c \
src/example_edge_embed_quick_edge_init.c \
src/header_encryption.c \
src/management.c \
src/management.h \
Expand All @@ -130,6 +127,8 @@ LINT_CCODE=\
src/tuntap_linux.c \
src/tuntap_netbsd.c \
src/tuntap_osx.c \
src/win32/edge_utils_win32.c \
src/win32/edge_utils_win32.h \
src/wire.c \
tools/tests-auth.c \
tools/tests-compress.c \
Expand All @@ -139,21 +138,10 @@ LINT_CCODE=\
tools/tests-wire.c \

LDLIBS+=-ln2n
ifneq (,$(findstring mingw,$(CONFIG_HOST_OS)))
LDLIBS+=$(abspath win32/n2n_win32.a)
endif
LDLIBS+=$(LDLIBS_EXTRA)

ifneq (,$(findstring mingw,$(CONFIG_HOST_OS)))
N2N_DEPS+=win32/n2n_win32.a
SUBDIRS+=win32
endif

APPS=edge$(EXE)
APPS+=supernode$(EXE)
APPS+=example_edge_embed_quick_edge_init$(EXE)
APPS+=example_edge_embed$(EXE)
APPS+=example_sn_embed$(EXE)

DOCS=edge.8.gz supernode.1.gz n2n.7.gz

Expand All @@ -171,6 +159,7 @@ BUILD_DEP:=\
yamllint \

SUBDIRS+=tools
SUBDIRS+=examples

COVERAGEDIR?=coverage

Expand All @@ -186,34 +175,28 @@ version:
@echo -n "Build for version: "
@scripts/version.sh

tools: $(N2N_LIB)
examples tools: $(N2N_LIB)
$(MAKE) -C $@

win32:
$(MAKE) -C $@

win32/edge_rc.o: win32/edge.rc win32/edge.manifest
$(WINDRES) win32/edge.rc -O coff -o win32/edge_rc.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)

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)

ifneq (,$(findstring mingw,$(CONFIG_HOST_OS)))
src/edge: win32/edge_rc.o
N2N_OBJS+=src/win32/edge_utils_win32.o
N2N_OBJS+=src/win32/getopt1.o
N2N_OBJS+=src/win32/getopt.o
N2N_OBJS+=src/win32/wintap.o

src/win32/edge.rc: src/win32/edge.manifest
src/win32/edge_rc.o: src/win32/edge.rc
$(WINDRES) $< -O coff -o $@

src/edge: src/win32/edge_rc.o
src/edge.exe: src/edge
src/supernode.exe: src/supernode
src/example_edge_embed_quick_edge_init.exe: src/example_edge_embed_quick_edge_init
src/example_sn_embed.exe: src/example_sn_embed
src/example_edge_embed.exe: src/example_edge_embed
endif

%: src/%
Expand All @@ -226,8 +209,6 @@ $(N2N_LIB): $(N2N_OBJS)
$(AR) rcs $(N2N_LIB) $(N2N_OBJS)
# $(RANLIB) $@

win32/n2n_win32.a: win32

.PHONY: test test.units test.integration
test: test.units test.integration

Expand Down Expand Up @@ -289,7 +270,7 @@ build-dep-brew:

.PHONY: clean
clean:
rm -f src/edge.o src/supernode.o src/example_edge_embed.o src/example_edge_embed_quick_edge_init.o src/example_sn_embed.o
rm -f src/edge.o src/supernode.o
rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) $(COVERAGEDIR)/ *.dSYM *~
rm -f tests/*.out src/*.gcno src/*.gcda
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done
Expand Down
20 changes: 20 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# These examples are intended to show how to use the libn2n as an embedded
# service within other software.
#

EXAMPLES+=example_edge_embed_quick_edge_init
EXAMPLES+=example_edge_embed
EXAMPLES+=example_sn_embed

all: $(EXAMPLES)

CFLAGS+=-I../include
LDFLAGS+=-L../

example_edge_embed_quick_edge_init: ../libn2n.a
example_sn_embed: ../libn2n.a
example_edge_embed: ../libn2n.a

clean:
rm -f $(EXAMPLES)
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion include/n2n_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typedef int ssize_t;

typedef unsigned long in_addr_t;

#include "../win32/n2n_win32.h"
#include "../src/win32/n2n_win32.h"
// FIXME - continue untangling the build and includes - dont have a ".." here

#endif /* #if defined(_MSC_VER) || defined(__MINGW32__) */
Expand Down
2 changes: 1 addition & 1 deletion src/edge_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include "edge_utils_win32.h"
#include "win32/edge_utils_win32.h"
#else
#include <arpa/inet.h> // for inet_ntoa, inet_addr, inet_ntop
#include <netinet/in.h> // for sockaddr_in, ntohl, IPPROTO_IP
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions src/edge_utils_win32.c → src/win32/edge_utils_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*
*/

#ifdef _WIN32

#include <winsock2.h>

#include "edge_utils_win32.h"
Expand Down Expand Up @@ -107,7 +105,3 @@ int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t *ip_addr){
}
return 0;
}


#endif

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ DEBUG?=-g3
HEADERS=$(wildcard include/*.h)
CFLAGS+=-I../include

ifneq (,$(findstring mingw,$(CONFIG_HOST_OS)))
CFLAGS+=-I../win32
endif
CFLAGS+=$(DEBUG)
LDFLAGS+=-L..

Expand Down
19 changes: 0 additions & 19 deletions win32/Makefile

This file was deleted.

Loading