From 0ac96d68f0de33261676f620c324eb8b4695ba50 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Thu, 17 Sep 2020 05:18:02 +0000 Subject: [PATCH] makefile: Support statically linking SDL2 on all platforms git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12926 d7cf8633-e32d-0410-b094-e92efae38249 --- makefile | 12 ++++++++++++ makefile.inc | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index d5bfc55f..46aa0107 100644 --- a/makefile +++ b/makefile @@ -101,6 +101,7 @@ ifeq ($(DP_MAKE_TARGET), linux) EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ) EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ) + DP_LINK_SDL?=shared DP_LINK_ZLIB?=shared DP_LINK_JPEG?=shared DP_LINK_ODE?=dlopen @@ -130,6 +131,7 @@ ifeq ($(DP_MAKE_TARGET), macosx) CFLAGS_MAKEDEP= endif + DP_LINK_SDL?=shared DP_LINK_ZLIB?=shared DP_LINK_JPEG?=dlopen DP_LINK_ODE?=dlopen @@ -165,6 +167,7 @@ ifeq ($(DP_MAKE_TARGET), sunos) EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ) EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ) + DP_LINK_SDL?=shared DP_LINK_ZLIB?=shared DP_LINK_JPEG?=shared DP_LINK_ODE?=dlopen @@ -191,6 +194,7 @@ ifeq ($(DP_MAKE_TARGET), bsd) EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ) EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ) + DP_LINK_SDL?=shared DP_LINK_ZLIB?=shared DP_LINK_JPEG?=shared DP_LINK_ODE?=dlopen @@ -236,6 +240,7 @@ ifeq ($(DP_MAKE_TARGET), mingw) EXE_SVNEXUIZ=$(EXE_WINSVNEXUIZ) EXE_SDLNEXUIZ=$(EXE_WINSDLNEXUIZ) + DP_LINK_SDL?=shared DP_LINK_ZLIB?=dlopen DP_LINK_JPEG?=shared DP_LINK_ODE?=dlopen @@ -246,6 +251,13 @@ endif # set these to "" if you want to use dynamic loading instead # zlib +ifeq ($(DP_LINK_SDL), shared) + SDL_LIBS=$(SDLCONFIG_LIBS) +endif +ifeq ($(DP_LINK_SDL), static) + SDL_LIBS=$(SDLCONFIG_STATICLIBS) +endif + ifeq ($(DP_LINK_ZLIB), shared) CFLAGS_LIBZ=-DLINK_TO_ZLIB LIB_Z=-lz diff --git a/makefile.inc b/makefile.inc index 51b64d15..20c6ec3c 100644 --- a/makefile.inc +++ b/makefile.inc @@ -241,7 +241,7 @@ LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lxmp CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD -LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) #-lGLESv2 +LDFLAGS_UNIXSDL=$(SDL_LIBS) #-lGLESv2 EXE_UNIXSV=darkplaces-dedicated EXE_UNIXSDL=darkplaces-sdl EXE_UNIXSVNEXUIZ=nexuiz-dedicated @@ -289,7 +289,7 @@ WINDRES ?= windres # Link # see LDFLAGS_WINCOMMON in makefile LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) -LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) $(LIB_SND_XMP) +LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(LDFLAGS_UNIXSDL) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) $(LIB_SND_XMP) EXE_WINSV=darkplaces-dedicated.exe EXE_WINSDL=darkplaces-sdl.exe EXE_WINSVNEXUIZ=nexuiz-dedicated.exe -- 2.39.2