Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdddfc4c

Browse files
committed
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches inlink command lines, such that -L switches referring to external directoriescould come before those referring to directories within the build tree.This made it possible to accidentally link a system-supplied library, forexample /usr/lib/libpq.so, in place of the one built in the build tree.Hilarity ensued, the more so the older the system-supplied library is.To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNALand the main LDFLAGS variable, both of which are "recursively expanded"so that they can be incrementally adjusted by different makefiles.Establish a policy that -L switches for directories in the build treemust always be added to LDFLAGS_INTERNAL, while -L switches for externaldirectories must always be added to LDFLAGS. This is sufficient toensure a safe search order. For simplicity, we typically also put -lswitches for the respective libraries into those same variables.(Traditional make usage would have us put -l switches into LIBS, butcleaning that up is a project for another day, as there's no clearneed for it.)This turns out to also require separating SHLIB_LINK into two variables,SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about whichswitches go into which variable. And likewise for PG_LIBS.Although this change might appear to affect external users of pgxs.mk,I think it doesn't; they shouldn't have any need to touch the _INTERNALvariables.In passing, tweak src/common/Makefile so that the value of CPPFLAGSrecorded in pg_config lacks "-DFRONTEND" and the recorded value ofLDFLAGS lacks "-L../../../src/common". Both of those things aremistakes, apparently introduced during prior code rearrangements,as old versions of pg_config don't print them. In general we don'twant anything that's specific to the src/common subdirectory toappear in those outputs.This is certainly a bug fix, but in view of the lack of fieldcomplaints, I'm unsure whether it's worth the risk of back-patching.In any case it seems wise to see what the buildfarm makes of it first.Discussion:https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
1 parentd4a4c3d commitdddfc4c

File tree

32 files changed

+66
-49
lines changed

32 files changed

+66
-49
lines changed

‎contrib/dblink/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
MODULE_big = dblink
44
OBJS= dblink.o$(WIN32RES)
55
PG_CPPFLAGS = -I$(libpq_srcdir)
6-
SHLIB_LINK =$(libpq)
6+
SHLIB_LINK_INTERNAL =$(libpq)
77

88
EXTENSION = dblink
99
DATA = dblink--1.2.sql dblink--1.1--1.2.sql dblink--1.0--1.1.sql\

‎contrib/hstore_plperl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ifeq ($(PORTNAME), win32)
2828
# these settings are the same as for plperl
2929
overrideCPPFLAGS += -DPLPERL_HAVE_UID_GID -Wno-comment
3030
# ... see silliness in plperl Makefile ...
31-
SHLIB_LINK +=$(sort$(wildcard ../../src/pl/plperl/libperl*.a))
31+
SHLIB_LINK_INTERNAL +=$(sort$(wildcard ../../src/pl/plperl/libperl*.a))
3232
else
3333
rpathdir =$(perl_archlibexp)/CORE
3434
SHLIB_LINK +=$(perl_embed_ldflags)

‎contrib/hstore_plpython/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626
# We must link libpython explicitly
2727
ifeq ($(PORTNAME), win32)
2828
# ... see silliness in plpython Makefile ...
29-
SHLIB_LINK +=$(sort$(wildcard ../../src/pl/plpython/libpython*.a))
29+
SHLIB_LINK_INTERNAL +=$(sort$(wildcard ../../src/pl/plpython/libpython*.a))
3030
else
3131
rpathdir =$(python_libdir)
3232
SHLIB_LINK +=$(python_libspec)$(python_additional_libs)

‎contrib/jsonb_plperl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ifeq ($(PORTNAME), win32)
2727
# these settings are the same as for plperl
2828
overrideCPPFLAGS += -DPLPERL_HAVE_UID_GID -Wno-comment
2929
# ... see silliness in plperl Makefile ...
30-
SHLIB_LINK +=$(sort$(wildcard ../../src/pl/plperl/libperl*.a))
30+
SHLIB_LINK_INTERNAL +=$(sort$(wildcard ../../src/pl/plperl/libperl*.a))
3131
else
3232
rpathdir =$(perl_archlibexp)/CORE
3333
SHLIB_LINK +=$(perl_embed_ldflags)

‎contrib/jsonb_plpython/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626
# We must link libpython explicitly
2727
ifeq ($(PORTNAME), win32)
2828
# ... see silliness in plpython Makefile ...
29-
SHLIB_LINK +=$(sort$(wildcard ../../src/pl/plpython/libpython*.a))
29+
SHLIB_LINK_INTERNAL +=$(sort$(wildcard ../../src/pl/plpython/libpython*.a))
3030
else
3131
rpathdir =$(python_libdir)
3232
SHLIB_LINK +=$(python_libspec)$(python_additional_libs)

‎contrib/ltree_plpython/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626
# We must link libpython explicitly
2727
ifeq ($(PORTNAME), win32)
2828
# ... see silliness in plpython Makefile ...
29-
SHLIB_LINK +=$(sort$(wildcard ../../src/pl/plpython/libpython*.a))
29+
SHLIB_LINK_INTERNAL +=$(sort$(wildcard ../../src/pl/plpython/libpython*.a))
3030
else
3131
rpathdir =$(python_libdir)
3232
SHLIB_LINK +=$(python_libspec)$(python_additional_libs)

‎contrib/oid2name/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PROGRAM = oid2name
77
OBJS= oid2name.o$(WIN32RES)
88

99
PG_CPPFLAGS = -I$(libpq_srcdir)
10-
PG_LIBS =$(libpq_pgport)
10+
PG_LIBS_INTERNAL =$(libpq_pgport)
1111

1212
ifdefUSE_PGXS
1313
PG_CONFIG = pg_config

‎contrib/postgres_fdw/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ OBJS = postgres_fdw.o option.o deparse.o connection.o shippable.o $(WIN32RES)
55
PGFILEDESC = "postgres_fdw - foreign data wrapper for PostgreSQL"
66

77
PG_CPPFLAGS = -I$(libpq_srcdir)
8-
SHLIB_LINK =$(libpq)
8+
SHLIB_LINK_INTERNAL =$(libpq)
99

1010
EXTENSION = postgres_fdw
1111
DATA = postgres_fdw--1.0.sql

‎contrib/spi/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ DOCS = $(addsuffix .example, $(MODULES))
1717
# comment out if you want a quieter refint package for other uses
1818
PG_CPPFLAGS = -DREFINT_VERBOSE
1919

20-
LDFLAGS_SL += -L$(top_builddir)/src/port -lpgport
21-
2220
ifdefUSE_PGXS
2321
PG_CONFIG = pg_config
2422
PGXS :=$(shell$(PG_CONFIG) --pgxs)

‎contrib/vacuumlo/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PROGRAM = vacuumlo
77
OBJS= vacuumlo.o$(WIN32RES)
88

99
PG_CPPFLAGS = -I$(libpq_srcdir)
10-
PG_LIBS =$(libpq_pgport)
10+
PG_LIBS_INTERNAL =$(libpq_pgport)
1111

1212
ifdefUSE_PGXS
1313
PG_CONFIG = pg_config

‎src/Makefile.global.in

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,17 +290,26 @@ LLVM_LIBS=@LLVM_LIBS@
290290
LD = @LD@
291291
with_gnu_ld = @with_gnu_ld@
292292

293-
# We want -L for libpgport.a and libpgcommon.a to be first in LDFLAGS. We
294-
# also need LDFLAGS to be a "recursively expanded" variable, else adjustments
295-
# to rpathdir don't work right. So we must NOT do LDFLAGS := something,
296-
# meaning this has to be done first and elsewhere we must only do LDFLAGS +=
297-
# something.
293+
# It's critical that within LDFLAGS, all -L switches pointing to build-tree
294+
# directories come before any -L switches pointing to external directories.
295+
# Otherwise it's possible for, e.g., a platform-provided copy of libpq.so
296+
# to get linked in place of the one we've built. Therefore we adopt the
297+
# convention that the first component of LDFLAGS is an extra variable
298+
# LDFLAGS_INTERNAL, and -L and -l switches for PG's own libraries must be
299+
# put into LDFLAGS_INTERNAL, so they will appear ahead of those for external
300+
# libraries.
301+
#
302+
# We need LDFLAGS and LDFLAGS_INTERNAL to be "recursively expanded" variables,
303+
# else adjustments to, e.g., rpathdir don't work right. So we must NOT do
304+
# "LDFLAGS := something" anywhere, ditto for LDFLAGS_INTERNAL.
305+
# These initial assignments must be "=" type, and elsewhere we must only do
306+
# "LDFLAGS += something" or "LDFLAGS_INTERNAL += something".
298307
ifdefPGXS
299-
LDFLAGS = -L$(libdir)
308+
LDFLAGS_INTERNAL = -L$(libdir)
300309
else
301-
LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
310+
LDFLAGS_INTERNAL = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
302311
endif
303-
LDFLAGS+= @LDFLAGS@
312+
LDFLAGS=$(LDFLAGS_INTERNAL) @LDFLAGS@
304313

305314
LDFLAGS_EX = @LDFLAGS_EX@
306315
# LDFLAGS_SL might have already been assigned by calling makefile

‎src/Makefile.shlib

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
#
2121
# NAME Name of library to build (no suffix nor "lib" prefix)
2222
# OBJS List of object files to include in library
23-
# SHLIB_LINK If shared library relies on other libraries,
24-
# additional stuff to put in its link command
23+
# SHLIB_LINK Stuff to append to library's link command
24+
# (typically, -L and -l switches for external libraries)
25+
# SHLIB_LINK_INTERNAL -L and -l switches for Postgres-supplied libraries
2526
# SHLIB_PREREQS Order-only prerequisites for library build target
2627
# SHLIB_EXPORTS (optional) Name of file containing list of symbols to
2728
# export, in the format "function_name number"
2829
#
30+
# Don't use SHLIB_LINK for references to files in the build tree, or the
31+
# wrong things will happen --- use SHLIB_LINK_INTERNAL for those!
32+
#
2933
# When building a shared library, the following version information
3034
# must also be set. It should be omitted when building a dynamically
3135
# loadable module.
@@ -70,6 +74,8 @@
7074
COMPILER = $(CC) $(CFLAGS)
7175
LINK.static = $(AR) $(AROPT)
7276

77+
LDFLAGS_INTERNAL += $(SHLIB_LINK_INTERNAL)
78+
7379

7480

7581
ifdef SO_MAJOR_VERSION

‎src/backend/replication/libpqwalreceiver/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ include $(top_builddir)/src/Makefile.global
1515
overrideCPPFLAGS := -I$(srcdir) -I$(libpq_srcdir)$(CPPFLAGS)
1616

1717
OBJS = libpqwalreceiver.o$(WIN32RES)
18-
SHLIB_LINK =$(libpq)$(filter -lintl,$(LIBS))
18+
SHLIB_LINK_INTERNAL =$(libpq)
19+
SHLIB_LINK =$(filter -lintl,$(LIBS))
1920
SHLIB_PREREQS = submake-libpq
2021
PGFILEDESC = "libpqwalreceiver - receive WAL during streaming replication"
2122
NAME = libpqwalreceiver

‎src/bin/initdb/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include $(top_builddir)/src/Makefile.global
1919
overrideCPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone$(CPPFLAGS)
2020

2121
# note: we need libpq only because fe_utils does
22-
overrideLDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)$(LDFLAGS)
22+
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
2323

2424
# use system timezone data?
2525
ifneq (,$(with_system_tzdata))

‎src/bin/pg_basebackup/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ top_builddir = ../../..
1919
include$(top_builddir)/src/Makefile.global
2020

2121
overrideCPPFLAGS := -I$(libpq_srcdir)$(CPPFLAGS)
22-
overrideLDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)$(LDFLAGS)
22+
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
2323

2424
OBJS=receivelog.o streamutil.o walmethods.o$(WIN32RES)
2525

‎src/bin/pg_ctl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include $(top_builddir)/src/Makefile.global
2020
# but let's not pull that in on platforms where we don't need it.
2121
ifeq ($(PORTNAME), win32)
2222
overrideCPPFLAGS := -I$(libpq_srcdir)$(CPPFLAGS)
23-
overrideLDFLAGS :=$(libpq_pgport)$(LDFLAGS)
23+
LDFLAGS_INTERNAL +=$(libpq_pgport)
2424
SUBMAKE_LIBPQ := submake-libpq
2525
endif
2626

‎src/bin/pg_dump/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ top_builddir = ../../..
1717
include$(top_builddir)/src/Makefile.global
1818

1919
overrideCPPFLAGS := -I$(libpq_srcdir)$(CPPFLAGS)
20-
overrideLDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)$(LDFLAGS)
20+
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
2121

2222
OBJS=pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o\
2323
pg_backup_null.o pg_backup_tar.o pg_backup_directory.o\

‎src/bin/pg_rewind/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ top_builddir = ../../..
1616
include$(top_builddir)/src/Makefile.global
1717

1818
overrideCPPFLAGS := -I$(libpq_srcdir) -DFRONTEND$(CPPFLAGS)
19-
overrideLDFLAGS :=$(libpq_pgport)$(LDFLAGS)
19+
LDFLAGS_INTERNAL +=$(libpq_pgport)
2020

2121
OBJS= pg_rewind.o parsexlog.o xlogreader.o datapagemap.o timeline.o\
2222
fetch.o file_ops.o copy_fetch.o libpq_fetch.o filemap.o logging.o\

‎src/bin/pg_upgrade/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o \
1212
tablespace.o util.o version.o$(WIN32RES)
1313

1414
overrideCPPFLAGS := -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir)$(CPPFLAGS)
15-
overrideLDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)$(LDFLAGS)
15+
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
1616

1717

1818
all: pg_upgrade

‎src/bin/pgbench/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include $(top_builddir)/src/Makefile.global
1010
OBJS = pgbench.o exprparse.o$(WIN32RES)
1111

1212
overrideCPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir)$(CPPFLAGS)
13-
overrideLDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)$(LDFLAGS)
13+
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
1414

1515
ifneq ($(PORTNAME), win32)
1616
overrideCFLAGS +=$(PTHREAD_CFLAGS)

‎src/bin/psql/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include $(top_builddir)/src/Makefile.global
1919
REFDOCDIR=$(top_srcdir)/doc/src/sgml/ref
2020

2121
overrideCPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir)$(CPPFLAGS)
22-
overrideLDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)$(LDFLAGS)
22+
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
2323

2424
OBJS=command.o common.o copy.o crosstabview.o\
2525
describe.o help.o input.o large_obj.o mainloop.o\

‎src/bin/scripts/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include $(top_builddir)/src/Makefile.global
1919
PROGRAMS = createdb createuser dropdb dropuser clusterdb vacuumdb reindexdb pg_isready
2020

2121
overrideCPPFLAGS := -I$(libpq_srcdir)$(CPPFLAGS)
22-
overrideLDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)$(LDFLAGS)
22+
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils$(libpq_pgport)
2323

2424
all:$(PROGRAMS)
2525

‎src/common/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ subdir = src/common
2424
top_builddir = ../..
2525
include$(top_builddir)/src/Makefile.global
2626

27-
overrideCPPFLAGS := -DFRONTEND$(CPPFLAGS)
28-
LIBS +=$(PTHREAD_LIBS)
29-
3027
# don't include subdirectory-path-dependent -I and -L switches
3128
STD_CPPFLAGS :=$(filter-out -I$(top_srcdir)/src/include -I$(top_builddir)/src/include,$(CPPFLAGS))
32-
STD_LDFLAGS :=$(filter-out -L$(top_builddir)/src/port,$(LDFLAGS))
29+
STD_LDFLAGS :=$(filter-out -L$(top_builddir)/src/common -L$(top_builddir)/src/port,$(LDFLAGS))
3330
overrideCPPFLAGS += -DVAL_CONFIGURE="\"$(configure_args)\""
3431
overrideCPPFLAGS += -DVAL_CC="\"$(CC)\""
3532
overrideCPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\""
@@ -40,6 +37,9 @@ override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""
4037
overrideCPPFLAGS += -DVAL_LDFLAGS_SL="\"$(LDFLAGS_SL)\""
4138
overrideCPPFLAGS += -DVAL_LIBS="\"$(LIBS)\""
4239

40+
overrideCPPFLAGS := -DFRONTEND$(CPPFLAGS)
41+
LIBS +=$(PTHREAD_LIBS)
42+
4343
OBJS_COMMON = base64.o config_info.o controldata_utils.o exec.o ip.o\
4444
keywords.o md5.o pg_lzcompress.o pgfnames.o psprintf.o relpath.o\
4545
rmtree.o saslprep.o scram-common.o string.o unicode_norm.o\

‎src/interfaces/ecpg/compatlib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
2222
-I$(libpq_srcdir) -DFRONTEND$(CPPFLAGS)
2323
overrideCFLAGS +=$(PTHREAD_CFLAGS)
2424

25-
SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes$(libpq)\
26-
$(filter -lintl -lm,$(LIBS))$(PTHREAD_LIBS)
25+
SHLIB_LINK_INTERNAL = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes$(libpq)
26+
SHLIB_LINK =$(filter -lintl -lm,$(LIBS))$(PTHREAD_LIBS)
2727
SHLIB_PREREQS = submake-ecpglib submake-pgtypeslib
2828

2929
SHLIB_EXPORTS = exports.txt

‎src/interfaces/ecpg/ecpglib/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ ifneq ($(PORTNAME), win32)
3535
OBJS += thread.o
3636
endif
3737

38-
SHLIB_LINK = -L../pgtypeslib -lpgtypes$(libpq)$(filter -lintl -lm,$(LIBS))$(PTHREAD_LIBS)
38+
SHLIB_LINK_INTERNAL = -L../pgtypeslib -lpgtypes$(libpq)
39+
SHLIB_LINK =$(filter -lintl -lm,$(LIBS))$(PTHREAD_LIBS)
3940
SHLIB_PREREQS = submake-libpq submake-pgtypeslib
4041

4142
SHLIB_EXPORTS = exports.txt

‎src/interfaces/ecpg/pgtypeslib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ override CFLAGS += $(PTHREAD_CFLAGS)
2525
# Need to recompile any libpgport object files
2626
LIBS :=$(filter-out -lpgport,$(LIBS))
2727

28-
SHLIB_LINK += -lm
28+
SHLIB_LINK +=$(filter-lm,$(LIBS))
2929

3030
SHLIB_EXPORTS = exports.txt
3131

‎src/interfaces/ecpg/test/Makefile.regress

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ override CPPFLAGS := -I../../include -I$(top_srcdir)/src/interfaces/ecpg/include
55
-I$(libpq_srcdir) $(CPPFLAGS)
66
override CFLAGS += $(PTHREAD_CFLAGS)
77

8-
override LDFLAGS := -L../../ecpglib -L../../pgtypeslib $(filter-out -l%, $(libpq)) $(LDFLAGS)
9-
override LIBS := -lecpg -lpgtypes $(filter -l%, $(libpq)) $(LIBS) $(PTHREAD_LIBS)
8+
LDFLAGS_INTERNAL += -L../../ecpglib -lecpg -L../../pgtypeslib -lpgtypes $(libpq)
9+
10+
override LIBS += $(PTHREAD_LIBS)
1011

1112
# Standard way to invoke the ecpg preprocessor
1213
ECPG = ../../preproc/ecpg --regression -I$(srcdir)/../../include -I$(srcdir)

‎src/interfaces/ecpg/test/compat_informix/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ include $(top_srcdir)/$(subdir)/../Makefile.regress
66
# Use special informix compatibility switch for all tests in this directory
77
ECPG += -C INFORMIX
88

9-
overrideLDFLAGS := -L../../compatlib$(LDFLAGS)
10-
overrideLIBS := -lecpg_compat$(LIBS)
9+
LDFLAGS_INTERNAL += -L../../compatlib -lecpg_compat
1110

1211
TESTS = test_informix test_informix.c\
1312
test_informix2 test_informix2.c\

‎src/interfaces/libpq/test/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ top_builddir = ../../../..
33
include$(top_builddir)/src/Makefile.global
44

55
ifeq ($(PORTNAME), win32)
6-
LDLIBS += -lws2_32
6+
LDFLAGS += -lws2_32
77
endif
88

99
overrideCPPFLAGS := -I$(libpq_srcdir)$(CPPFLAGS)
10-
overrideLDLIBS :=$(libpq_pgport)$(LDLIBS)
10+
LDFLAGS_INTERNAL +=$(libpq_pgport)
1111

1212
PROGS = uri-regress
1313

‎src/makefiles/pgxs.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
# EXTRA_CLEAN -- extra files to remove in 'make clean'
4646
# PG_CPPFLAGS -- will be added to CPPFLAGS
4747
# PG_LIBS -- will be added to PROGRAM link line
48+
# PG_LIBS_INTERNAL -- same, for references to libraries within build tree
4849
# SHLIB_LINK -- will be added to MODULE_big link line
50+
# SHLIB_LINK_INTERNAL -- same, for references to libraries within build tree
4951
# PG_CONFIG -- path to pg_config program for the PostgreSQL installation
5052
# to build against (typically just "pg_config" to use the first one in
5153
# your PATH)
@@ -315,5 +317,5 @@ endif
315317

316318
ifdefPROGRAM
317319
$(PROGRAM):$(OBJS)
318-
$(CC)$(CFLAGS)$(OBJS)$(PG_LIBS)$(LDFLAGS)$(LDFLAGS_EX)$(LIBS) -o$@$(X)
320+
$(CC)$(CFLAGS)$(OBJS)$(PG_LIBS_INTERNAL)$(LDFLAGS)$(LDFLAGS_EX)$(PG_LIBS)$(LIBS) -o$@$(X)
319321
endif

‎src/test/examples/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ top_builddir = ../../..
77
include$(top_builddir)/src/Makefile.global
88

99
ifeq ($(PORTNAME), win32)
10-
LDLIBS += -lws2_32
10+
LDFLAGS += -lws2_32
1111
endif
1212

1313
overrideCPPFLAGS := -I$(libpq_srcdir)$(CPPFLAGS)
14-
overrideLDLIBS :=$(libpq_pgport)$(LDLIBS)
14+
LDFLAGS_INTERNAL +=$(libpq_pgport)
1515

1616

1717
PROGS = testlibpq testlibpq2 testlibpq3 testlibpq4 testlo testlo64

‎src/tools/findoidjoins/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ top_builddir = ../../..
1313
include$(top_builddir)/src/Makefile.global
1414

1515
overrideCPPFLAGS := -I$(libpq_srcdir)$(CPPFLAGS)
16-
overrideLDFLAGS :=$(libpq_pgport)$(LDFLAGS)
16+
LDFLAGS_INTERNAL +=$(libpq_pgport)
1717

1818
OBJS= findoidjoins.o
1919

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp