Support shared library creation.
diff --git a/Modules/Makefile.pre.in b/Modules/Makefile.pre.in
index 7afa0b9..39c3b7c 100644
--- a/Modules/Makefile.pre.in
+++ b/Modules/Makefile.pre.in
@@ -27,9 +27,19 @@
 LIBM=		@LIBM@
 LIBC=		@LIBC@
 
+# Machine-dependent subdirectories
+MACHDEP=	@MACHDEP@
+
 # Install prefix, may be changed by configure
 prefix=		/usr/local
 
+# Symbols used for using shared libraries
+SO=		@SO@
+LDSHARED=	@LDSHARED@
+CCSHARED=	@CCSHARED@
+LINKFORSHARED=	@LINKFORSHARED@
+DESTSHARED=	$(prefix)/lib/python/$(MACHDEP)
+
 
 # === Variables that are customizable by hand ===
 
@@ -60,13 +70,13 @@
 
 all:		$(LIB) ../python
 
-$(LIB):		$(OBJS)
+$(LIB):		$(OBJS) Makefile
 		-rm -f $(LIB)
 		$(AR) cr $(LIB) $(OBJS)
 		$(RANLIB) $(LIB)
 
-../python:	config.o $(MYLIBS)
-		$(CC) $(OPT) config.o \
+../python:	config.o $(MYLIBS) Makefile
+		$(CC) $(OPT) config.o $(LINKFORSHARED) \
 		      $(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python
 		mv python ../python
 
@@ -136,8 +146,9 @@
 xxmodule.o: xxmodule.c
 yuvconvert.o: yuvconvert.c
 
-# === Rules added by makesetup ===
+# Rules to build and install all shared modules
+sharedmods:	$(SHAREDMODS)
+sharedinstall:	$(SHAREDMODS)
+		mv $(SHAREDMODS) $(DESTSHARED)
 
-# DO NOT DELETE THIS LINE -- mkdep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+# Stuff is appended here by makesetup and make depend