-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile.in
492 lines (409 loc) · 13.2 KB
/
Makefile.in
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# -*-makefile-*-
# Makefile.in
# @configure_input@
# configure output
BDR_PGVERCOMPAT_INCDIR=@BDR_PGVERCOMPAT_INCDIR@
HAVE_SEQAM=@HAVE_SEQAM@
BDR_PG_MAJORVERSION=@BDR_PG_MAJORVERSION@
# end configure output
bdr_subdir = .
bdr_top_builddir = .
MODULE_big = bdr
EXTENSION = bdr
DATA = \
extsql/bdr--1.0.0.0.sql \
extsql/bdr--1.0.0.0--1.0.1.0.sql \
extsql/bdr--1.0.1.0--1.0.2.0.sql \
extsql/bdr--1.0.2.0--1.0.3.0.sql \
extsql/bdr--1.0.3.0--2.0.0.0.sql \
extsql/bdr--2.0.0.0--2.0.1.0.sql \
extsql/bdr--2.0.1.0--2.0.2.0.sql \
extsql/bdr--2.0.2.0--2.0.3.0.sql \
extsql/bdr--2.0.3.0--2.0.4.0.sql \
extsql/bdr--2.0.4.0--2.0.5.0.sql \
extsql/bdr--2.0.5.0--2.0.6.0.sql
# Remember to add $(call genextfile,from,to) invocations for these
DATA_built = \
extsql/bdr--1.0.1.0.sql \
extsql/bdr--1.0.2.0.sql \
extsql/bdr--1.0.3.0.sql \
extsql/bdr--2.0.0.0.sql \
extsql/bdr--2.0.1.0.sql \
extsql/bdr--2.0.2.0.sql \
extsql/bdr--2.0.3.0.sql \
extsql/bdr--2.0.4.0.sql \
extsql/bdr--2.0.5.0.sql \
extsql/bdr--2.0.6.0.sql
DOCS = README.bdr bdr.conf.sample
# pgxs doesn't know how to handle directories of docs, or built docs, so the
# html docs will get separate rules below
# We can't use SCRIPTS_built because it isn't supported by 9.4 and we can't use
# SCRIPTS because it breaks VPATH builds. So we'll just inject support later
# for SCRIPTS_built if PGXS doesn't support it.
SCRIPTS_built = \
scripts/bdr_initial_load \
bdr_init_copy \
bdr_dump
all: \
scripts/bdr_initial_load \
bdr_init_copy \
bdr_dump
# We can't use Makefile.global's MAJORVERSION here yet
ifneq ($(BDR_PG_MAJORVERSION),94)
SCRIPTS_built += bdr_resetxlog
all: bdr_resetxlog
endif
# When in development add -Werror
PG_CPPFLAGS = -std=gnu89 -I$(srcdir)/$(BDR_PGVERCOMPAT_INCDIR) -I$(libpq_srcdir) -Wall -Wmissing-prototypes -Wmissing-declarations $(EXTRA_CFLAGS)
SHLIB_LINK = $(libpq)
OBJS = \
bdr.o \
bdr_apply.o \
bdr_dbcache.o \
bdr_ddlrep.o \
bdr_ddlrep_truncate.o \
bdr_perdb.o \
bdr_catalogs.o \
bdr_conflict_handlers.o \
bdr_conflict_logging.o \
bdr_commandfilter.o \
bdr_common.o \
bdr_compat.o \
bdr_count.o \
bdr_executor.o \
bdr_init_replica.o \
bdr_label.o \
bdr_locks.o \
bdr_nodecache.o \
bdr_messaging.o \
bdr_monitoring.o \
bdr_output.o \
bdr_output_origin_filter.o \
bdr_pgutils.o \
bdr_protocol.o \
bdr_relcache.o \
bdr_remotecalls.o \
bdr_seq2.o \
bdr_shmem.o \
bdr_supervisor.o \
bdr_upgrade.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
ifeq ($(HAVE_SEQAM),1)
OBJS += bdr_seq.o bdr_ddlrep_deparse.o
REGRESS_COMPAT :=
DDLTESTS := \
ddl_enable_ddl \
ddl_create \
ddl_alter_table \
ddl_extension \
ddl_function \
ddl_grant \
ddl_mixed \
ddl_namespace \
ddl_replication_set \
ddl_sequence \
ddl_view \
ddl_disable_ddl
SEQTESTS := dml_sequence
else
OBJS += bdr_seq_stub.o
REGRESS_COMPAT :=
# Can't run ddl_sequence on 9.6
# DDL disabled on 9.6 for now
#DDLTESTS := \
# ddl_enable_ddl \
# ddl_create \
# ddl_alter_table \
# ddl_extension \
# ddl_function \
# ddl_grant \
# ddl_mixed \
# ddl_namespace \
# ddl_replication_set \
# ddl_view \
# ddl_disable_ddl
SEQTESTS :=
endif
# DDL tests run via bdr.bdr_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_replication_set \
ddl_fn/ddl_view \
ddl_fn/ddl_disable_ddl
include Makefile.global
$(info Building against PostgreSQL $(MAJORVERSION))
DUMPOBJS = $(BDR_DUMP_DIR)/pg_dump.o \
$(BDR_DUMP_DIR)/common.o \
$(BDR_DUMP_DIR)/pg_dump_sort.o \
$(BDR_DUMP_DIR)/pg_backup_archiver.o \
$(BDR_DUMP_DIR)/pg_backup_db.o \
$(BDR_DUMP_DIR)/pg_backup_custom.o \
$(BDR_DUMP_DIR)/pg_backup_null.o \
$(BDR_DUMP_DIR)/pg_backup_tar.o \
$(BDR_DUMP_DIR)/pg_backup_directory.o \
$(BDR_DUMP_DIR)/pg_backup_utils.o \
$(BDR_DUMP_DIR)/parallel.o \
$(BDR_DUMP_DIR)/compress_io.o \
$(BDR_DUMP_DIR)/dumputils.o
BDR_DUMP_DIR := pg_dump$(BDR_PG_MAJORVERSION)
ifeq ($(MAJORVERSION),9.6)
BDR_DUMP_LIBS := -lpgfeutils
DUMPOBJS += $(BDR_DUMP_DIR)/keywords.o
else ifeq ($(MAJORVERSION),9.4)
BDR_DUMP_LIBS :=
DUMPOBJS += $(BDR_DUMP_DIR)/keywords.o \
$(BDR_DUMP_DIR)/kwlookup.o
else
BDR_DUMP_LIBS := -lz -lpgfeutils
DUMPOBJS += $(BDR_DUMP_DIR)/string_utils.o
endif
ifneq ($(MAJORVERSION),9.4)
RESETXLOG_OBJS := pg_resetxlog/$(BDR_PG_MAJORVERSION)/pg_resetwal.o
RESETXLOG_LIBS := -lpgfeutils
bdr_resetxlog_dir:
mkdir -p pg_resetxlog/$(BDR_PG_MAJORVERSION)
.PHONY: bdr_resetxlog_dir
bdr_resetxlog: bdr_resetxlog_dir $(RESETXLOG_OBJS)
$(CC) $(CFLAGS) $(RESETXLOG_OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) -o $@$(X)
else
RESETXLOG_OBJS :=
RESETXLOG_LIBS :=
bdr_resetxlog:
@echo "bdr_resetxlog is not built on 9.4"
endif
# Ensure Makefiles are up2date (should we move this to Makefile.global?)
Makefile: Makefile.in config.status configure
./config.status $@
Makefile.global: Makefile.global.in config.status configure
./config.status $@
run_tests: run_tests.in config.status configure
./config.status $@
configure: configure.in
cd ${bdr_abs_srcdir} && autoreconf
DATE=$(shell date "+%Y-%m-%d")
GITHASH=$(shell if [ -e .distgitrev ]; then cat .distgitrev; else GIT_DIR=${bdr_abs_srcdir}/.git git rev-parse --short HEAD; fi)
bdr_version.h: bdr_version.h.in
sed '0,/BDR_VERSION_DATE/s,\(BDR_VERSION_DATE\).*,\1 "$(DATE)",;0,/BDR_VERSION_GITHASH/s,\(BDR_VERSION_GITHASH\).*,\1 "$(GITHASH)",' $< >$@
bdr.o: bdr_version.h
bdr_init_copy: bdr_init_copy.o bdr_common.o bdr_pgutils.o
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(libpq_pgport) -o $@$(X)
scripts/bdr_initial_load: scripts/bdr_initial_load.in
@mkdir -p $(shell dirname $@)
sed -e "s/BDR_VERSION/$(BDR_VERSION)/" -e "s/PG_VERSION/$(VERSION)/" $< > $@
@chmod +x $@
#----
# Generate flattened extension files.
#
# This isn't needed on PostgreSQL 10 as it's smart enough to figure out a
# creation path, but we still need it for 9.6 and 9.4bdr.
#
# Note that make 3.81 doesn't like define with =, so don't add one even though
# that's how the manual shows the syntax. See
# http://stackoverflow.com/q/13260396/398670 .
#---
define genextfile
extsql/bdr--$(2).sql: extsql/bdr--$(1).sql extsql/bdr--$(1)--$(2).sql
mkdir -p extsql
cat $$^ > $$@
endef
$(eval $(call genextfile,1.0.0.0,1.0.1.0))
$(eval $(call genextfile,1.0.1.0,1.0.2.0))
$(eval $(call genextfile,1.0.2.0,1.0.3.0))
$(eval $(call genextfile,1.0.3.0,2.0.0.0))
$(eval $(call genextfile,2.0.0.0,2.0.1.0))
$(eval $(call genextfile,2.0.1.0,2.0.2.0))
$(eval $(call genextfile,2.0.2.0,2.0.3.0))
$(eval $(call genextfile,2.0.3.0,2.0.4.0))
$(eval $(call genextfile,2.0.4.0,2.0.5.0))
$(eval $(call genextfile,2.0.5.0,2.0.6.0))
pg_dump_dir:
mkdir -p $(BDR_DUMP_DIR)
bdr_dump: pg_dump_dir $(DUMPOBJS)
$(CC) $(CFLAGS) $(DUMPOBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(BDR_DUMP_LIBS) -o $@$(X)
doc:
$(MAKE) -C doc all
install-doc:
$(MAKE) -C doc install
all: all-lib bdr_init_copy bdr_dump
world: all doc
install-world: install install-doc
clean: additional-clean
maintainer-clean: additional-maintainer-clean
additional-clean:
rm -f bdr_init_copy$(X) bdr_init_copy.o
rm -f bdr_version.h
rm -f .distgitrev
rm -rf tmp_check
rm -rf scripts/bdr_initial_load
rm -f bdr_dump$(X) $(DUMPOBJS)
rm -f bdr_resetxlog$(X) $(RESETXLOG_OBJS)
rm -f extsql/bdr--0.[89].0.[0-9].sql
rm -rf doc/html
$(MAKE) -C doc clean
additional-maintainer-clean: clean
rm -f configure
rm -f config.status config.log
rm -f bdr_config.h.in Makefile
rm -f run_tests
@rm -rf autom4te.cache/
$(MAKE) -C doc maintainer-clean
# Disabled because these tests require "wal_level=logical", which
# typical installcheck users do not have (e.g. buildfarm clients).
installcheck: ;
ifeq ($(BDR_PG_MAJORVERSION),9.4)
# We must emulate SCRIPTS_built for Pg 9.4 as PGXS doesn't support it
install: install-scripts
install-scripts:
$(INSTALL_SCRIPT) $(SCRIPTS_built) '$(DESTDIR)$(bindir)/'
.PHONY: install-scripts
installdirs: installdirs-scripts
installdirs-scripts:
$(MKDIR_P) '$(DESTDIR)$(bindir)'
.PHONY: installdirs-scripts
endif
check: regresscheck noisolationcheck prove_installcheck
REGRESSCHECKS= \
init \
preseed \
init_bdr \
status \
guc \
schema \
$(REGRESS_COMPAT) \
preseed_check \
supervisordb \
upgrade \
identifier \
schema_desync \
replorigin_filter \
pause \
catalog \
terminate \
skipchanges \
pgreplicationslots \
seq2 \
read_only \
$(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 \
$(SEQTESTS) \
part_bdr
ISOLATIONCHECKS=\
isolation/init \
isolation/ddlconflict \
isolation/dmlconflict_ii \
isolation/dmlconflict_uu \
isolation/dmlconflict_ud \
isolation/dmlconflict_dd \
isolation/alter_table \
isolation/basic_triple_node
# this test demonstrates a divergent conflict, so deactivate for now
# isolation/update_pk_change_conflict
# XXX: Add a check that these are installed
REQUIRED_EXTENSIONS="btree_gist"
REQUIRED_TEST_EXTENSIONS="pg_trgm cube hstore"
REGRESSCONFIG=bdr_regress_bdr.conf
regresscheck: all install
[ -e pg_hba.conf ] || ln -s $(bdr_abs_srcdir)/pg_hba.conf .
mkdir -p results/ddl results/ddl_fn results/dml
./run_tests --config $(bdr_abs_srcdir)/$(REGRESSCONFIG) \
--testbinary src/test/regress/pg_regress \
$(REGRESSCHECKS)
noisolationcheck:
@echo "Isolation tests are now skipped by default even on 9.4"
@echo "Use 'make isolationcheck' to run them"
.PHONY: noisolationcheck
ifeq ($(MAJORVERSION),9.4)
isolationcheck: all install
mkdir -p results/isolation
./run_tests --config $(bdr_abs_srcdir)/bdr_isolationregress.conf \
--testbinary src/test/isolation/pg_isolation_regress \
--dbname node1,node2,node3 \
$(ISOLATIONCHECKS)
prove_installcheck:
@echo "No prove / TAP support in 9.4, ignoring prove tests"
else
# pg_isolation_regress doesn't get installed by 96, only by 94bdr
isolationcheck:
@echo "Cannot run isolation tests except on 9.4bdr"
#
# To run prove, we need to install a couple of things that are not
# usually coped from the Pg source tree to the install tree, namely
# all of src/test/perl needs to be copied to lib/postgresql/pgxs/src/test/perl/PostgresNode.pm .
#
# This isn't done by Pg'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%[email protected]
#
$(pgxsdir)/src/test/perl/PostgresNode.pm:
@[ -e $(pgxsdir)/src/test/perl/PostgresNode.pm ] || ( echo -e "----ERROR----\nCan't run prove_installcheck, copy src/test/perl/* to $(pgxsdir)/src/test/perl/ and retry\n-------------" && exit 1)
prove_installcheck: $(pgxsdir)/src/test/perl/PostgresNode.pm
rm -rf $(CURDIR)/tmp_check/
cd $(srcdir) && TESTDIR='$(CURDIR)' 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),t/*.pl)
.PHONY: prove_installcheck
endif
bdr_pgbench_check: bdr_pgbench_check.sh
sed -e 's,@bindir@,$(bindir),g' \
-e 's,@libdir@,$(libdir),g' \
-e 's,@MAKE@,$(MAKE),g' \
-e 's,@top_srcdir@,$(top_srcdir),g' \
$< >$@
chmod a+x $@
pgbenchcheck: bdr_pgbench_check
./bdr_pgbench_check
distdir = bdr-$(BDR_VERSION)
git-dist: clean
rm -f .distgitrev .distgittag
if ! git diff-index --quiet HEAD; then echo >&2 "WARNING: git working tree has uncommitted changes to tracked files which were INCLUDED"; fi
if [ -n "`git ls-files --exclude-standard --others`" ]; then echo >&2 "WARNING: git working tree has unstaged files which were IGNORED!"; fi
echo $(GITHASH) > .distgitrev
git name-rev --tags --name-only `cat .distgitrev` > .distgittag
git ls-tree -r -t --full-tree HEAD --name-only |\
tar cjf "${distdir}.tar.bz2" --no-recursion --owner=root --group=root --mode=u=rwX,go=rX --transform="s|^|${distdir}/|" -T - \
.distgitrev .distgittag
echo >&2 "Prepared ${distdir}.tar.bz2 for rev=`cat .distgitrev`, tag=`cat .distgittag`"
rm -f .distgitrev .distgittag
PHONY: submake-regress
# if config.log has changed, force recompile
$(OBJS): .pg_version
.pg_version:
@echo '$(MAJORVERSION)' | cmp -s - $@ || echo '$(MAJORVERSION)' > $@
export PG_CONFIG
export PATH
bdr_test_dummy_extension_all:
mkdir -p bdr_test_dummy_extension
$(MAKE) -C bdr_test_dummy_extension -f ${bdr_abs_srcdir}/bdr_test_dummy_extension/Makefile VPATH=${bdr_abs_srcdir}/bdr_test_dummy_extension all
bdr_test_dummy_extension_clean:
$(MAKE) -C bdr_test_dummy_extension -f ${bdr_abs_srcdir}/bdr_test_dummy_extension/Makefile VPATH=${bdr_abs_srcdir}/bdr_test_dummy_extension clean
bdr_test_dummy_extension_install:
mkdir -p bdr_test_dummy_extension
$(MAKE) -C bdr_test_dummy_extension -f ${bdr_abs_srcdir}/bdr_test_dummy_extension/Makefile VPATH=${bdr_abs_srcdir}/bdr_test_dummy_extension install
all: bdr_test_dummy_extension_all
clean: bdr_test_dummy_extension_clean
# we do NOT install bdr_test_dummy_extension for the normal 'install' target,
# only before tests.
prove_installcheck: bdr_test_dummy_extension_install
.PHONY: all check regresscheck isolationcheck doc