summaryrefslogtreecommitdiffstats
path: root/games/glbsp/dynamic_libglbsp.diff
blob: 69f68aaa4c48a39549dec58eacb88a5d019120f1 (plain)
diff -Naur glbsp-2.24-source.orig/Makefile.unx glbsp-2.24-source/Makefile.unx
--- glbsp-2.24-source.orig/Makefile.unx	2007-07-25 23:14:34.000000000 -0400
+++ glbsp-2.24-source/Makefile.unx	2010-03-01 08:37:23.000000000 -0500
@@ -13,7 +13,11 @@
 #    clean   : removes targets and intermediate files
 #
 
-LIB_NAME=libglbsp.a
+libver=3.0.0
+libmajorver=3
+
+LIB_SHORTNAME=libglbsp.so
+LIB_NAME=$(LIB_SHORTNAME).$(libver)
 CMD_NAME=glbsp
 GUI_NAME=glBSPX
 DOC_NAME=glbsp.txt
@@ -24,13 +28,13 @@
 RANLIB=ranlib
 STRIP=strip --strip-unneeded
 
-BASE_FLAGS=-Wall -O2 -I./src -DUNIX -DINLINE_G=inline
+BASE_FLAGS=-Wall -O2 -fPIC -I./src -DUNIX -DINLINE_G=inline
 
 FLTK_DIR=./fltk-1.1.7
 
 INSTALL_PREFIX=/usr/local
 MAN_PREFIX=$(INSTALL_PREFIX)/share/man
-
+LIBDIR=$(INSTALL_PREFIX)/usr/lib
 
 # ----- GENERAL STUFF ----------------------------------------------
 
@@ -64,9 +68,7 @@
 	$(CC) $(LIB_FLAGS) -c $^ -o $@
 
 $(LIB_NAME): $(LIB_OBJS)
-	$(AR) $@ $(LIB_OBJS)
-	$(RANLIB) $@
-
+	$(CC) $^ -o $@ -shared -fPIC -Wl,-soname,$(LIB_SHORTNAME).$(libmajorver)
 
 # ----- CMDLINE PROGRAM ---------------------------------------------
 
@@ -88,6 +90,11 @@
 	chmod 755 $(INSTALL_PREFIX)/bin/$(CMD_NAME)
 	cp glbsp.1 $(MAN_PREFIX)/man1/
 	chmod 644 $(MAN_PREFIX)/man1/glbsp.1
+	mkdir -p $(LIBDIR)
+	strip $(LIB_NAME)
+	install -m0755 $(LIB_NAME) $(LIBDIR)
+	ln -s $(LIB_NAME) $(LIBDIR)/$(LIB_SHORTNAME).$(libmajorver)
+	ln -s $(LIB_SHORTNAME).$(libmajorver) $(LIBDIR)/$(LIB_SHORTNAME)
 
 .PHONY: install