diff --git a/contrib/spi/Makefile b/contrib/spi/Makefile
index 6a44b355de2e03dff4391131481668d583068108..d67733220545cc04c4c77a716b93977051ed0517 100644
--- a/contrib/spi/Makefile
+++ b/contrib/spi/Makefile
@@ -1,5 +1,5 @@
 #
-# $Header: /cvsroot/pgsql/contrib/spi/Makefile,v 1.19 2001/02/20 19:20:28 petere Exp $
+# $Header: /cvsroot/pgsql/contrib/spi/Makefile,v 1.20 2001/04/04 21:15:56 tgl Exp $
 #
 
 subdir = contrib/spi
@@ -19,6 +19,9 @@ ifdef REFINT_VERBOSE
 override CPPFLAGS+= -DREFINT_VERBOSE
 endif
 
+override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
+
+
 all: $(MODS) $(SQLS)
 
 %.sql: %.sql.in
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 10296facfdaee871624512246d31f71d728b1c27..2227be3fb5d4ca0f990a80b1a0e72cfd518606eb 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.69 2001/04/02 03:21:23 tgl Exp $
+# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.70 2001/04/04 21:15:56 tgl Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -43,11 +43,11 @@ else # win
 
 # No points for style here. How about encapsulating some of these
 # commands into variables?
-postgres: $(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
+postgres: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
 	dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
-	gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(DLLOBJS) $(DLLLIBS)
+	gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(DLLLIBS)
 	dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
-	gcc -g -o $@$(X) $@.exp $(DLLOBJS) $(DLLLIBS)
+	gcc -g -o $@$(X) $@.exp $(OBJS) $(DLLLIBS)
 	rm $@.exp $@.base
 
 endif # win
@@ -64,12 +64,10 @@ $(DIRS:%=%-recursive): $(top_builddir)/src/include/parser/parse.h $(top_builddir
 
 ifeq ($(MAKE_DLL), true)
 
-DLLOBJS := $(OBJS)
+postgres.def: $(OBJS)
+	$(DLLTOOL) --export-all --output-def $@ $(OBJS)
 
-postgres.def: $(DLLOBJS)
-	$(DLLTOOL) --export-all --output-def $@ $(DLLOBJS)
-
-libpostgres.a: $(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
+libpostgres.a: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
 	$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
 
 endif # MAKE_DLL
diff --git a/src/makefiles/Makefile.win b/src/makefiles/Makefile.win
index 5dac251872a8c0333521837aff882819ae445d1d..ce57e383ba48d8c5f89de68ace75bfea47f604d1 100644
--- a/src/makefiles/Makefile.win
+++ b/src/makefiles/Makefile.win
@@ -1,8 +1,9 @@
-# $Header: /cvsroot/pgsql/src/makefiles/Attic/Makefile.win,v 1.9 2001/02/20 19:20:29 petere Exp $
+# $Header: /cvsroot/pgsql/src/makefiles/Attic/Makefile.win,v 1.10 2001/04/04 21:15:56 tgl Exp $
 LDFLAGS+= -g
 DLLTOOL= dlltool
 DLLWRAP= dllwrap
-DLLLIBS=-L$(top_builddir)/src/backend -lpostgres -lcygipc -lcygwin -lcrypt -lkernel32
+DLLLIBS= -lcygipc -lcrypt
+BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres
 MK_NO_LORDER=true
 MAKE_DLL=true
 #MAKE_DLL=false
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index d04988cc2ad83226803810e9a7e8c191cd54c4f6..46d27daabc0607ff7209ef51afe0ade28a4d2126 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -2,7 +2,7 @@
 #
 # Makefile for the plpgsql shared object
 #
-# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Makefile,v 1.12 2001/02/20 19:20:29 petere Exp $
+# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Makefile,v 1.13 2001/04/04 21:15:56 tgl Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -17,6 +17,8 @@ SO_MINOR_VERSION= 0
 
 override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
 
+override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
+
 OBJS = pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o
 
 all: all-lib
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile
index 71bca8705809c49de0270437f80c6fd7f214d3e9..595c74f5e2aca996db6099c3990952b52cbae753 100644
--- a/src/test/regress/GNUmakefile
+++ b/src/test/regress/GNUmakefile
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.33 2001/02/20 19:20:30 petere Exp $
+#    $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.34 2001/04/04 21:15:56 tgl Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -20,6 +20,8 @@ contribdir := $(top_builddir)/contrib
 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
 override CFLAGS += $(CFLAGS_SL)
 
+override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
+
 
 ##
 ## Prepare for tests