Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit801de81

Browse files
committed
PGPRO-4075: Fixed build rules to improve stability
1 parent970bd02 commit801de81

File tree

1 file changed

+43
-57
lines changed

1 file changed

+43
-57
lines changed

‎Makefile‎

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -17,92 +17,78 @@ EXTRA_CLEAN = src/pg_crc.c src/datapagemap.c src/datapagemap.h \
1717
src/receivelog.c src/receivelog.h src/streamutil.c src/streamutil.h\
1818
src/xlogreader.c src/instr_time.h
1919

20-
INCLUDES = src/datapagemap.h src/streamutil.h src/receivelog.h src/instr_time.h
20+
ifdeftop_srcdir
21+
srchome :=$(abspath$(top_srcdir))
22+
else
23+
top_srcdir=../..
24+
ifneq (,$(wildcard ../../../contrib/pg_probackup))
25+
# separate build directory support
26+
srchome :=$(abspath$(top_srcdir)/..)
27+
else
28+
srchome :=$(abspath$(top_srcdir))
29+
endif
30+
endif
31+
32+
# OBJS variable must be finally defined before invoking the include directive
33+
ifneq (,$(wildcard$(srchome)/src/bin/pg_basebackup/walmethods.c))
34+
OBJS += src/walmethods.o
35+
EXTRA_CLEAN += src/walmethods.c src/walmethods.h
36+
endif
37+
ifneq (,$(wildcard$(srchome)/src/bin/pg_rewind/logging.h))
38+
EXTRA_CLEAN += src/logging.h
39+
endif
2140

2241
ifdefUSE_PGXS
2342
PG_CONFIG = pg_config
2443
PGXS :=$(shell$(PG_CONFIG) --pgxs)
2544
include$(PGXS)
26-
# !USE_PGXS
2745
else
2846
subdir=contrib/pg_probackup
2947
top_builddir=../..
3048
include$(top_builddir)/src/Makefile.global
3149
include$(top_srcdir)/contrib/contrib-global.mk
32-
endif# USE_PGXS
33-
34-
ifeq ($(top_srcdir),../..)
35-
ifeq ($(LN_S),ln -s)
36-
srchome=$(top_srcdir)/..
37-
endif
38-
else
39-
srchome=$(top_srcdir)
40-
endif
41-
42-
#ifneq (,$(filter 9.5 9.6 10 11,$(MAJORVERSION)))
43-
ifneq (12,$(MAJORVERSION))
44-
EXTRA_CLEAN += src/logging.h
45-
INCLUDES += src/logging.h
4650
endif
4751

48-
ifeq (,$(filter 9.5 9.6,$(MAJORVERSION)))
49-
OBJS += src/walmethods.o
50-
EXTRA_CLEAN += src/walmethods.c src/walmethods.h
51-
INCLUDES += src/walmethods.h
52-
endif
53-
54-
55-
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc -I$(top_srcdir)/$(subdir)/src
52+
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc -I$(srchome)/$(subdir)/src
5653
overrideCPPFLAGS := -DFRONTEND$(CPPFLAGS)$(PG_CPPFLAGS)
5754
PG_LIBS_INTERNAL =$(libpq_pgport) ${PTHREAD_CFLAGS}
5855

59-
all: checksrcdir$(INCLUDES);
60-
61-
$(PROGRAM):$(OBJS)
56+
src/utils/configuration.o: src/datapagemap.h
57+
src/archive.o: src/instr_time.h
58+
src/backup.o: src/receivelog.h src/streamutil.h
59+
ifneq (,$(wildcard$(srchome)/src/bin/pg_rewind/logging.h))
60+
src/datapagemap.o: src/logging.h
61+
endif
6262

63-
src/instr_time.h:$(top_srcdir)/src/include/portability/instr_time.h
63+
src/instr_time.h:$(srchome)/src/include/portability/instr_time.h
6464
rm -f$@&&$(LN_S)$(srchome)/src/include/portability/instr_time.h$@
65-
src/datapagemap.c:$(top_srcdir)/src/bin/pg_rewind/datapagemap.c
65+
src/datapagemap.c:$(srchome)/src/bin/pg_rewind/datapagemap.c
6666
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_rewind/datapagemap.c$@
67-
src/datapagemap.h:$(top_srcdir)/src/bin/pg_rewind/datapagemap.h
67+
src/datapagemap.h:$(srchome)/src/bin/pg_rewind/datapagemap.h
6868
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_rewind/datapagemap.h$@
69-
src/pg_crc.c:$(top_srcdir)/src/backend/utils/hash/pg_crc.c
69+
src/pg_crc.c:$(srchome)/src/backend/utils/hash/pg_crc.c
7070
rm -f$@&&$(LN_S)$(srchome)/src/backend/utils/hash/pg_crc.c$@
71-
src/receivelog.c:$(top_srcdir)/src/bin/pg_basebackup/receivelog.c
71+
src/receivelog.c:$(srchome)/src/bin/pg_basebackup/receivelog.c
7272
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_basebackup/receivelog.c$@
73-
src/receivelog.h:$(top_srcdir)/src/bin/pg_basebackup/receivelog.h
73+
ifneq (,$(wildcard$(srchome)/src/bin/pg_basebackup/walmethods.c))
74+
src/receivelog.h: src/walmethods.h$(srchome)/src/bin/pg_basebackup/receivelog.h
75+
else
76+
src/receivelog.h:$(srchome)/src/bin/pg_basebackup/receivelog.h
77+
endif
7478
rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/receivelog.h $@
75-
src/streamutil.c:$(top_srcdir)/src/bin/pg_basebackup/streamutil.c
79+
src/streamutil.c:$(srchome)/src/bin/pg_basebackup/streamutil.c
7680
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_basebackup/streamutil.c$@
77-
src/streamutil.h:$(top_srcdir)/src/bin/pg_basebackup/streamutil.h
81+
src/streamutil.h:$(srchome)/src/bin/pg_basebackup/streamutil.h
7882
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_basebackup/streamutil.h$@
79-
src/xlogreader.c:$(top_srcdir)/src/backend/access/transam/xlogreader.c
83+
src/xlogreader.c:$(srchome)/src/backend/access/transam/xlogreader.c
8084
rm -f$@&&$(LN_S)$(srchome)/src/backend/access/transam/xlogreader.c$@
81-
82-
#ifneq (,$(filter 9.5 9.6 10 11,$(MAJORVERSION)))
83-
ifneq (12,$(MAJORVERSION))
84-
src/logging.h:$(top_srcdir)/src/bin/pg_rewind/logging.h
85+
src/logging.h:$(srchome)/src/bin/pg_rewind/logging.h
8586
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_rewind/logging.h$@
86-
endif
87-
88-
ifeq (,$(filter 9.5 9.6,$(MAJORVERSION)))
89-
src/walmethods.c:$(top_srcdir)/src/bin/pg_basebackup/walmethods.c
87+
src/walmethods.c:$(srchome)/src/bin/pg_basebackup/walmethods.c
9088
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_basebackup/walmethods.c$@
91-
src/walmethods.h:$(top_srcdir)/src/bin/pg_basebackup/walmethods.h
89+
src/walmethods.h:$(srchome)/src/bin/pg_basebackup/walmethods.h
9290
rm -f$@&&$(LN_S)$(srchome)/src/bin/pg_basebackup/walmethods.h$@
93-
endif
9491

9592
ifeq ($(PORTNAME), aix)
9693
CC=xlc_r
9794
endif
98-
99-
# This rule's only purpose is to give the user instructions on how to pass
100-
# the path to PostgreSQL source tree to the makefile.
101-
.PHONY: checksrcdir
102-
checksrcdir:
103-
ifndeftop_srcdir
104-
@echo "You must have PostgreSQL source tree available to compile."
105-
@echo "Pass the path to the PostgreSQL source tree to make, in the top_srcdir"
106-
@echo "variable: \"make top_srcdir=<path to PostgreSQL source tree>\""
107-
@exit 1
108-
endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp