$OpenBSD: patch-Makefile_in,v 1.1 2004/06/22 03:07:17 brad Exp $
--- Makefile.in.orig	1998-11-26 09:03:29.000000000 -0700
+++ Makefile.in	2004-06-21 20:04:38.000000000 -0600
@@ -15,11 +15,13 @@ CFLAGS        = $(OPTIMIZE) $(EXTRA_CFLA
 CPPFLAGS      = $(INCLUDE_DIRS) $(DEFINES)
 
 # Installation directories (and install program)
+DESTDIR         = 
+
 prefix          = @prefix@
 exec_prefix     = @exec_prefix@
 INSTALL_INCLUDE = @includedir@
 INSTALL_LIBRARY = @libdir@
-INSTALL         = @INSTALL@
+INSTALL_DATA    = @INSTALL_DATA@
 
 # Other miscellaneous programs
 AR            = @AR@
@@ -37,23 +39,29 @@ DITHER_SRC    = fs2.c fs2fast.c fs4.c hy
 		mono.c ordered.c ordered2.c mb_ordered.c
 LIBSRC        = @libsrc@
 LIBOBJ        = @libobj@
+SHLIBOBJ      = $(LIBOBJ:.o=.so)
 
 
 # Other files of interest
 
 LIBRARY       = libmpeg.a
-SHLIB         = libmpeg.so
+SHLIB         = libmpeg.so.13.1
 HEADER        = mpeg.h
 EXTRAS        = @extras@
 
+PICFLAG       = -fpic
+
+.SUFFIXES: .o .so
+
 # Implicit targets
 .c.o:
 		$(CC) -c $(CFLAGS) $(CPPFLAGS) $<
 
+.c.so:
+		$(CC) -c $(CFLAGS) $(CPPFLAGS) $(PICFLAG) $< -o $@
 
-# Library/cleanup targets: 
 
-all:		lib $(EXTRAS)
+# Library/cleanup targets: 
 
 lib:		$(LIBRARY)
 
@@ -63,17 +71,24 @@ $(LIBRARY):	$(LIBOBJ)
 		$(AR) $(ARFLAGS) $(LIBRARY) $(LIBOBJ)
 		$(RANLIB) $(LIBRARY)
 
-$(SHLIB):	$(LIBOBJ)
-		$(CC) -shared -o $(SHLIB) $(LIBOBJ)
+$(SHLIB):	$(SHLIBOBJ)
+		$(CC) -shared $(PICFLAG) -o $(SHLIB) $(SHLIBOBJ)
 
+.if defined(NO_SHARED_LIBS) && ${NO_SHARED_LIBS:L} == "yes"
+all:		lib $(EXTRAS)
 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
+.else
+all:		lib shlib $(EXTRAS)
+install:	$(LIBRARY) $(SHLIB)
+.endif
+		$(INSTALL_DATA) $(HEADER) $(DESTDIR)$(INSTALL_INCLUDE)
+		$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(INSTALL_LIBRARY)
+		@if [ -f $(SHLIB) ]; then \
+		   $(INSTALL_DATA) $(SHLIB) $(DESTDIR)$(INSTALL_LIBRARY); \
+		fi
 
 clean:
-		rm -f $(LIBRARY) $(EXTRAS) $(LIBOBJ) core
+		rm -f $(LIBRARY) $(SHLIB) $(EXTRAS) $(LIBOBJ) $(SHLIBOBJ) core
 		cd extras && $(MAKE) clean
 
 distclean:	clean
