Static SDL linkage.

Ryan C. Gordon icculus at clutteredmind.org
Sun Feb 17 19:44:15 EST 2002


This is of limited use unless you're releasing Quake 2 binaries for others
to use, but here's a patch to the Makefile to allow you to flip a flag to
define SDL linkage behaviour. Attached.

--ryan.

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /cvs/cvsroot/quake2/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile	2002/02/17 18:03:19	1.11
+++ Makefile	2002/02/18 00:43:48
@@ -23,6 +23,13 @@
 BUILD_XATRIX=NO		# game$(ARCH).so for xatrix (see README.r for details)
 BUILD_ROGUE=NO		# game$(ARCH).so for rogue (see README.r for details)
 
+# Set this to "YES" to statically link SDL, for end-user binary releases.
+#  If you are building for yourself, you're better off saying "NO".
+STATICSDL=NO
+
+# SDLDIR is only used if STATICSDL, above, is YES.
+SDLDIR=/usr/local/lib
+
 # Other compile-time options:
 # Compile with IPv6 (protocol independent API). Tested on FreeBSD
 HAVE_IPV6=NO
@@ -121,7 +128,15 @@
 XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm
 
 SDLCFLAGS=$(shell sdl-config --cflags)
-SDLLDFLAGS=$(shell sdl-config --libs)
+
+ifeq ($(strip $(STATICSDL)),YES)
+  SDLLDFLAGS += -L/usr/X11R6/lib -Wl,-Bstatic $(SDLDIR)/libSDL.a
+  SDLLDFLAGS += $(SDLDIR)/libesd.a $(SDLDIR)/libartsc.a -Wl,-Bdynamic
+  SDLLDFLAGS += -lpthread -lX11 -lXext -lXxf86dga -lXxf86vm -lXv -lXinerama
+else
+  SDLLDFLAGS=$(shell sdl-config --libs)
+endif
+
 
 FXGLCFLAGS=-I/usr/X11R6/include
 FXGLLDFLAGS=-L/usr/local/glide/lib -L/usr/X11/lib -L/usr/local/lib \
@@ -131,7 +146,7 @@
 GLXLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm
 
 SDLGLCFLAGS=$(SDLCFLAGS) -DOPENGL
-SDLGLLDFLAGS=$(shell sdl-config --libs)
+SDLGLLDFLAGS=$(SDLLDFLAGS)
 
 SHLIBEXT=so
 


More information about the quake2 mailing list