From 5afd68109d828fbfd681a01ff0434dddaaea64e2 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 31 Jan 2018 13:55:03 +0100 Subject: [PATCH] Added Makefile to build the xHD server. On everything but Windows building xHDServer is so trivial that everything more than a minimal Makefile is inappropriate. On Windows requiring an additional tool (like e.g. CMake) is just another obstacle. However, GNUmake comes with Mingw-w64. In order to optimize the user experience it is desirable to build with a static variant of libserialport. However, doing so requires on Windows in general import libraries for all DLLs referred to by libserialport. For cfgmgr32.lib and setupapi.lib this would require the installation of the Platform SDK. But fortunately the Mingw variant of ld is able to link directly against DLLs instead of import libraries (see https://sourceware.org/binutils/docs-2.17/ld/WIN32.html). The line LDLIBS += -lcfgmgr32 -lsetupapi in the Makefile makes use of that feature. ld even finds the two DLLs in Windows\System32 without further hint. --- server/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 server/Makefile diff --git a/server/Makefile b/server/Makefile new file mode 100644 index 0000000..e12c2f1 --- /dev/null +++ b/server/Makefile @@ -0,0 +1,17 @@ +xHDServer: main.o + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) + +LDLIBS = -lserialport + +ifeq ($(OS),Windows_NT) + +LDLIBS += -lcfgmgr32 -lsetupapi + +CC = gcc +CXX = g++ +CPPFLAGS = -m64 -I win32 +LDFLAGS = -m64 -L win32 + +xHDServer: win32/mmap-win32.o + +endif # Windows_NT