generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathMakefile.in
More file actions
296 lines (244 loc) · 10.9 KB
/
Makefile.in
File metadata and controls
296 lines (244 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# -*-makefile-*-
# Makefile.in
# @configure_input@
# configure output
pgactive_PGVERCOMPAT_INCDIR=@pgactive_PGVERCOMPAT_INCDIR@
pgactive_PG_MAJORVERSION=@pgactive_PG_MAJORVERSION@
# end configure output
pgactive_subdir = .
pgactive_top_builddir = .
MODULE_big = pgactive
EXTENSION = pgactive
DATA = $(wildcard $(EXTENSION)*--*.sql)
SCRIPTS_built = pgactive_init_copy pgactive_dump
EXTRA_CLEAN = src/pgactive_init_copy$(X) src/pgactive_init_copy.o include/pgactive_version.h .distgitrev \
test/tmp_check test/results test/log test/tmp_t \
test/regression.diffs test/regression.out \
pgactive_init_copy_postgres.log home tmp_test_* \
pgactive_dump$(X) $(pgactive_DUMP_OBJS) \
# When in development add -Werror.
PG_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/src/$(pgactive_PGVERCOMPAT_INCDIR) -I$(libpq_srcdir) -Wall -Wmissing-prototypes -Wmissing-declarations $(EXTRA_CFLAGS)
SHLIB_LINK = $(libpq)
OBJS = src/pgactive.o \
src/pgactive_apply.o \
src/pgactive_elog.o \
src/pgactive_dbcache.o \
src/pgactive_ddlrep.o \
src/pgactive_ddlrep_truncate.o \
src/pgactive_perdb.o \
src/pgactive_catalogs.o \
src/pgactive_conflict_handlers.o \
src/pgactive_conflict_logging.o \
src/pgactive_commandfilter.o \
src/pgactive_common.o \
src/pgactive_count.o \
src/pgactive_executor.o \
src/pgactive_init_replica.o \
src/pgactive_locks.o \
src/pgactive_node_identifier.o \
src/pgactive_nodecache.o \
src/pgactive_messaging.o \
src/pgactive_monitoring.o \
src/pgactive_output.o \
src/pgactive_protocol.o \
src/pgactive_relcache.o \
src/pgactive_remotecalls.o \
src/pgactive_seq.o \
src/pgactive_shmem.o \
src/pgactive_supervisor.o \
src/pgactive_user_mapping.o
ifdef RUN_FAILING_TESTS
# Empty if there aren't any expected-to-fail tests at the moment.
FAILING_TESTS :=
else
# By default we don't run failing tests, this will always be empty.
FAILING_TESTS :=
endif
# DDL tests run via transparent DDL replication.
DDLTESTS := ddl_enable_ddl \
ddl_create \
ddl_alter_table \
ddl_extension \
ddl_function \
ddl_grant \
ddl_mixed \
ddl_namespace \
ddl_sequence \
ddl_view \
ddl_disable_ddl
# DDL tests run via pgactive.pgactive_replicate_ddl_command wrapper.
DDLTESTS_FUNC := ddl_fn/ddl_enable_ddl \
ddl_fn/ddl_create \
ddl_fn/ddl_alter_table \
ddl_fn/ddl_extension \
ddl_fn/ddl_function \
ddl_fn/ddl_grant \
ddl_fn/ddl_mixed \
ddl_fn/ddl_namespace \
ddl_fn/ddl_sequence \
ddl_fn/ddl_view \
ddl_fn/ddl_disable_ddl
REGRESSCHECKS = init \
init_pgactive \
guc \
schema_desync \
seq \
$(FAILING_TESTS) \
ddl_lock \
$(DDLTESTS) \
$(DDLTESTS_FUNC) \
dml_basic \
dml_contrib \
dml_delete_pk \
dml_extended \
dml_replicate_ddl_command \
dml_missing_pk \
dml_toasted \
detach_pgactive
# Can only be built using pgxs
USE_PGXS=1
pgactive_abs_srcdir := @abs_srcdir@
PG_CONFIG :=@PG_CONFIG@
PGXS := $(shell $(PG_CONFIG) --pgxs)
vpath_build=@vpath_build@
ifeq ($(vpath_build),yes)
VPATH := $(pgactive_abs_srcdir)/$(pgactive_subdir)
USE_VPATH :=$(VPATH)
endif
GIT_WORK_TREE=${pgactive_abs_srcdir}
GIT_DIR=${pgactive_abs_srcdir}/.git
export GIT_DIR
export GIT_WORK_TREE
include $(PGXS)
$(info Building against PostgreSQL $(MAJORVERSION))
export PG_CONFIG
export PATH
# Modules such as btree_gist, cube, hstore and pg_trgm are used by pgactive in
# tests, i.e. if they aren't available the tests start to fail. Therefore,
# it is not required to error out.
REQUIRED_TEST_EXTENSIONS = btree_gist cube hstore pg_trgm
pgactive_DUMP_DIR := src/compat/$(pgactive_PG_MAJORVERSION)/pg_dump
pgactive_DUMP_OBJS = $(pgactive_DUMP_DIR)/pg_dump.o \
$(pgactive_DUMP_DIR)/common.o \
$(pgactive_DUMP_DIR)/pg_dump_sort.o \
$(pgactive_DUMP_DIR)/pg_backup_archiver.o \
$(pgactive_DUMP_DIR)/pg_backup_db.o \
$(pgactive_DUMP_DIR)/pg_backup_custom.o \
$(pgactive_DUMP_DIR)/pg_backup_null.o \
$(pgactive_DUMP_DIR)/pg_backup_tar.o \
$(pgactive_DUMP_DIR)/pg_backup_directory.o \
$(pgactive_DUMP_DIR)/pg_backup_utils.o \
$(pgactive_DUMP_DIR)/parallel.o \
$(pgactive_DUMP_DIR)/dumputils.o \
$(pgactive_DUMP_DIR)/compress_io.o
ifeq ($(shell test $(MAJORVERSION) -ge 18; echo $$?),0)
pgactive_DUMP_OBJS += $(pgactive_DUMP_DIR)/connectdb.o
endif
PG_CONFIG_LIBS = $(shell $(PG_CONFIG) --libs)
pgactive_DUMP_LIBS = $(PG_CONFIG_LIBS) -lpgfeutils
ifneq ($(wildcard $(pgactive_DUMP_DIR)/compress_lz4.c),)
pgactive_DUMP_OBJS += $(pgactive_DUMP_DIR)/compress_lz4.o
endif
ifneq ($(wildcard $(pgactive_DUMP_DIR)/compress_gzip.c),)
pgactive_DUMP_OBJS += $(pgactive_DUMP_DIR)/compress_gzip.o
endif
ifneq ($(wildcard $(pgactive_DUMP_DIR)/compress_none.c),)
pgactive_DUMP_OBJS += $(pgactive_DUMP_DIR)/compress_none.o
endif
ifneq ($(wildcard $(pgactive_DUMP_DIR)/compress_zstd.c),)
pgactive_DUMP_OBJS += $(pgactive_DUMP_DIR)/compress_zstd.o
endif
ifneq ($(wildcard $(pgactive_DUMP_DIR)/filter.c),)
pgactive_DUMP_OBJS += $(pgactive_DUMP_DIR)/filter.o
endif
# string_utils.c file is needed by pg_dump so we copied it from postgres source
# code src/fe_utils/ and placed it under
# src/compat/$(pgactive_PG_MAJORVERSION)/pg_dump to make pg_dump a self-reliant
# component while compiling pgactive source code.
pgactive_DUMP_OBJS += $(pgactive_DUMP_DIR)/string_utils.o
pgactive_dump: $(pgactive_DUMP_OBJS)
$(CC) $(CFLAGS) $(pgactive_DUMP_OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(pgactive_DUMP_LIBS) -o $@$(X)
pgactive_init_copy: src/pgactive_init_copy.o src/pgactive_common.o
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(PG_CONFIG_LIBS) $(libpq_pgport) -o $@$(X)
DATE=$(shell date "+%Y-%m-%d")
GITHASH=$(shell if [ -e .distgitrev ]; then cat .distgitrev; else GIT_DIR=${pgactive_abs_srcdir}/.git git rev-parse --short HEAD; fi)
pgactive_version.h: include/pgactive_version.h.in
sed -r '0,/pgactive_VERSION_DATE/s,(pgactive_VERSION_DATE).,\1 "$(DATE)",;0,/pgactive_VERSION_GITHASH/s,(pgactive_VERSION_GITHASH).,\1 "$(GITHASH)",' include/pgactive_version.h.in > include/pgactive_version.h
src/pgactive.o: pgactive_version.h
# Ensure Makefiles are up to date.
Makefile: Makefile.in config.status configure
./config.status $@
run_tests: run_tests.in config.status configure
./config.status $@
configure: configure.in
cd ${pgactive_abs_srcdir} && autoreconf
all: pgactive_init_copy pgactive_dump
check: regress_check prove_check
regress_check: all install
rm -rf test/results
mkdir -p test/results/ddl test/results/ddl_fn test/results/dml
./test/run_tests --config $(pgactive_abs_srcdir)/test/pgactive_regress.conf \
--testbinary src/test/regress/pg_regress \
$(REGRESSCHECKS)
# To run prove, we need to install a couple of things that are not usually
# copied from the postgres source tree to the install tree, namely all of
# src/test/perl needs to be copied to lib/postgresql/pgxs/src/test/perl/.
#
# This isn't done by postgres's install command, which doesn't know how to
# install them. So you'll have to copy them manually or patch your postgres
# tree to install them:
# https://www.postgresql.org/message-id/CAMsr%2BYFXv%2B2qne6xJW7z_25mYBtktRX5rpkrgrb%2pgactivegQ_FxgHQ@mail.gmail.com
ifeq ($(shell test $(MAJORVERSION) -ge 16; echo $$?),0)
$(pgxsdir)/src/test/perl/PostgreSQL/Test/Cluster.pm:
@[ -e $(pgxsdir)/src/test/perl/PostgreSQL/Test/Cluster.pm ] || ( echo -e "----ERROR----\nCannot run prove_check, copy src/test/perl/* to $(pgxsdir)/src/test/perl/ and retry\n-------------" && exit 1)
prove_check: $(pgxsdir)/src/test/perl/PostgreSQL/Test/Cluster.pm
rm -rf $(CURDIR)/test/tmp_check/
cd $(srcdir) && TESTDATADIR='$(CURDIR)/test/tmp_check' TESTLOGDIR='$(CURDIR)/test/tmp_check/log' PATH="$(shell $(PG_CONFIG) --bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(pgxsdir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(or $(PROVE_TESTS),test/t/*.pl)
else
ifeq ($(shell test $(MAJORVERSION) -eq 15; echo $$?),0)
$(pgxsdir)/src/test/perl/PostgreSQL/Test/Cluster.pm:
@[ -e $(pgxsdir)/src/test/perl/PostgreSQL/Test/Cluster.pm ] || ( echo -e "----ERROR----\nCannot run prove_check, copy src/test/perl/* to $(pgxsdir)/src/test/perl/ and retry\n-------------" && exit 1)
prove_check: $(pgxsdir)/src/test/perl/PostgreSQL/Test/Cluster.pm
rm -rf $(CURDIR)/test/tmp_check/
cd $(srcdir) && TESTDIR='$(CURDIR)/test' PATH="$(shell $(PG_CONFIG) --bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(pgxsdir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(or $(PROVE_TESTS),test/t/*.pl)
else
$(pgxsdir)/src/test/perl/PostgresNode.pm:
@[ -e $(pgxsdir)/src/test/perl/PostgresNode.pm ] || ( echo -e "----ERROR----\nCannot run prove_check, copy src/test/perl/* to $(pgxsdir)/src/test/perl/ and retry\n-------------" && exit 1)
prove_check: $(pgxsdir)/src/test/perl/PostgresNode.pm
rm -rf $(CURDIR)/test/tmp_check/
rm -rf $(CURDIR)/test/tmp_t/
mkdir $(CURDIR)/test/tmp_t/
cp -r test/t/ $(CURDIR)/test/tmp_t/
# Instead of maintaining multiple versions of TAP test files, we generate
# test files for PG versions less than 15 with simple sed commands.
sed -i 's/PostgreSQL::Test::Cluster/PostgresNode/g' $(CURDIR)/test/tmp_t/t/*.pl
sed -i 's/PostgreSQL::Test::Cluster/PostgresNode/g' $(CURDIR)/test/tmp_t/t/common/*.pl
sed -i 's/PostgreSQL::Test::Cluster/PostgresNode/g' $(CURDIR)/test/tmp_t/t/utils/*.pm
sed -i 's/PostgreSQL::Test::Utils/TestLib/g' $(CURDIR)/test/tmp_t/t/*.pl
sed -i 's/PostgreSQL::Test::Utils/TestLib/g' $(CURDIR)/test/tmp_t/t/common/*.pl
sed -i 's/PostgreSQL::Test::Utils/TestLib/g' $(CURDIR)/test/tmp_t/t/utils/*.pm
# The above set of sed commands will bring all the TAP tests prior to
# https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b3b4d8e68ae83f432f43f035c7eb481ef93e1583
sed -i 's/PostgresNode->new/get_new_node/g' $(CURDIR)/test/tmp_t/t/*.pl
sed -i 's/PostgresNode->new/get_new_node/g' $(CURDIR)/test/tmp_t/t/common/*.pl
sed -i 's/PostgresNode->new/get_new_node/g' $(CURDIR)/test/tmp_t/t/utils/*.pm
# The above set of sed commands will bring all the TAP tests prior to
# https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=201a76183e2056c2217129e12d68c25ec9c559c8
# Now, we are ready with TAP tests for PG versions less than 15.
cd $(srcdir) && TESTDIR='$(CURDIR)/test' PATH="$(shell $(PG_CONFIG) --bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(pgxsdir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(or $(PROVE_TESTS),test/tmp_t/t/*.pl)
rm -rf $(CURDIR)/test/tmp_t/
endif
endif
# Disabled because these tests require "wal_level=logical" and other custom
# settings (see test/pgactive_regress.conf file), which typical installcheck users
# do not have (e.g. buildfarm clients).
installcheck:
@echo "Cannot run installcheck as tests need custom configuration"
distclean maintainer-clean: clean
# Place the maintainer-clean before removing Makefile down below because they
# need Makefile.
rm -f config.status config.log
rm -f include/pgactive_config_generated.h Makefile
rm -f test/run_tests
rm -rf autom4te.cache/
.PHONY: all check regress_check prove_check installcheck git-dist distclean maintainer-clean