3434#
3535#
3636# IDENTIFICATION
37- # $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.34 1998/11/27 19:51:27 vadim Exp $
37+ # $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.35 1999/01/17 06:18:11 momjian Exp $
3838#
3939# -------------------------------------------------------------------------
4040
@@ -58,20 +58,45 @@ CFLAGS+= $(KRBFLAGS)
5858LDFLAGS+ =$(KRBLIBS )
5959endif
6060
61+ ifeq ($(MAKE_DLL ) , true)
62+ DLLOBJS =$(OBJS )
63+ DLLOBJS+ = ../utils/version.o
64+ DLLLIBS = -L/usr/local/lib -lcygipc -lcrypt -lcygwin -lkernel32
65+
66+ postgres.def :$(DLLOBJS )
67+ $(DLLTOOL ) --export-all --output-def$@ $(DLLOBJS )
68+
69+ libpostgres.a :$(DLLOBJS ) ../utils/dllinit.o postgres.def
70+ $(DLLTOOL ) --dllname postgres.exe --def postgres.def --output-lib$@
71+ endif
6172
6273all : postgres$(POSTGRES_IMP ) global1.bki.source local1_template1.bki.source\
6374global1.description local1_template1.description
6475
76+ ifneq ($(PORTNAME ) , win)
6577postgres : fmgr.h$(OBJS ) ../utils/version.o
6678$(CC ) -o postgres$(OBJS ) ../utils/version.o$(LDFLAGS )
79+ else
80+ postgres :$(DLLOBJS ) ../utils/dllinit.o postgres.def libpostgres.a
81+ dlltool --dllname$@ $(X ) --output-exp$@ .exp --def postgres.def
82+ gcc -g -o$@ $(X ) -Wl,--base-file,$@ .base$@ .exp$(DLLOBJS ) $(DLLLIBS )
83+ dlltool --dllname$@ $(X ) --base-file$@ .base --output-exp$@ .exp --def postgres.def
84+ gcc -g -o$@ $(X ) $@ .exp$(DLLOBJS ) $(DLLLIBS )
85+ rm$@ .exp$@ .base
86+ endif
87+
88+ # .PHONY: postgres
6789
6890$(OBJS ) :$(DIRS:%=%.dir )
6991
7092$(DIRS:% =%.dir):
7193$(MAKE) -C $(subst .dir,,$@) all
7294
7395../utils/version.o :
74- $(MAKE ) -C ../utils version.o
96+ $(MAKE ) -C ../utils version.o
97+
98+ ../utils/dllinit.c :
99+ $(MAKE ) -C ../utils dllinit.o
75100
76101global1.bki.source local1_template1.bki.source \
77102global1.description local1_template1.description : catalog/$@
@@ -89,7 +114,6 @@ postgres.o: $(OBJS)
89114fast :
90115$(CC ) -r -o postgres.o$(OBJS ) $(LDFLAGS )
91116
92-
93117# ###########################################################################
94118# The following targets are specified in make commands that appear in the
95119# make files in our subdirectories.
@@ -104,9 +128,14 @@ fmgr.h:
104128
105129# ############################################################################
106130clean :
107- rm -f postgres$(POSTGRES_IMP ) fmgr.h parse.h\
131+ rm -f postgres$( X ) $(POSTGRES_IMP ) fmgr.h parse.h\
108132 global1.bki.source local1_template1.bki.source\
109133 global1.description local1_template1.description
134+ ifeq ($(PORTNAME ) , win)
135+ ifeq ($(MAKE_DLL ) , true)
136+ rm -f postgres.dll postgres.def libpostgres.a
137+ endif
138+ endif
110139for i in $(DIRS); do $(MAKE) -C $$i clean; done
111140
112141.DEFAULT :
@@ -132,12 +161,18 @@ install: $(LIBDIR) $(BINDIR) $(HEADERDIR) postgres $(POSTGRES_IMP) fmgr.h\
132161 global1.bki.source local1_template1.bki.source \
133162 global1.description local1_template1.description \
134163 libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
135- $(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
164+ $(INSTALL) $(INSTL_EXE_OPTS) postgres$(X) $(BINDIR)/postgres$(X)
136165ifeq ($(MAKE_EXPORTS ) , true)
137166$(INSTALL) $(INSTLOPTS) $(POSTGRES_IMP) $(LIBDIR)/$(POSTGRES_IMP)
138167endif
139168@rm -f $(BINDIR)/postmaster
140- ln -s postgres $(BINDIR)/postmaster
169+ ln -s postgres$(X) $(BINDIR)/postmaster
170+ ifeq ($(PORTNAME ) , win)
171+ ifeq ($(MAKE_DLL ) , true)
172+ # $(INSTALL) $(INSTLOPTS) postgres.dll $(BINDIR)/postgres.dll
173+ $(INSTALL) $(INSTLOPTS) libpostgres.a $(LIBDIR)/libpostgres.a
174+ endif
175+ endif
141176$(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
142177$(INSTALL) $(INSTLOPTS) global1.bki.source \
143178 $(LIBDIR)/global1.bki.source
@@ -152,7 +187,13 @@ endif
152187$(INSTALL) $(INSTLOPTS) optimizer/geqo/pg_geqo.sample \
153188 $(LIBDIR)/pg_geqo.sample
154189
155- $(BINDIR ) $(LIBDIR ) $(HEADERDIR ) :
190+ # $(BINDIR) $(LIBDIR) $(HEADERDIR):
191+ # mkdir $@
192+ $(BINDIR ) :
193+ mkdir$@
194+ $(LIBDIR ) :
195+ mkdir$@
196+ $(HEADERDIR ) :
156197mkdir$@
157198
158199# ############################################################################