66# Copyright (c) 1998, Regents of the University of California
77#
88# IDENTIFICATION
9- # $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.13 1999/07/15 02:03:00 tgl Exp $
9+ # $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.14 1999/07/16 22:56:01 tgl Exp $
1010#
1111#-------------------------------------------------------------------------
1212
@@ -56,25 +56,12 @@ install-shlib-dep :=
5656# Makefile.global (or really Makefile.port) to supply DLSUFFIX and other
5757# symbols.
5858
59- ifeq ($(PORTNAME), irix5)
60- install-shlib-dep := install-shlib
61- shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO__MINOR_VERSION)
62- LDFLAGS_SL := -shared
63- CFLAGS += $(CFLAGS_SL)
64- endif
59+ # Try to keep the sections in some kind of order, folks...
6560
66- ifeq ($(PORTNAME), freebsd)
67- ifdef BSD_SHLIB
68- install-shlib-dep:= install-shlib
69- ifdef ELF_SYSTEM
70- shlib:= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
71- LDFLAGS_SL:= -x -shared -soname $(shlib)
72- else
73- shlib:= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
74- LDFLAGS_SL:= -x -Bshareable -Bforcearchive
75- endif
76- CFLAGS+= $(CFLAGS_SL)
77- endif
61+ ifeq ($(PORTNAME), aix)
62+ install-shlib-dep:= install-shlib
63+ shlib:= lib$(NAME)$(DLSUFFIX)
64+ SHLIB_LINK+= -lc
7865endif
7966
8067ifeq ($(PORTNAME), bsd)
@@ -108,6 +95,20 @@ ifeq ($(PORTNAME), bsdi)
10895 endif
10996endif
11097
98+ ifeq ($(PORTNAME), freebsd)
99+ ifdef BSD_SHLIB
100+ install-shlib-dep:= install-shlib
101+ ifdef ELF_SYSTEM
102+ shlib:= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
103+ LDFLAGS_SL:= -x -shared -soname $(shlib)
104+ else
105+ shlib:= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
106+ LDFLAGS_SL:= -x -Bshareable -Bforcearchive
107+ endif
108+ CFLAGS+= $(CFLAGS_SL)
109+ endif
110+ endif
111+
111112ifeq ($(PORTNAME), hpux)
112113 install-shlib-dep:= install-shlib
113114# HPUX doesn't believe in version numbers for shlibs
@@ -116,6 +117,13 @@ ifeq ($(PORTNAME), hpux)
116117 CFLAGS+= $(CFLAGS_SL)
117118endif
118119
120+ ifeq ($(PORTNAME), irix5)
121+ install-shlib-dep := install-shlib
122+ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
123+ LDFLAGS_SL := -shared
124+ CFLAGS += $(CFLAGS_SL)
125+ endif
126+
119127ifeq ($(PORTNAME), linux)
120128 install-shlib-dep:= install-shlib
121129 shlib:= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
@@ -188,18 +196,22 @@ all: lib$(NAME).a $(shlib)
188196# Rules to build regular and shared libraries
189197
190198ifneq ($(PORTNAME), win)
199+
191200lib$(NAME).a: $(OBJS)
192201ifdef MK_NO_LORDER
193202$(AR) $(AROPT) $@ $(OBJS)
194203else
195204$(AR) $(AROPT) $@ `lorder $(OBJS) | tsort`
196205endif
197206$(RANLIB) $@
207+
198208endif
199209
200210ifneq ($(shlib),)
201211ifneq ($(PORTNAME), win)
212+ ifneq ($(PORTNAME), aix)
202213
214+ # Normal case
203215$(shlib): $(OBJS)
204216$(LD) $(LDFLAGS_SL) -o $@ $(OBJS) $(SHLIB_LINK)
205217if [ "$(shlib)" != "lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)" ]; then \
@@ -213,6 +225,16 @@ $(shlib): $(OBJS)
213225
214226else
215227
228+ # AIX case
229+ $(shlib): lib$(NAME).a
230+ $(MKLDEXPORT) lib$(NAME).a $(LIBDIR) > lib$(NAME)$(EXPSUFF)
231+ $(LD) -H512 -bM:SRE -bI:$(SRCDIR)/backend/$(POSTGRES_IMP) -bE:lib$(NAME)$(EXPSUFF) -o $@ $< $(LDFLAGS) $(SHLIB_LINK)
232+
233+ endif
234+
235+ else
236+
237+ # WIN case
216238$(shlib) lib$(NAME).a: $(OBJS) $(SRCDIR)/utils/dllinit.o
217239$(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
218240$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(SRCDIR)/utils/dllinit.o $(DLLINIT) $(SHLIB_LINK)