@@ -9,46 +9,41 @@ OBJS = src/backup.o src/catalog.o src/configure.o src/data.o \
99EXTRA_CLEAN = src/datapagemap.c src/datapagemap.h src/xlogreader.c\
1010src/receivelog.c src/receivelog.h src/streamutil.c src/streamutil.h src/logging.h
1111
12- all : checksrcdir src/datapagemap.h src/logging.h src/receivelog.h src/streamutil.h pg_probackup
12+ INCLUDES = src/datapagemap.h src/logging.h src/receivelog.h src/streamutil.h
1313
1414ifdef USE_PGXS
1515PG_CONFIG = pg_config
1616PGXS :=$(shell $(PG_CONFIG ) --pgxs)
1717include $(PGXS )
18- ifndef top_srcdir
19- @echo "You must have PostgreSQL source tree available to compile."
20- @echo "Pass the path to the PostgreSQL source tree to make, in the top_srcdir"
21- @echo "variable: \"make top_srcdir=<path to PostgreSQL source tree>\""
22- @exit 1
23- endif
24- # Those files are symlinked from the PostgreSQL sources.
25- src/xlogreader.c :% :$(top_srcdir ) /src/backend/access/transam/xlogreader.c
26- rm -f$@ && $(LN_S ) $< ./src/xlogreader.c
27- src/datapagemap.c :% :$(top_srcdir ) /src/bin/pg_rewind/datapagemap.c
28- rm -f$@ && $(LN_S ) $< ./src/datapagemap.c
29- src/datapagemap.h :% :$(top_srcdir ) /src/bin/pg_rewind/datapagemap.h
30- rm -f$@ && $(LN_S ) $< src/datapagemap.h
31- src/logging.h :% :$(top_srcdir ) /src/bin/pg_rewind/logging.h
32- rm -f$@ && $(LN_S ) $< ./src
33- src/receivelog.c :% :$(top_srcdir ) /src/bin/pg_basebackup/receivelog.c
34- rm -f$@ && $(LN_S ) $< ./src
35- src/receivelog.h :% :$(top_srcdir ) /src/bin/pg_basebackup/receivelog.h
36- rm -f$@ && $(LN_S ) $< ./src
37- src/streamutil.c :% :$(top_srcdir ) /src/bin/pg_basebackup/streamutil.c
38- rm -f$@ && $(LN_S ) $< ./src
39- src/streamutil.h :% :$(top_srcdir ) /src/bin/pg_basebackup/streamutil.h
40- rm -f$@ && $(LN_S ) $< ./src
18+ # !USE_PGXS
4119else
4220subdir =contrib/pg_probackup
4321top_builddir =../..
4422include $(top_builddir ) /src/Makefile.global
4523include $(top_srcdir ) /contrib/contrib-global.mk
46- ifeq ("$(top_srcdir ) ","../..")
47- srchome ="$(top_srcdir ) /.."
24+ endif # USE_PGXS
25+
26+ ifeq ($(top_srcdir ) ,../..)
27+ srchome =$(top_srcdir ) /..
4828else
49- srchome ="$(top_srcdir ) "
29+ srchome =$(top_srcdir )
30+ endif
31+
32+ ifeq ($(MAJORVERSION ) ,10)
33+ OBJS += src/walmethods.o
34+ EXTRA_CLEAN += src/walmethods.c src/walmethods.h
35+ INCLUDES += src/walmethods.h
5036endif
51- # Those files are symlinked from the PostgreSQL sources.
37+
38+ PG_CPPFLAGS = -I$(libpq_srcdir ) ${PTHREAD_CFLAGS} -Isrc
39+ override CPPFLAGS := -DFRONTEND$(CPPFLAGS ) $(PG_CPPFLAGS )
40+ PG_LIBS =$(libpq_pgport ) ${PTHREAD_CFLAGS}
41+
42+ all : checksrcdir$(INCLUDES ) $(PROGRAM ) ;
43+
44+ $(PROGRAM ) :$(OBJS )
45+ $(CC ) $(CFLAGS ) $(OBJS ) $(PG_LIBS ) $(LDFLAGS ) $(LDFLAGS_EX ) $(LIBS ) -o$@ $(X )
46+
5247src/xlogreader.c :$(top_srcdir ) /src/backend/access/transam/xlogreader.c
5348rm -f$@ && $(LN_S ) $(srchome ) /src/backend/access/transam/xlogreader.c$@
5449src/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
6560rm -f$@ && $(LN_S ) $(srchome ) /src/bin/pg_basebackup/streamutil.c$@
6661src/streamutil.h :$(top_srcdir ) /src/bin/pg_basebackup/streamutil.h
6762rm -f$@ && $(LN_S ) $(srchome ) /src/bin/pg_basebackup/streamutil.h$@
68- endif
6963
70- PG_CPPFLAGS = -I$(libpq_srcdir ) ${PTHREAD_CFLAGS} -Isrc
71- override CPPFLAGS := -DFRONTEND$(CPPFLAGS ) $(PG_CPPFLAGS )
72- PG_LIBS =$(libpq_pgport ) ${PTHREAD_CFLAGS}
64+ ifeq ($(MAJORVERSION ) ,10)
65+ src/walmethods.c :$(top_srcdir ) /src/bin/pg_basebackup/walmethods.c
66+ rm -f$@ && $(LN_S ) $(srchome ) /src/bin/pg_basebackup/walmethods.c$@
67+ src/walmethods.h :$(top_srcdir ) /src/bin/pg_basebackup/walmethods.h
68+ rm -f$@ && $(LN_S ) $(srchome ) /src/bin/pg_basebackup/walmethods.h$@
69+ endif
7370
7471ifeq ($(PORTNAME ) , aix)
7572CC=xlc_r
7673endif
7774
78- envtest :
79- : top_srcdir=$( )
80- : libpq_srcdir =$(libpq_srcdir )
81-
8275# This rule's only purpose is to give the user instructions on how to pass
8376# the path to PostgreSQL source tree to the makefile.
8477.PHONY : checksrcdir