pg_probackup now is built with PostgreSQL 10

This commit is contained in:
Arthur Zakirov
2017-08-07 16:23:37 +03:00
parent 5ab28f954e
commit 7bd80376bd
7 changed files with 75 additions and 42 deletions
+29 -36
View File
@@ -9,46 +9,41 @@ OBJS = src/backup.o src/catalog.o src/configure.o src/data.o \
EXTRA_CLEAN = src/datapagemap.c src/datapagemap.h src/xlogreader.c \
src/receivelog.c src/receivelog.h src/streamutil.c src/streamutil.h src/logging.h
all: checksrcdir src/datapagemap.h src/logging.h src/receivelog.h src/streamutil.h pg_probackup
INCLUDES = src/datapagemap.h src/logging.h src/receivelog.h src/streamutil.h
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
ifndef top_srcdir
@echo "You must have PostgreSQL source tree available to compile."
@echo "Pass the path to the PostgreSQL source tree to make, in the top_srcdir"
@echo "variable: \"make top_srcdir=<path to PostgreSQL source tree>\""
@exit 1
endif
# Those files are symlinked from the PostgreSQL sources.
src/xlogreader.c: % : $(top_srcdir)/src/backend/access/transam/xlogreader.c
rm -f $@ && $(LN_S) $< ./src/xlogreader.c
src/datapagemap.c: % : $(top_srcdir)/src/bin/pg_rewind/datapagemap.c
rm -f $@ && $(LN_S) $< ./src/datapagemap.c
src/datapagemap.h: % : $(top_srcdir)/src/bin/pg_rewind/datapagemap.h
rm -f $@ && $(LN_S) $< src/datapagemap.h
src/logging.h: % : $(top_srcdir)/src/bin/pg_rewind/logging.h
rm -f $@ && $(LN_S) $< ./src
src/receivelog.c: % : $(top_srcdir)/src/bin/pg_basebackup/receivelog.c
rm -f $@ && $(LN_S) $< ./src
src/receivelog.h: % : $(top_srcdir)/src/bin/pg_basebackup/receivelog.h
rm -f $@ && $(LN_S) $< ./src
src/streamutil.c: % : $(top_srcdir)/src/bin/pg_basebackup/streamutil.c
rm -f $@ && $(LN_S) $< ./src
src/streamutil.h: % : $(top_srcdir)/src/bin/pg_basebackup/streamutil.h
rm -f $@ && $(LN_S) $< ./src
# !USE_PGXS
else
subdir=contrib/pg_probackup
top_builddir=../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
ifeq ("$(top_srcdir)","../..")
srchome="$(top_srcdir)/.."
endif # USE_PGXS
ifeq ($(top_srcdir),../..)
srchome=$(top_srcdir)/..
else
srchome="$(top_srcdir)"
srchome=$(top_srcdir)
endif
# Those files are symlinked from the PostgreSQL sources.
ifeq ($(MAJORVERSION),10)
OBJS += src/walmethods.o
EXTRA_CLEAN += src/walmethods.c src/walmethods.h
INCLUDES += src/walmethods.h
endif
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc
override CPPFLAGS := -DFRONTEND $(CPPFLAGS) $(PG_CPPFLAGS)
PG_LIBS = $(libpq_pgport) ${PTHREAD_CFLAGS}
all: checksrcdir $(INCLUDES) $(PROGRAM);
$(PROGRAM): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) $(PG_LIBS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
src/xlogreader.c: $(top_srcdir)/src/backend/access/transam/xlogreader.c
rm -f $@ && $(LN_S) $(srchome)/src/backend/access/transam/xlogreader.c $@
src/datapagemap.c: $(top_srcdir)/src/bin/pg_rewind/datapagemap.c
@@ -65,20 +60,18 @@ src/streamutil.c: $(top_srcdir)/src/bin/pg_basebackup/streamutil.c
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/streamutil.c $@
src/streamutil.h: $(top_srcdir)/src/bin/pg_basebackup/streamutil.h
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/streamutil.h $@
endif
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc
override CPPFLAGS := -DFRONTEND $(CPPFLAGS) $(PG_CPPFLAGS)
PG_LIBS = $(libpq_pgport) ${PTHREAD_CFLAGS}
ifeq ($(MAJORVERSION),10)
src/walmethods.c: $(top_srcdir)/src/bin/pg_basebackup/walmethods.c
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/walmethods.c $@
src/walmethods.h: $(top_srcdir)/src/bin/pg_basebackup/walmethods.h
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/walmethods.h $@
endif
ifeq ($(PORTNAME), aix)
CC=xlc_r
endif
envtest:
: top_srcdir=$( )
: libpq_srcdir = $(libpq_srcdir)
# This rule's only purpose is to give the user instructions on how to pass
# the path to PostgreSQL source tree to the makefile.
.PHONY: checksrcdir