66# Copyright (c) 1998, Regents of the University of California
77#
88# IDENTIFICATION
9- # $PostgreSQL: pgsql/src/Makefile.shlib,v 1.73 2003/11/29 19:51:39 pgsql Exp $
9+ # $PostgreSQL: pgsql/src/Makefile.shlib,v 1.74 2003/12/01 22:23:06 momjian Exp $
1010#
1111#-------------------------------------------------------------------------
1212
@@ -201,6 +201,10 @@ ifeq ($(PORTNAME), cygwin)
201201 shlib:= $(NAME)$(DLSUFFIX)
202202endif
203203
204+ ifeq ($(PORTNAME), win32)
205+ shlib:= lib$(NAME)$(DLSUFFIX)
206+ endif
207+
204208ifeq ($(PORTNAME), beos)
205209 shlib:= lib$(NAME)$(DLSUFFIX)
206210 LINK.shared= $(LD) -nostart
@@ -229,6 +233,7 @@ all-static-lib: lib$(NAME).a
229233all-shared-lib: $(shlib)
230234
231235ifneq ($(PORTNAME), cygwin)
236+ ifneq ($(PORTNAME), win32)
232237
233238ifndef LORDER
234239MK_NO_LORDER := true
@@ -242,12 +247,14 @@ else
242247endif
243248$(RANLIB) $@
244249
250+ endif # not win32
245251endif # not cygwin
246252
247253ifeq ($(enable_shared), yes)
248254
249255ifneq ($(PORTNAME), beos)
250256ifneq ($(PORTNAME), cygwin)
257+ ifneq ($(PORTNAME), win32)
251258ifneq ($(PORTNAME), aix)
252259
253260# Normal case
@@ -273,6 +280,16 @@ $(shlib): lib$(NAME).a
273280
274281endif # PORTNAME == aix
275282
283+ else # PORTNAME == win32
284+
285+ # win32 case
286+ $(shlib) lib$(NAME).a: $(OBJS)
287+ $(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
288+ $(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
289+ $(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a
290+
291+ endif # PORTNAME == win32
292+
276293else # PORTNAME == cygwin
277294
278295# Cygwin case
@@ -316,6 +333,7 @@ ifeq ($(enable_shared), yes)
316333install-lib-shared: $(shlib)
317334$(INSTALL_SHLIB) $< $(DESTDIR)$(libdir)/$(shlib)
318335ifneq ($(PORTNAME), cygwin)
336+ ifneq ($(PORTNAME), win32)
319337ifneq ($(shlib), lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION))
320338cd $(DESTDIR)$(libdir) && \
321339rm -f lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) && \
@@ -327,6 +345,7 @@ ifneq ($(shlib), lib$(NAME)$(DLSUFFIX))
327345$(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX)
328346endif
329347
348+ endif # not win32
330349endif # not cygwin
331350endif # enable_shared
332351
@@ -361,3 +380,7 @@ endif
361380ifeq ($(PORTNAME), cygwin)
362381rm -f $(NAME).dll $(NAME).def
363382endif
383+
384+ ifeq ($(PORTNAME), win32)
385+ rm -f $(NAME).dll $(NAME).def
386+ endif