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.
This commit is contained in:
Daniel Gibson 2016-10-02 04:53:44 +02:00
parent 7f27c549a8
commit 4ede163794
1 changed files with 8 additions and 2 deletions

View File

@ -390,7 +390,7 @@ ifeq ($(WITH_SDL2),yes)
release/quake2.exe : CFLAGS += -DSDL2 release/quake2.exe : CFLAGS += -DSDL2
endif endif
release/quake2.exe : LDFLAGS += -mwindows -lopengl32 release/quake2.exe : LDFLAGS += -mwindows
else # not Windows else # not Windows
@ -530,6 +530,12 @@ ifeq ($(WITH_SDL2),yes)
release/ref_gl.dll : CFLAGS += -DSDL2 release/ref_gl.dll : CFLAGS += -DSDL2
endif 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) else ifeq ($(OSTYPE), Darwin)
ref_gl: ref_gl:
@ -875,7 +881,7 @@ endif
ifeq ($(OSTYPE), Windows) ifeq ($(OSTYPE), Windows)
release/ref_gl.dll : $(REFGL_OBJS) release/ref_gl.dll : $(REFGL_OBJS)
@echo "===> LD $@" @echo "===> LD $@"
${Q}$(CC) $(REFGL_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@ ${Q}$(CC) $(REFGL_OBJS) $(LDFLAGS) $(DLL_SDLLDFLAGS) -o $@
$(Q)strip $@ $(Q)strip $@
else ifeq ($(OSTYPE), Darwin) else ifeq ($(OSTYPE), Darwin)
release/ref_gl.dylib : $(REFGL_OBJS) release/ref_gl.dylib : $(REFGL_OBJS)