Makefile[.*]: SDL2 build support. 'make USE_SDL2=1' to enable.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1019 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
svdijk 2014-09-11 18:47:07 +00:00
parent 9524b80f79
commit 573c01174b
4 changed files with 62 additions and 1 deletions

View file

@ -7,6 +7,9 @@
# Enable/Disable user directories support # Enable/Disable user directories support
DO_USERDIRS=0 DO_USERDIRS=0
### Enable/Disable SDL2
USE_SDL2=0
### Enable/Disable codecs for streaming music support ### Enable/Disable codecs for streaming music support
USE_CODEC_WAVE=1 USE_CODEC_WAVE=1
USE_CODEC_FLAC=0 USE_CODEC_FLAC=0
@ -93,12 +96,24 @@ LDFLAGS+= -L$(X11BASE)/lib
CFLAGS += -I$(X11BASE)/include CFLAGS += -I$(X11BASE)/include
endif endif
ifeq ($(USE_SDL2),1)
CFLAGS += -DUSE_SDL2
endif
ifeq ($(USE_SDL2),1)
SDL_CONFIG ?= sdl2-config
else
SDL_CONFIG ?= sdl-config SDL_CONFIG ?= sdl-config
endif
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LIBS := $(shell $(SDL_CONFIG) --libs) SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
ifeq ($(SDLNET),1) ifeq ($(SDLNET),1)
ifeq ($(USE_SDL2),1)
NET_LIBS :=-lSDL2_net
else
NET_LIBS :=-lSDL_net NET_LIBS :=-lSDL_net
endif
CFLAGS +=-D_USE_SDLNET CFLAGS +=-D_USE_SDLNET
else else
ifeq ($(HOST_OS),sunos) ifeq ($(HOST_OS),sunos)

View file

@ -8,6 +8,9 @@
# Enable/Disable user directories support # Enable/Disable user directories support
DO_USERDIRS=0 DO_USERDIRS=0
### Enable/Disable SDL2
USE_SDL2=0
### Enable/Disable codecs for streaming music support ### Enable/Disable codecs for streaming music support
USE_CODEC_WAVE=1 USE_CODEC_WAVE=1
USE_CODEC_FLAC=1 USE_CODEC_FLAC=1
@ -84,14 +87,27 @@ ifeq ($(DO_USERDIRS),1)
CFLAGS += -DDO_USERDIRS=1 CFLAGS += -DDO_USERDIRS=1
endif endif
ifeq ($(USE_SDL2),1)
CFLAGS += -DUSE_SDL2
endif
# not relying on sdl-config command and assuming # not relying on sdl-config command and assuming
# /Library/Frameworks/SDL.framework is available # /Library/Frameworks/SDL.framework is available
SDL_CFLAGS =-D_GNU_SOURCE=1 -D_THREAD_SAFE SDL_CFLAGS =-D_GNU_SOURCE=1 -D_THREAD_SAFE
SDL_CFLAGS+=-DSDL_FRAMEWORK -DNO_SDL_CONFIG 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 ($(SDLNET),1)
ifeq ($(USE_SDL2),1)
NET_LIBS :=-Wl,-framework,SDL2_net
else
NET_LIBS :=-Wl,-framework,SDL_net NET_LIBS :=-Wl,-framework,SDL_net
endif
CFLAGS +=-D_USE_SDLNET CFLAGS +=-D_USE_SDLNET
else else
NET_LIBS := NET_LIBS :=

View file

@ -4,6 +4,9 @@
# "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations.
# "make WINSOCK2=1" to use WinSock2 api instead of old WinSock 1.1. # "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 ### Enable/disable codecs for streaming music support
USE_CODEC_WAVE=1 USE_CODEC_WAVE=1
USE_CODEC_FLAC=1 USE_CODEC_FLAC=1
@ -75,7 +78,15 @@ define do_strip
endef endef
endif endif
ifeq ($(USE_SDL2),1)
CFLAGS += -DUSE_SDL2
endif
ifeq ($(USE_SDL2),1)
SDL_CONFIG ?= sdl2-config
else
SDL_CONFIG ?= sdl-config SDL_CONFIG ?= sdl-config
endif
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LIBS := $(shell $(SDL_CONFIG) --libs) SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
@ -88,7 +99,11 @@ LIBWINSOCK := -lwsock32
endif endif
ifeq ($(SDLNET),1) ifeq ($(SDLNET),1)
ifeq ($(USE_SDL2),1)
NET_LIBS := -lSDL2_net
else
NET_LIBS := -lSDL_net NET_LIBS := -lSDL_net
endif
CFLAGS +=-D_USE_SDLNET CFLAGS +=-D_USE_SDLNET
else else
CFLAGS += $(DEFWINSOCK) CFLAGS += $(DEFWINSOCK)

View file

@ -4,6 +4,9 @@
# "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations.
# "make WINSOCK2=0" to use the old WinSock 1.1 api (NOT recommended). # "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 ### Enable/disable codecs for streaming music support
USE_CODEC_WAVE=1 USE_CODEC_WAVE=1
USE_CODEC_FLAC=1 USE_CODEC_FLAC=1
@ -73,7 +76,15 @@ define do_strip
endef endef
endif endif
ifeq ($(USE_SDL2),1)
CFLAGS += -DUSE_SDL2
endif
ifeq ($(USE_SDL2),1)
SDL_CONFIG ?= sdl2-config
else
SDL_CONFIG ?= sdl-config SDL_CONFIG ?= sdl-config
endif
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LIBS := $(shell $(SDL_CONFIG) --libs) SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
@ -86,7 +97,11 @@ LIBWINSOCK := -lwsock32
endif endif
ifeq ($(SDLNET),1) ifeq ($(SDLNET),1)
ifeq ($(USE_SDL2),1)
NET_LIBS := -lSDL2_net
else
NET_LIBS := -lSDL_net NET_LIBS := -lSDL_net
endif
CFLAGS +=-D_USE_SDLNET CFLAGS +=-D_USE_SDLNET
else else
CFLAGS += $(DEFWINSOCK) CFLAGS += $(DEFWINSOCK)