--- Makefile.in.orig	Fri Nov 27 01:03:29 1998
+++ Makefile.in	Tue Nov 23 02:51:05 1999
@@ -19,13 +19,14 @@
 exec_prefix     = @exec_prefix@
 INSTALL_INCLUDE = @includedir@
 INSTALL_LIBRARY = @libdir@
-INSTALL         = @INSTALL@
+INSTALL_DATA    = @INSTALL_DATA@
 
 # Other miscellaneous programs
 AR            = @AR@
 ARFLAGS       = -ru
 RANLIB        = @RANLIB@
 
+.SUFFIXES: .so
 
 # Source for the library itself -- note that we define LIBSRC and
 # LIBOBJ this way (instead of just LIBOBJ=$(LIBSRC:.c=.o) because
@@ -37,12 +38,17 @@
 		mono.c ordered.c ordered2.c mb_ordered.c
 LIBSRC        = @libsrc@
 LIBOBJ        = @libobj@
+SHLIBOBJ      = @shlibobj@
 
 
 # Other files of interest
 
 LIBRARY       = libmpeg.a
-SHLIB         = libmpeg.so
+.if ${PORTOBJFORMAT} == elf
+SHLIB         = libmpeg.so.1
+.else
+SHLIB         = libmpeg.so.1.3
+.endif
 HEADER        = mpeg.h
 EXTRAS        = @extras@
 
@@ -53,7 +59,7 @@
 
 # Library/cleanup targets: 
 
-all:		lib $(EXTRAS)
+all:		lib shlib $(EXTRAS)
 
 lib:		$(LIBRARY)
 
@@ -63,14 +69,18 @@
 		$(AR) $(ARFLAGS) $(LIBRARY) $(LIBOBJ)
 		$(RANLIB) $(LIBRARY)
 
-$(SHLIB):	$(LIBOBJ)
-		$(CC) -shared -o $(SHLIB) $(LIBOBJ)
-
-install:	$(LIBRARY)
-		$(INSTALL) -d $(INSTALL_INCLUDE) $(INSTALL_LIBRARY)
-		$(INSTALL) -m 0644 $(HEADER) $(INSTALL_INCLUDE)/$(HEADER)
-		$(INSTALL) -m 0644 $(LIBRARY) $(INSTALL_LIBRARY)/$(LIBRARY)
-		@if test -f $(SHLIB) ; then echo "warning: $(SHLIB) *not* installed (installing shared libraries is too system-specific)" ; fi
+$(SHLIB):	$(SHLIBOBJ)
+.if ${PORTOBJFORMAT} == elf
+		$(CC) -shared -Wl,-soname,$(SHLIB) -o $(SHLIB) $(SHLIBOBJ)
+.else
+		$(CC) -shared -o $(SHLIB) $(SHLIBOBJ)
+.endif
+		ln -sf $(SHLIB) `echo $(SHLIB) | sed 's/\.so.*$$/\.so/'` 
+
+install:
+		$(INSTALL_DATA) $(LIBRARY) $(SHLIB) $(INSTALL_LIBRARY)
+		(cd $(INSTALL_LIBRARY); ln -sf $(SHLIB) `echo $(SHLIB) | sed 's/\.so.*$$/\.so/'`)
+		$(INSTALL_DATA) $(HEADER) $(INSTALL_INCLUDE)
 
 clean:
 		rm -f $(LIBRARY) $(EXTRAS) $(LIBOBJ) core
@@ -80,6 +90,8 @@
 		rm -f config.cache config.log config.status Makefile config.h
 		cd extras && $(MAKE) distclean
 
+.c.so:
+		$(CC) $(CFLAGS) $(INCLUDE_DIRS) -fpic -DPIC -c $< -o $@
 
 # Executable targets (mpegtest, easympeg [GL platforms only])
 
