@@ -47,18 +47,14 @@ LOCALOBJS += utils/probes.o
4747endif
4848endif
4949
50- # FIXME: The --enable-shared-postgres-backend parameter build the postgres .so shared between postmaster
50+ # FIXME: The --enable-shared-postgres-backend parameter build the libpostgres .so shared between postmaster
5151# But we only test it locally without CI test. Please use it with caution.
52- ifeq ($(enable_shared_postgres_backend ) ,yes)
53- OBJS = $(LOCALOBJS ) $(SUBDIROBJS )
54- else
5552OBJS = \
5653 $(LOCALOBJS ) \
5754 $(SUBDIROBJS ) \
5855 $(top_builddir ) /src/common/libpgcommon_srv.a \
5956 $(top_builddir ) /src/port/libpgport_srv.a
6057
61- endif
6258ifeq ($(PORTNAME ) , darwin)
6359LDOPTS = -Z
6460endif
@@ -86,13 +82,15 @@ ifneq ($(PORTNAME), win32)
8682ifneq ($(PORTNAME ) , aix)
8783
8884ifeq ($(enable_shared_postgres_backend ) ,yes)
89- postgres.so : $(OBJS )
90- $(CXX ) -shared $(CXXFLAGS ) $(LDFLAGS ) $(LDFLAGS_EX ) $(export_dynamic ) $(filter-out main/main.o, $(call expand_subsys,$^ ) ) -o $@
85+ libpostgres.so : $(OBJS )
86+ $(CXX ) -shared $(CXXFLAGS ) $(LDFLAGS ) $(LDFLAGS_SL ) $(export_dynamic ) \
87+ $(filter-out main/main.o, $(call expand_subsys,$^ ) ) $(LIBS ) -o $@
9188
92- postgres : main/main.o postgres .so $(top_builddir ) /src/port/libpgport_srv.a $(top_builddir ) /src/common/libpgcommon_srv.a
89+ postgres : main/main.o libpostgres .so $(top_builddir ) /src/port/libpgport_srv.a $(top_builddir ) /src/common/libpgcommon_srv.a
9390 $(CXX ) $(CXXFLAGS ) $(LDFLAGS ) $(LDFLAGS_EX ) $(export_dynamic ) \
94- main/main.o postgres .so $(top_builddir ) /src/port/libpgport_srv.a \
91+ main/main.o libpostgres .so $(top_builddir ) /src/port/libpgport_srv.a \
9592 $(top_builddir ) /src/common/libpgcommon_srv.a $(LIBS ) -o $@
93+
9694else
9795postgres : $(OBJS )
9896 $(CXX ) $(CXXFLAGS ) $(call expand_subsys,$^ ) $(LDFLAGS ) $(LDFLAGS_EX ) $(export_dynamic ) $(LIBS ) -o $@
@@ -152,13 +150,8 @@ $(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
152150
153151# The postgres.o target is needed by the rule in Makefile.global that
154152# creates the exports file when MAKE_EXPORTS = true.
155- ifeq ($(enable_shared_postgres_backend ) ,yes)
156- postgres.o : $(OBJS ) $(top_builddir ) /src/port/libpgport_srv.a $(top_builddir ) /src/common/libpgcommon_srv.a
157- $(CXX ) $(LDREL ) $(call expand_subsys,$^ ) $(LDFLAGS ) $(LDFLAGS_EX ) $(LIBS ) -o $@
158- else
159153postgres.o : $(OBJS )
160154 $(CXX ) $(LDREL ) $(call expand_subsys,$^ ) $(LDFLAGS ) $(LDFLAGS_EX ) $(LIBS ) -o $@
161- endif
162155
163156# The following targets are specified in make commands that appear in
164157# the make files in our subdirectories. Note that it's important we
@@ -272,7 +265,7 @@ endif
272265install-bin : postgres $(POSTGRES_IMP ) installdirs
273266 $(INSTALL_PROGRAM ) postgres$(X ) ' $(DESTDIR)$(bindir)/postgres$(X)'
274267ifeq ($(enable_shared_postgres_backend ) ,yes)
275- $(INSTALL_PROGRAM) postgres .so '$(DESTDIR)$(libdir)/postgres .so'
268+ $(INSTALL_PROGRAM) libpostgres .so '$(DESTDIR)$(libdir)/libpostgres .so'
276269endif
277270ifneq ($(PORTNAME ) , win32)
278271 @rm -f $(DESTDIR)$(bindir)/postmaster$(X)
@@ -311,7 +304,7 @@ endif
311304uninstall :
312305 rm -f $(DESTDIR )$(bindir ) /postgres$(X ) $(DESTDIR )$(bindir ) /postmaster $(DESTDIR )$(bindir ) /cdbsyncmaster
313306ifeq ($(enable_shared_postgres_backend ) ,yes)
314- rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(libdir)/postgres .so $(DESTDIR)$(bindir)/postmaster $(DESTDIR)$(bindir)/cdbsyncmaster
307+ rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(libdir)/libpostgres .so $(DESTDIR)$(bindir)/postmaster $(DESTDIR)$(bindir)/cdbsyncmaster
315308endif
316309ifeq ($(MAKE_EXPORTS ) , true)
317310 rm -f '$(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)'
@@ -349,7 +342,7 @@ endif
349342clean :
350343 rm -f $(LOCALOBJS ) postgres$(X ) $(POSTGRES_IMP )
351344ifeq ($(enable_shared_postgres_backend ) ,yes)
352- rm -f $(LOCALOBJS) postgres .so $(POSTGRES_IMP)
345+ rm -f $(LOCALOBJS) libpostgres .so $(POSTGRES_IMP)
353346endif
354347ifeq ($(PORTNAME ) , cygwin)
355348 rm -f postgres.dll libpostgres.a
0 commit comments