@@ -23,14 +23,35 @@ OBJS = backup.o \
2323
2424EXTRA_CLEAN = datapagemap.c datapagemap.h xlogreader.c receivelog.c receivelog.h streamutil.c streamutil.h logging.h
2525
26- PG_CPPFLAGS = -I$(libpq_srcdir ) ${PTHREAD_CFLAGS}
27- override CPPFLAGS := -DFRONTEND $(CPPFLAGS )
28- PG_LIBS = $(libpq_pgport ) ${PTHREAD_LIBS} ${PTHREAD_CFLAGS}
29-
3026REGRESS = init option show delete backup restore
3127
3228all : checksrcdir datapagemap.h logging.h receivelog.h streamutil.h pg_arman
3329
30+ MAKE_GLOBAL ="../../src/Makefile.global"
31+ TEST_GLOBAL: =$(shell test -e ../../src/Makefile.global)
32+ ifeq ($(.SHELLSTATUS ) ,1)
33+ PG_CONFIG = pg_config
34+ PGXS := $(shell $(PG_CONFIG ) --pgxs)
35+ include $(PGXS )
36+
37+ .PHONY : checksrcdir
38+ checksrcdir :
39+ ifndef top_srcdir
40+ @echo "You must have PostgreSQL source tree available to compile."
41+ @echo "Pass the path to the PostgreSQL source tree to make, in the top_srcdir"
42+ @echo "variable: \"make top_srcdir=<path to PostgreSQL source tree>\""
43+ @exit 1
44+ endif
45+ else
46+ subdir =contrib/pg_arman
47+ top_builddir =../..
48+ include $(top_builddir ) /src/Makefile.global
49+ include $(top_srcdir ) /contrib/contrib-global.mk
50+ endif
51+ PG_CPPFLAGS = -I$(libpq_srcdir ) ${PTHREAD_CFLAGS}
52+ override CPPFLAGS := -DFRONTEND $(CPPFLAGS ) $(PG_CPPFLAGS )
53+ PG_LIBS = $(libpq_pgport ) ${PTHREAD_CFLAGS}
54+
3455# This rule's only purpose is to give the user instructions on how to pass
3556# the path to PostgreSQL source tree to the makefile.
3657.PHONY : checksrcdir
@@ -61,8 +82,3 @@ streamutil.c: % : $(top_srcdir)/src/bin/pg_basebackup/%
6182 rm -f && $(LN_S ) $< .
6283streamutil.h : % : $(top_srcdir ) /src/bin/pg_basebackup/%
6384 rm -f && $(LN_S ) $< .
64-
65- PG_CONFIG = pg_config
66- PGXS := $(shell $(PG_CONFIG ) --pgxs)
67- include $(PGXS )
68-
0 commit comments