mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-27 09:21:18 +02:00
PGPRO-4075: Fixed build rules to improve stability
This commit is contained in:
parent
970bd02b11
commit
801de81b69
100
Makefile
100
Makefile
@ -17,92 +17,78 @@ EXTRA_CLEAN = src/pg_crc.c src/datapagemap.c src/datapagemap.h \
|
||||
src/receivelog.c src/receivelog.h src/streamutil.c src/streamutil.h \
|
||||
src/xlogreader.c src/instr_time.h
|
||||
|
||||
INCLUDES = src/datapagemap.h src/streamutil.h src/receivelog.h src/instr_time.h
|
||||
ifdef top_srcdir
|
||||
srchome := $(abspath $(top_srcdir))
|
||||
else
|
||||
top_srcdir=../..
|
||||
ifneq (,$(wildcard ../../../contrib/pg_probackup))
|
||||
# separate build directory support
|
||||
srchome := $(abspath $(top_srcdir)/..)
|
||||
else
|
||||
srchome := $(abspath $(top_srcdir))
|
||||
endif
|
||||
endif
|
||||
|
||||
# OBJS variable must be finally defined before invoking the include directive
|
||||
ifneq (,$(wildcard $(srchome)/src/bin/pg_basebackup/walmethods.c))
|
||||
OBJS += src/walmethods.o
|
||||
EXTRA_CLEAN += src/walmethods.c src/walmethods.h
|
||||
endif
|
||||
ifneq (,$(wildcard $(srchome)/src/bin/pg_rewind/logging.h))
|
||||
EXTRA_CLEAN += src/logging.h
|
||||
endif
|
||||
|
||||
ifdef USE_PGXS
|
||||
PG_CONFIG = pg_config
|
||||
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||
include $(PGXS)
|
||||
# !USE_PGXS
|
||||
else
|
||||
subdir=contrib/pg_probackup
|
||||
top_builddir=../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
include $(top_srcdir)/contrib/contrib-global.mk
|
||||
endif # USE_PGXS
|
||||
|
||||
ifeq ($(top_srcdir),../..)
|
||||
ifeq ($(LN_S),ln -s)
|
||||
srchome=$(top_srcdir)/..
|
||||
endif
|
||||
else
|
||||
srchome=$(top_srcdir)
|
||||
endif
|
||||
|
||||
#ifneq (,$(filter 9.5 9.6 10 11,$(MAJORVERSION)))
|
||||
ifneq (12,$(MAJORVERSION))
|
||||
EXTRA_CLEAN += src/logging.h
|
||||
INCLUDES += src/logging.h
|
||||
endif
|
||||
|
||||
ifeq (,$(filter 9.5 9.6,$(MAJORVERSION)))
|
||||
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 -I$(top_srcdir)/$(subdir)/src
|
||||
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc -I$(srchome)/$(subdir)/src
|
||||
override CPPFLAGS := -DFRONTEND $(CPPFLAGS) $(PG_CPPFLAGS)
|
||||
PG_LIBS_INTERNAL = $(libpq_pgport) ${PTHREAD_CFLAGS}
|
||||
|
||||
all: checksrcdir $(INCLUDES);
|
||||
src/utils/configuration.o: src/datapagemap.h
|
||||
src/archive.o: src/instr_time.h
|
||||
src/backup.o: src/receivelog.h src/streamutil.h
|
||||
ifneq (,$(wildcard $(srchome)/src/bin/pg_rewind/logging.h))
|
||||
src/datapagemap.o: src/logging.h
|
||||
endif
|
||||
|
||||
$(PROGRAM): $(OBJS)
|
||||
|
||||
src/instr_time.h: $(top_srcdir)/src/include/portability/instr_time.h
|
||||
src/instr_time.h: $(srchome)/src/include/portability/instr_time.h
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/include/portability/instr_time.h $@
|
||||
src/datapagemap.c: $(top_srcdir)/src/bin/pg_rewind/datapagemap.c
|
||||
src/datapagemap.c: $(srchome)/src/bin/pg_rewind/datapagemap.c
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_rewind/datapagemap.c $@
|
||||
src/datapagemap.h: $(top_srcdir)/src/bin/pg_rewind/datapagemap.h
|
||||
src/datapagemap.h: $(srchome)/src/bin/pg_rewind/datapagemap.h
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_rewind/datapagemap.h $@
|
||||
src/pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
|
||||
src/pg_crc.c: $(srchome)/src/backend/utils/hash/pg_crc.c
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/backend/utils/hash/pg_crc.c $@
|
||||
src/receivelog.c: $(top_srcdir)/src/bin/pg_basebackup/receivelog.c
|
||||
src/receivelog.c: $(srchome)/src/bin/pg_basebackup/receivelog.c
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/receivelog.c $@
|
||||
src/receivelog.h: $(top_srcdir)/src/bin/pg_basebackup/receivelog.h
|
||||
ifneq (,$(wildcard $(srchome)/src/bin/pg_basebackup/walmethods.c))
|
||||
src/receivelog.h: src/walmethods.h $(srchome)/src/bin/pg_basebackup/receivelog.h
|
||||
else
|
||||
src/receivelog.h: $(srchome)/src/bin/pg_basebackup/receivelog.h
|
||||
endif
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/receivelog.h $@
|
||||
src/streamutil.c: $(top_srcdir)/src/bin/pg_basebackup/streamutil.c
|
||||
src/streamutil.c: $(srchome)/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
|
||||
src/streamutil.h: $(srchome)/src/bin/pg_basebackup/streamutil.h
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/streamutil.h $@
|
||||
src/xlogreader.c: $(top_srcdir)/src/backend/access/transam/xlogreader.c
|
||||
src/xlogreader.c: $(srchome)/src/backend/access/transam/xlogreader.c
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/backend/access/transam/xlogreader.c $@
|
||||
|
||||
#ifneq (,$(filter 9.5 9.6 10 11,$(MAJORVERSION)))
|
||||
ifneq (12,$(MAJORVERSION))
|
||||
src/logging.h: $(top_srcdir)/src/bin/pg_rewind/logging.h
|
||||
src/logging.h: $(srchome)/src/bin/pg_rewind/logging.h
|
||||
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_rewind/logging.h $@
|
||||
endif
|
||||
|
||||
ifeq (,$(filter 9.5 9.6,$(MAJORVERSION)))
|
||||
src/walmethods.c: $(top_srcdir)/src/bin/pg_basebackup/walmethods.c
|
||||
src/walmethods.c: $(srchome)/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
|
||||
src/walmethods.h: $(srchome)/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
|
||||
|
||||
# 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
|
||||
checksrcdir:
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user