Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions src/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ LOCALOBJS += utils/probes.o
endif
endif

# FIXME: The --enable-shared-postgres-backend parameter build the postgres.so shared between postmaster
# FIXME: The --enable-shared-postgres-backend parameter build the libpostgres.so shared between postmaster
# But we only test it locally without CI test. Please use it with caution.
ifeq ($(enable_shared_postgres_backend),yes)
OBJS = $(LOCALOBJS) $(SUBDIROBJS)
else
OBJS = \
$(LOCALOBJS) \
$(SUBDIROBJS) \
$(top_builddir)/src/common/libpgcommon_srv.a \
$(top_builddir)/src/port/libpgport_srv.a

endif
ifeq ($(PORTNAME), darwin)
LDOPTS = -Z
endif
Expand Down Expand Up @@ -86,13 +82,15 @@ ifneq ($(PORTNAME), win32)
ifneq ($(PORTNAME), aix)

ifeq ($(enable_shared_postgres_backend),yes)
postgres.so: $(OBJS)
$(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) $(filter-out main/main.o, $(call expand_subsys,$^)) -o $@
libpostgres.so: $(OBJS)
$(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_SL) $(export_dynamic) \
$(filter-out main/main.o, $(call expand_subsys,$^)) $(LIBS) -o $@

postgres: main/main.o postgres.so $(top_builddir)/src/port/libpgport_srv.a $(top_builddir)/src/common/libpgcommon_srv.a
postgres: main/main.o libpostgres.so $(top_builddir)/src/port/libpgport_srv.a $(top_builddir)/src/common/libpgcommon_srv.a
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) \
main/main.o postgres.so $(top_builddir)/src/port/libpgport_srv.a \
main/main.o libpostgres.so $(top_builddir)/src/port/libpgport_srv.a \
$(top_builddir)/src/common/libpgcommon_srv.a $(LIBS) -o $@

else
postgres: $(OBJS)
$(CXX) $(CXXFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) $(LIBS) -o $@
Expand Down Expand Up @@ -152,13 +150,8 @@ $(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport

# The postgres.o target is needed by the rule in Makefile.global that
# creates the exports file when MAKE_EXPORTS = true.
ifeq ($(enable_shared_postgres_backend),yes)
postgres.o: $(OBJS) $(top_builddir)/src/port/libpgport_srv.a $(top_builddir)/src/common/libpgcommon_srv.a
$(CXX) $(LDREL) $(call expand_subsys,$^) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
else
postgres.o: $(OBJS)
$(CXX) $(LDREL) $(call expand_subsys,$^) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
endif

# The following targets are specified in make commands that appear in
# the make files in our subdirectories. Note that it's important we
Expand Down Expand Up @@ -272,7 +265,7 @@ endif
install-bin: postgres $(POSTGRES_IMP) installdirs
$(INSTALL_PROGRAM) postgres$(X) '$(DESTDIR)$(bindir)/postgres$(X)'
ifeq ($(enable_shared_postgres_backend),yes)
$(INSTALL_PROGRAM) postgres.so '$(DESTDIR)$(libdir)/postgres.so'
$(INSTALL_PROGRAM) libpostgres.so '$(DESTDIR)$(libdir)/libpostgres.so'
endif
ifneq ($(PORTNAME), win32)
@rm -f $(DESTDIR)$(bindir)/postmaster$(X)
Expand Down Expand Up @@ -311,7 +304,7 @@ endif
uninstall:
rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(bindir)/postmaster $(DESTDIR)$(bindir)/cdbsyncmaster
ifeq ($(enable_shared_postgres_backend),yes)
rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(libdir)/postgres.so $(DESTDIR)$(bindir)/postmaster $(DESTDIR)$(bindir)/cdbsyncmaster
rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(libdir)/libpostgres.so $(DESTDIR)$(bindir)/postmaster $(DESTDIR)$(bindir)/cdbsyncmaster
endif
ifeq ($(MAKE_EXPORTS), true)
rm -f '$(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)'
Expand Down Expand Up @@ -349,7 +342,7 @@ endif
clean:
rm -f $(LOCALOBJS) postgres$(X) $(POSTGRES_IMP)
ifeq ($(enable_shared_postgres_backend),yes)
rm -f $(LOCALOBJS) postgres.so $(POSTGRES_IMP)
rm -f $(LOCALOBJS) libpostgres.so $(POSTGRES_IMP)
endif
ifeq ($(PORTNAME), cygwin)
rm -f postgres.dll libpostgres.a
Expand Down