From 83078c8104ae7b0f3069de24909d4e5b55ef5be2 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 5 Jul 2023 20:19:55 +0100 Subject: [PATCH] Simplify win32 build process When building on win32 systems, simply add the win32 specific functions to the libn2n.a, which simplifies the commands needed. By moving the win32 source code into the src directory, the source code is better consolidated. --- Makefile | 26 +++++++------------ include/n2n_typedefs.h | 2 +- {win32 => src/win32}/DotNet/n2n.sln | 0 {win32 => src/win32}/DotNet/n2n.suo | Bin {win32 => src/win32}/DotNet/n2n.vcproj | 0 {win32 => src/win32}/DotNet/supernode.vcproj | 0 {win32 => src/win32}/edge.manifest | 0 {win32 => src/win32}/edge.rc | 0 {win32 => src/win32}/getopt.c | 0 {win32 => src/win32}/getopt.h | 0 {win32 => src/win32}/getopt1.c | 0 {win32 => src/win32}/n2n_win32.h | 0 {win32 => src/win32}/wintap.c | 0 {win32 => src/win32}/wintap.h | 0 tools/Makefile | 3 --- win32/Makefile | 19 -------------- 16 files changed, 10 insertions(+), 40 deletions(-) rename {win32 => src/win32}/DotNet/n2n.sln (100%) rename {win32 => src/win32}/DotNet/n2n.suo (100%) rename {win32 => src/win32}/DotNet/n2n.vcproj (100%) rename {win32 => src/win32}/DotNet/supernode.vcproj (100%) rename {win32 => src/win32}/edge.manifest (100%) rename {win32 => src/win32}/edge.rc (100%) rename {win32 => src/win32}/getopt.c (100%) rename {win32 => src/win32}/getopt.h (100%) rename {win32 => src/win32}/getopt1.c (100%) rename {win32 => src/win32}/n2n_win32.h (100%) rename {win32 => src/win32}/wintap.c (100%) rename {win32 => src/win32}/wintap.h (100%) delete mode 100644 win32/Makefile diff --git a/Makefile b/Makefile index 0d14421..c7f7fab 100644 --- a/Makefile +++ b/Makefile @@ -139,16 +139,8 @@ 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) @@ -189,12 +181,6 @@ version: 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) @@ -208,7 +194,15 @@ 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/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 @@ -226,8 +220,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 diff --git a/include/n2n_typedefs.h b/include/n2n_typedefs.h index 303e1b4..f28ab65 100644 --- a/include/n2n_typedefs.h +++ b/include/n2n_typedefs.h @@ -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__) */ diff --git a/win32/DotNet/n2n.sln b/src/win32/DotNet/n2n.sln similarity index 100% rename from win32/DotNet/n2n.sln rename to src/win32/DotNet/n2n.sln diff --git a/win32/DotNet/n2n.suo b/src/win32/DotNet/n2n.suo similarity index 100% rename from win32/DotNet/n2n.suo rename to src/win32/DotNet/n2n.suo diff --git a/win32/DotNet/n2n.vcproj b/src/win32/DotNet/n2n.vcproj similarity index 100% rename from win32/DotNet/n2n.vcproj rename to src/win32/DotNet/n2n.vcproj diff --git a/win32/DotNet/supernode.vcproj b/src/win32/DotNet/supernode.vcproj similarity index 100% rename from win32/DotNet/supernode.vcproj rename to src/win32/DotNet/supernode.vcproj diff --git a/win32/edge.manifest b/src/win32/edge.manifest similarity index 100% rename from win32/edge.manifest rename to src/win32/edge.manifest diff --git a/win32/edge.rc b/src/win32/edge.rc similarity index 100% rename from win32/edge.rc rename to src/win32/edge.rc diff --git a/win32/getopt.c b/src/win32/getopt.c similarity index 100% rename from win32/getopt.c rename to src/win32/getopt.c diff --git a/win32/getopt.h b/src/win32/getopt.h similarity index 100% rename from win32/getopt.h rename to src/win32/getopt.h diff --git a/win32/getopt1.c b/src/win32/getopt1.c similarity index 100% rename from win32/getopt1.c rename to src/win32/getopt1.c diff --git a/win32/n2n_win32.h b/src/win32/n2n_win32.h similarity index 100% rename from win32/n2n_win32.h rename to src/win32/n2n_win32.h diff --git a/win32/wintap.c b/src/win32/wintap.c similarity index 100% rename from win32/wintap.c rename to src/win32/wintap.c diff --git a/win32/wintap.h b/src/win32/wintap.h similarity index 100% rename from win32/wintap.h rename to src/win32/wintap.h diff --git a/tools/Makefile b/tools/Makefile index 08c4a7e..3a0ba98 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -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.. diff --git a/win32/Makefile b/win32/Makefile deleted file mode 100644 index 832b6bf..0000000 --- a/win32/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# This is not a standalone makefile, it must be called from the toplevel -# makefile to inherit the correct environment - -CFLAGS+=-I../include -I. -LDFLAGS+=-L.. - -.PHONY: all clean install - -all: n2n_win32.a - -n2n_win32.a: getopt1.o getopt.o wintap.o - $(AR) rcs $@ $+ - -clean: - rm -rf n2n_win32.a *.o *.gcno *.gcda - -install: - true