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.
This commit is contained in:
Oliver Schmidt 2018-01-31 13:55:03 +01:00
parent 7703e20cce
commit 5afd68109d
1 changed files with 17 additions and 0 deletions

17
server/Makefile Normal file
View File

@ -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