Commit 6b7ef076 authored by Bruce Momjian's avatar Bruce Momjian

Have libpgport link before libpq so that PG client applications are more

immunte to changes in libpq's usage of pgport between major versions.
parent 410fede0
# $PostgreSQL: pgsql/contrib/dbase/Makefile,v 1.6 2004/08/20 20:13:02 momjian Exp $ # $PostgreSQL: pgsql/contrib/dbase/Makefile,v 1.7 2005/03/25 18:17:10 momjian Exp $
PROGRAM = dbf2pg PROGRAM = dbf2pg
OBJS = dbf.o dbf2pg.o endian.o OBJS = dbf.o dbf2pg.o endian.o
PG_CPPFLAGS = -I$(libpq_srcdir) PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq) PG_LIBS = $(libpq_pgport)
# Uncomment this to provide charset translation # Uncomment this to provide charset translation
#PG_CPPFLAGS += -DHAVE_ICONV_H #PG_CPPFLAGS += -DHAVE_ICONV_H
......
# $PostgreSQL: pgsql/contrib/findoidjoins/Makefile,v 1.16 2004/08/20 20:13:03 momjian Exp $ # $PostgreSQL: pgsql/contrib/findoidjoins/Makefile,v 1.17 2005/03/25 18:17:10 momjian Exp $
PROGRAM = findoidjoins PROGRAM = findoidjoins
OBJS = findoidjoins.o OBJS = findoidjoins.o
PG_CPPFLAGS = -I$(libpq_srcdir) PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq) PG_LIBS = $(libpq_pgport)
SCRIPTS = make_oidjoins_check SCRIPTS = make_oidjoins_check
DOCS = README.findoidjoins DOCS = README.findoidjoins
......
# $PostgreSQL: pgsql/contrib/oid2name/Makefile,v 1.6 2004/08/20 20:13:05 momjian Exp $ # $PostgreSQL: pgsql/contrib/oid2name/Makefile,v 1.7 2005/03/25 18:17:11 momjian Exp $
PROGRAM = oid2name PROGRAM = oid2name
OBJS = oid2name.o OBJS = oid2name.o
PG_CPPFLAGS = -I$(libpq_srcdir) PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq) PG_LIBS = $(libpq_pgport)
DOCS = README.oid2name DOCS = README.oid2name
......
...@@ -2,7 +2,7 @@ PROGRAM = pg_autovacuum ...@@ -2,7 +2,7 @@ PROGRAM = pg_autovacuum
OBJS = pg_autovacuum.o dllist.o OBJS = pg_autovacuum.o dllist.o
PG_CPPFLAGS = -I$(libpq_srcdir) -DFRONTEND PG_CPPFLAGS = -I$(libpq_srcdir) -DFRONTEND
PG_LIBS = $(libpq) PG_LIBS = $(libpq_pgport)
DOCS = README.pg_autovacuum DOCS = README.pg_autovacuum
......
# $PostgreSQL: pgsql/contrib/pg_dumplo/Makefile,v 1.13 2004/08/20 20:13:05 momjian Exp $ # $PostgreSQL: pgsql/contrib/pg_dumplo/Makefile,v 1.14 2005/03/25 18:17:11 momjian Exp $
PROGRAM = pg_dumplo PROGRAM = pg_dumplo
OBJS = main.o lo_export.o lo_import.o utils.o OBJS = main.o lo_export.o lo_import.o utils.o
PG_CPPFLAGS = -I$(libpq_srcdir) PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq) PG_LIBS = $(libpq_pgport)
DOCS = README.pg_dumplo DOCS = README.pg_dumplo
......
# $PostgreSQL: pgsql/contrib/pgbench/Makefile,v 1.12 2004/08/20 20:13:06 momjian Exp $ # $PostgreSQL: pgsql/contrib/pgbench/Makefile,v 1.13 2005/03/25 18:17:11 momjian Exp $
PROGRAM = pgbench PROGRAM = pgbench
OBJS = pgbench.o OBJS = pgbench.o
PG_CPPFLAGS = -I$(libpq_srcdir) PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq) PG_LIBS = $(libpq_pgport)
DOCS = README.pgbench README.pgbench_jis DOCS = README.pgbench README.pgbench_jis
......
# $PostgreSQL: pgsql/contrib/vacuumlo/Makefile,v 1.13 2004/08/20 20:13:10 momjian Exp $ # $PostgreSQL: pgsql/contrib/vacuumlo/Makefile,v 1.14 2005/03/25 18:17:12 momjian Exp $
PROGRAM = vacuumlo PROGRAM = vacuumlo
OBJS = vacuumlo.o OBJS = vacuumlo.o
PG_CPPFLAGS = -I$(libpq_srcdir) PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq) PG_LIBS = $(libpq_pgport)
DOCS = README.vacuumlo DOCS = README.vacuumlo
......
# -*-makefile-*- # -*-makefile-*-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.211 2005/03/24 23:53:48 tgl Exp $ # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.212 2005/03/25 18:17:12 momjian Exp $
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets, # All PostgreSQL makefiles include this file and use the variables it sets,
...@@ -306,6 +306,8 @@ libpq_srcdir = $(top_srcdir)/src/interfaces/libpq ...@@ -306,6 +306,8 @@ libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
libpq_builddir = $(top_builddir)/src/interfaces/libpq libpq_builddir = $(top_builddir)/src/interfaces/libpq
endif endif
# This is for use for libraries linking to libpq. Because libpqport
# isn't created with the same link flags as libpq, it can't be used.
libpq = -L$(libpq_builddir) -lpq libpq = -L$(libpq_builddir) -lpq
# If doing static linking, shared library dependency can't be # If doing static linking, shared library dependency can't be
...@@ -320,6 +322,19 @@ libpq += $(PTHREAD_LIBS) ...@@ -320,6 +322,19 @@ libpq += $(PTHREAD_LIBS)
endif endif
endif endif
# Force clients to pull symbols from the non-shared library libpgport
# rather than pulling some libpgport symbols from libpq just because
# libpq uses those functions too. This makes applications less
# dependent on changes in libpq's usage of pgport. To do this we link to
# pgport before libpq. This does cause duplicate -lpgport's to appear
# on client link lines.
ifdef PGXS
libpq_pgport = -L$(libdir) -lpgport $(libpq)
else
libpq_pgport = -L$(top_builddir)/src/port -lpgport $(libpq)
endif
submake-libpq: submake-libpq:
$(MAKE) -C $(libpq_builddir) all $(MAKE) -C $(libpq_builddir) all
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.48 2004/12/31 22:02:59 pgsql Exp $ # $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.49 2005/03/25 18:17:12 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -21,7 +21,7 @@ OBJS= initdb.o $(WIN32RES) ...@@ -21,7 +21,7 @@ OBJS= initdb.o $(WIN32RES)
all: submake-libpq submake-libpgport initdb all: submake-libpq submake-libpgport initdb
initdb: $(OBJS) $(libpq_builddir)/libpq.a initdb: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
install: all installdirs install: all installdirs
$(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X) $(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.19 2004/12/31 22:03:05 pgsql Exp $ # $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.20 2005/03/25 18:17:13 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -21,7 +21,7 @@ OBJS= pg_ctl.o $(WIN32RES) ...@@ -21,7 +21,7 @@ OBJS= pg_ctl.o $(WIN32RES)
all: submake-libpq submake-libpgport pg_ctl all: submake-libpq submake-libpgport pg_ctl
pg_ctl: $(OBJS) $(libpq_builddir)/libpq.a pg_ctl: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
install: all installdirs install: all installdirs
$(INSTALL_PROGRAM) pg_ctl$(X) $(DESTDIR)$(bindir)/pg_ctl$(X) $(INSTALL_PROGRAM) pg_ctl$(X) $(DESTDIR)$(bindir)/pg_ctl$(X)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.59 2005/01/01 20:44:23 tgl Exp $ # $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.60 2005/03/25 18:17:13 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -25,13 +25,13 @@ EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o ...@@ -25,13 +25,13 @@ EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
all: submake-libpq submake-libpgport submake-backend pg_dump pg_restore pg_dumpall all: submake-libpq submake-libpgport submake-backend pg_dump pg_restore pg_dumpall
pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(EXTRA_OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(WIN32RES) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(WIN32RES) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
.PHONY: submake-backend .PHONY: submake-backend
submake-backend: submake-backend:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.52 2005/01/01 20:44:25 tgl Exp $ # $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.53 2005/03/25 18:17:13 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -29,7 +29,7 @@ FLEXFLAGS = -Cfe ...@@ -29,7 +29,7 @@ FLEXFLAGS = -Cfe
all: submake-libpq submake-libpgport psql all: submake-libpq submake-libpgport psql
psql: $(OBJS) $(libpq_builddir)/libpq.a psql: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
help.o: $(srcdir)/sql_help.h help.o: $(srcdir)/sql_help.h
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.32 2005/01/01 20:44:26 tgl Exp $ # $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.33 2005/03/25 18:17:14 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -21,7 +21,7 @@ override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/ ...@@ -21,7 +21,7 @@ override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/
all: submake-libpq submake-backend $(PROGRAMS) all: submake-libpq submake-backend $(PROGRAMS)
%: %.o $(WIN32RES) %: %.o $(WIN32RES)
$(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
createdb: createdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o createdb: createdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
createlang: createlang.o common.o print.o mbprint.o createlang: createlang.o common.o print.o mbprint.o
......
...@@ -7,7 +7,7 @@ top_builddir = ../../.. ...@@ -7,7 +7,7 @@ top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
override LDLIBS := $(libpq) -lpgport $(LDLIBS) override LDLIBS := $(libpq_pgport) $(LDLIBS)
PROGS = testlibpq testlibpq2 testlibpq3 testlibpq4 testlo PROGS = testlibpq testlibpq2 testlibpq3 testlibpq4 testlo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment