From 4ede1637945ce7fc5fbc6c8c1ca3ce05847b1487 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 2 Oct 2016 04:53:44 +0200 Subject: [PATCH] Fix window build with Makefile the problem is that sdl2-config --libs apparently includes shit that's only useful for the executable, but not dlls, like linking against SDL2main and libmingw32 and setting -mwindows Furthermore I forgot to add -lopengl32 and -shared to the ref_gl Windows LDFLAGS. --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6fee0f06..fbe07eb1 100755 --- a/Makefile +++ b/Makefile @@ -390,7 +390,7 @@ ifeq ($(WITH_SDL2),yes) release/quake2.exe : CFLAGS += -DSDL2 endif -release/quake2.exe : LDFLAGS += -mwindows -lopengl32 +release/quake2.exe : LDFLAGS += -mwindows else # not Windows @@ -530,6 +530,12 @@ ifeq ($(WITH_SDL2),yes) release/ref_gl.dll : CFLAGS += -DSDL2 endif +release/ref_gl.dll : LDFLAGS += -lopengl32 -shared + +# don't want the dll to link against libSDL2main or libmingw32, and no -mwindows either +# that's for the .exe only +DLL_SDLLDFLAGS = $(subst -mwindows,,$(subst -lmingw32,,$(subst -lSDL2main,,$(SDLLDFLAGS)))) + else ifeq ($(OSTYPE), Darwin) ref_gl: @@ -875,7 +881,7 @@ endif ifeq ($(OSTYPE), Windows) release/ref_gl.dll : $(REFGL_OBJS) @echo "===> LD $@" - ${Q}$(CC) $(REFGL_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@ + ${Q}$(CC) $(REFGL_OBJS) $(LDFLAGS) $(DLL_SDLLDFLAGS) -o $@ $(Q)strip $@ else ifeq ($(OSTYPE), Darwin) release/ref_gl.dylib : $(REFGL_OBJS)