From 34f2f6f1ca5a93419ae28ed926638647bfb1b0c1 Mon Sep 17 00:00:00 2001 From: Sander van Dijk Date: Thu, 11 Sep 2014 18:47:07 +0000 Subject: [PATCH] Makefile[.*]: SDL2 build support. 'make USE_SDL2=1' to enable. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1019 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/Makefile | 15 +++++++++++++++ Quake/Makefile.darwin | 18 +++++++++++++++++- Quake/Makefile.w32 | 15 +++++++++++++++ Quake/Makefile.w64 | 15 +++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/Quake/Makefile b/Quake/Makefile index 42d77a57..ca75f777 100644 --- a/Quake/Makefile +++ b/Quake/Makefile @@ -7,6 +7,9 @@ # Enable/Disable user directories support DO_USERDIRS=0 +### Enable/Disable SDL2 +USE_SDL2=0 + ### Enable/Disable codecs for streaming music support USE_CODEC_WAVE=1 USE_CODEC_FLAC=0 @@ -93,12 +96,24 @@ LDFLAGS+= -L$(X11BASE)/lib CFLAGS += -I$(X11BASE)/include endif +ifeq ($(USE_SDL2),1) +CFLAGS += -DUSE_SDL2 +endif + +ifeq ($(USE_SDL2),1) +SDL_CONFIG ?= sdl2-config +else SDL_CONFIG ?= sdl-config +endif SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) SDL_LIBS := $(shell $(SDL_CONFIG) --libs) ifeq ($(SDLNET),1) +ifeq ($(USE_SDL2),1) +NET_LIBS :=-lSDL2_net +else NET_LIBS :=-lSDL_net +endif CFLAGS +=-D_USE_SDLNET else ifeq ($(HOST_OS),sunos) diff --git a/Quake/Makefile.darwin b/Quake/Makefile.darwin index 44592b38..ac6fc580 100644 --- a/Quake/Makefile.darwin +++ b/Quake/Makefile.darwin @@ -8,6 +8,9 @@ # Enable/Disable user directories support DO_USERDIRS=0 +### Enable/Disable SDL2 +USE_SDL2=0 + ### Enable/Disable codecs for streaming music support USE_CODEC_WAVE=1 USE_CODEC_FLAC=1 @@ -84,14 +87,27 @@ ifeq ($(DO_USERDIRS),1) CFLAGS += -DDO_USERDIRS=1 endif +ifeq ($(USE_SDL2),1) +CFLAGS += -DUSE_SDL2 +endif + # not relying on sdl-config command and assuming # /Library/Frameworks/SDL.framework is available SDL_CFLAGS =-D_GNU_SOURCE=1 -D_THREAD_SAFE SDL_CFLAGS+=-DSDL_FRAMEWORK -DNO_SDL_CONFIG -SDL_LIBS =-Wl,-framework,SDL -Wl,-framework,Cocoa +ifeq ($(USE_SDL2),1) +SDL_LIBS =-Wl,-framework,SDL2 +else +SDL_LIBS =-Wl,-framework,SDL +endif +SDL_LIBS +=-Wl,-framework,Cocoa ifeq ($(SDLNET),1) +ifeq ($(USE_SDL2),1) +NET_LIBS :=-Wl,-framework,SDL2_net +else NET_LIBS :=-Wl,-framework,SDL_net +endif CFLAGS +=-D_USE_SDLNET else NET_LIBS := diff --git a/Quake/Makefile.w32 b/Quake/Makefile.w32 index e7bff3a4..d0d38166 100644 --- a/Quake/Makefile.w32 +++ b/Quake/Makefile.w32 @@ -4,6 +4,9 @@ # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. # "make WINSOCK2=1" to use WinSock2 api instead of old WinSock 1.1. +### Enable/disable SDL2 +USE_SDL2=0 + ### Enable/disable codecs for streaming music support USE_CODEC_WAVE=1 USE_CODEC_FLAC=1 @@ -75,7 +78,15 @@ define do_strip endef endif +ifeq ($(USE_SDL2),1) +CFLAGS += -DUSE_SDL2 +endif + +ifeq ($(USE_SDL2),1) +SDL_CONFIG ?= sdl2-config +else SDL_CONFIG ?= sdl-config +endif SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) SDL_LIBS := $(shell $(SDL_CONFIG) --libs) @@ -88,7 +99,11 @@ LIBWINSOCK := -lwsock32 endif ifeq ($(SDLNET),1) +ifeq ($(USE_SDL2),1) +NET_LIBS := -lSDL2_net +else NET_LIBS := -lSDL_net +endif CFLAGS +=-D_USE_SDLNET else CFLAGS += $(DEFWINSOCK) diff --git a/Quake/Makefile.w64 b/Quake/Makefile.w64 index b59341bc..87879103 100644 --- a/Quake/Makefile.w64 +++ b/Quake/Makefile.w64 @@ -4,6 +4,9 @@ # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. # "make WINSOCK2=0" to use the old WinSock 1.1 api (NOT recommended). +### Enable/disable SDL2 +USE_SDL2=0 + ### Enable/disable codecs for streaming music support USE_CODEC_WAVE=1 USE_CODEC_FLAC=1 @@ -73,7 +76,15 @@ define do_strip endef endif +ifeq ($(USE_SDL2),1) +CFLAGS += -DUSE_SDL2 +endif + +ifeq ($(USE_SDL2),1) +SDL_CONFIG ?= sdl2-config +else SDL_CONFIG ?= sdl-config +endif SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) SDL_LIBS := $(shell $(SDL_CONFIG) --libs) @@ -86,7 +97,11 @@ LIBWINSOCK := -lwsock32 endif ifeq ($(SDLNET),1) +ifeq ($(USE_SDL2),1) +NET_LIBS := -lSDL2_net +else NET_LIBS := -lSDL_net +endif CFLAGS +=-D_USE_SDLNET else CFLAGS += $(DEFWINSOCK)