diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index b2df1de003bb6f3d8c803cc2fc9d09b96dab22d4..003aefb2e6c956165ef49026b0573db65ae13072 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -6,7 +6,7 @@
 # Copyright (c) 1998, Regents of the University of California
 #
 # IDENTIFICATION
-#    $PostgreSQL: pgsql/src/Makefile.shlib,v 1.73 2003/11/29 19:51:39 pgsql Exp $
+#    $PostgreSQL: pgsql/src/Makefile.shlib,v 1.74 2003/12/01 22:23:06 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -201,6 +201,10 @@ ifeq ($(PORTNAME), cygwin)
   shlib			:= $(NAME)$(DLSUFFIX)
 endif
 
+ifeq ($(PORTNAME), win32)
+  shlib			:= lib$(NAME)$(DLSUFFIX)
+endif
+
 ifeq ($(PORTNAME), beos)
   shlib			:= lib$(NAME)$(DLSUFFIX)
   LINK.shared		= $(LD) -nostart
@@ -229,6 +233,7 @@ all-static-lib: lib$(NAME).a
 all-shared-lib: $(shlib)
 
 ifneq ($(PORTNAME), cygwin)
+ifneq ($(PORTNAME), win32)
 
 ifndef LORDER
 MK_NO_LORDER := true
@@ -242,12 +247,14 @@ else
 endif
 	$(RANLIB) $@
 
+endif # not win32
 endif # not cygwin
 
 ifeq ($(enable_shared), yes)
 
 ifneq ($(PORTNAME), beos)
 ifneq ($(PORTNAME), cygwin)
+ifneq ($(PORTNAME), win32)
 ifneq ($(PORTNAME), aix)
 
 # Normal case
@@ -273,6 +280,16 @@ $(shlib): lib$(NAME).a
 	
 endif # PORTNAME == aix
 
+else # PORTNAME == win32
+
+# win32 case
+$(shlib) lib$(NAME).a: $(OBJS)
+	$(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
+	$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
+	$(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a
+
+endif # PORTNAME == win32
+
 else # PORTNAME == cygwin
 
 # Cygwin case
@@ -316,6 +333,7 @@ ifeq ($(enable_shared), yes)
 install-lib-shared: $(shlib)
 	$(INSTALL_SHLIB) $< $(DESTDIR)$(libdir)/$(shlib)
 ifneq ($(PORTNAME), cygwin)
+ifneq ($(PORTNAME), win32)
 ifneq ($(shlib), lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION))
 	cd $(DESTDIR)$(libdir) && \
 	rm -f lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) && \
@@ -327,6 +345,7 @@ ifneq ($(shlib), lib$(NAME)$(DLSUFFIX))
 	$(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX)
 endif
 
+endif # not win32
 endif # not cygwin
 endif # enable_shared
 
@@ -361,3 +380,7 @@ endif
 ifeq ($(PORTNAME), cygwin)
 	rm -f $(NAME).dll $(NAME).def
 endif
+
+ifeq ($(PORTNAME), win32)
+	rm -f $(NAME).dll $(NAME).def
+endif