Skip to content

Commit 12ff264

Browse files
authored
Rename postgres.so to libpostgres.so (#341)
The postgres library `postgres.so` could be linked by some extensions in their tests. It's unusual to use the name `postgres.so` when linking the library or program by `-lpostgres`. To make the name standard and link the library by `-lpostgres`, the name of the postgres library is renamed to `libpostgres.so`. Reviewed-by: Zhang Mingli <[email protected]>
1 parent a70f7ee commit 12ff264

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

src/backend/Makefile

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,14 @@ LOCALOBJS += utils/probes.o
4747
endif
4848
endif
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
5552
OBJS = \
5653
$(LOCALOBJS) \
5754
$(SUBDIROBJS) \
5855
$(top_builddir)/src/common/libpgcommon_srv.a \
5956
$(top_builddir)/src/port/libpgport_srv.a
6057

61-
endif
6258
ifeq ($(PORTNAME), darwin)
6359
LDOPTS = -Z
6460
endif
@@ -86,13 +82,15 @@ ifneq ($(PORTNAME), win32)
8682
ifneq ($(PORTNAME), aix)
8783

8884
ifeq ($(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+
9694
else
9795
postgres: $(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
159153
postgres.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
272265
install-bin: postgres $(POSTGRES_IMP) installdirs
273266
$(INSTALL_PROGRAM) postgres$(X) '$(DESTDIR)$(bindir)/postgres$(X)'
274267
ifeq ($(enable_shared_postgres_backend),yes)
275-
$(INSTALL_PROGRAM) postgres.so '$(DESTDIR)$(libdir)/postgres.so'
268+
$(INSTALL_PROGRAM) libpostgres.so '$(DESTDIR)$(libdir)/libpostgres.so'
276269
endif
277270
ifneq ($(PORTNAME), win32)
278271
@rm -f $(DESTDIR)$(bindir)/postmaster$(X)
@@ -311,7 +304,7 @@ endif
311304
uninstall:
312305
rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(bindir)/postmaster $(DESTDIR)$(bindir)/cdbsyncmaster
313306
ifeq ($(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
315308
endif
316309
ifeq ($(MAKE_EXPORTS), true)
317310
rm -f '$(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)'
@@ -349,7 +342,7 @@ endif
349342
clean:
350343
rm -f $(LOCALOBJS) postgres$(X) $(POSTGRES_IMP)
351344
ifeq ($(enable_shared_postgres_backend),yes)
352-
rm -f $(LOCALOBJS) postgres.so $(POSTGRES_IMP)
345+
rm -f $(LOCALOBJS) libpostgres.so $(POSTGRES_IMP)
353346
endif
354347
ifeq ($(PORTNAME), cygwin)
355348
rm -f postgres.dll libpostgres.a

0 commit comments

Comments
 (0)