forked from postgrespro/pgsphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
267 lines (205 loc) · 8.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
include Makefile.common.mk
RELEASE_SQL = $(EXTENSION)--$(PGSPHERE_VERSION).sql
USE_PGXS = 1
USE_HEALPIX =? 1
# the base dir name may be changed depending on git clone command
SRC_DIR = $(shell basename $(shell pwd))
MODULE_big = pg_sphere
OBJS = src/sscan.o src/sparse.o src/sbuffer.o src/vector3d.o src/point.o \
src/euler.o src/circle.o src/line.o src/ellipse.o src/polygon.o \
src/path.o src/box.o src/output.o src/gq_cache.o src/gist.o \
src/key.o src/gnomo.o src/epochprop.o src/brin.o
ifneq ($(USE_HEALPIX),0)
OBJS += src/healpix.o src/moc.o src/process_moc.o \
healpix_bare/healpix_bare.o
endif
DATA_built = $(RELEASE_SQL) \
pg_sphere--unpackaged--1.1.5beta0gavo.sql \
pg_sphere--1.0--1.0_gavo.sql \
pg_sphere--1.0_gavo--1.1.5beta0gavo.sql \
pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql \
pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql \
pg_sphere--1.1.5beta4gavo--1.2.0.sql \
pg_sphere--1.2.0--1.2.1.sql \
pg_sphere--1.2.1--1.2.2.sql \
pg_sphere--1.2.2--1.2.3.sql \
pg_sphere--1.2.3--1.3.0.sql \
pg_sphere--1.3.0--1.3.1.sql \
pg_sphere--1.3.1--1.3.2.sql
DOCS = README.pg_sphere COPYRIGHT.pg_sphere
REGRESS = init tables points euler circle line ellipse poly path box index \
contains_ops contains_ops_compat bounding_box_gist gnomo epochprop \
contains overlaps spoint_brin sbox_brin
ifneq ($(USE_HEALPIX),0)
REGRESS += healpix moc mocautocast
endif
TESTS = init_test tables points euler circle line ellipse poly path box \
index contains_ops contains_ops_compat bounding_box_gist gnomo \
epochprop contains overlaps spoint_brin sbox_brin
ifneq ($(USE_HEALPIX),0)
TESTS += healpix moc mocautocast
endif
PG_CFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION)
PG_CPPFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION)
ifndef CXXFLAGS
# no support for CXXFLAGS in PGXS before v11
CXXFLAGS = -Wall -Wpointer-arith -Wendif-labels \
-Wmissing-format-attribute -Wformat-security -g -O2 -fPIC
endif
EXTRA_CLEAN = $(PGS_SQL) pg_sphere.test.sql
CRUSH_TESTS = init_extended circle_extended
# order of sql files is important
PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \
pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql \
pgs_gist.sql gnomo.sql pgs_brin.sql
ifneq ($(USE_HEALPIX),0)
PGS_SQL += healpix.sql
endif
PGS_SQL += pgs_gist_spoint3.sql
ifneq ($(USE_HEALPIX),0)
PGS_SQL += pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql \
pgs_moc_geo_casts.sql
endif
PGS_SQL += pgs_epochprop.sql
ifdef USE_PGXS
ifndef PG_CONFIG
PG_CONFIG = pg_config
endif
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_sphere
top_builddir = ../..
PG_CONFIG := $(top_builddir)/src/bin/pg_config/pg_config
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
ifneq ($(USE_HEALPIX),0)
# compiler settings for linking with libhealpix_cxx
PKG_CONFIG ?= pkg-config
override CPPFLAGS += $(shell $(PKG_CONFIG) --cflags healpix_cxx)
SHLIB_LINK += $(shell $(PKG_CONFIG) --libs healpix_cxx)
LINK.shared = g++ -shared
endif
# healpix_bare.c isn't ours so we refrain from fixing the warnings in there
healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c
$(COMPILE.c) -Wno-declaration-after-statement -o $@ $^
pg_version := $(word 2,$(shell $(PG_CONFIG) --version))
has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n)
crushtest: REGRESS += $(CRUSH_TESTS)
crushtest: installcheck
ifneq ($(USE_HEALPIX),0)
ifeq ($(has_explain_summary),y)
REGRESS += moc1 moc100
endif
endif
test: pg_sphere.test.sql
$(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) $(TESTS)
pg_sphere.test.sql: $(RELEASE_SQL) $(shlib)
tail -n+3 $< | sed 's,MODULE_PATHNAME,$(realpath $(shlib)),g' >$@
$(RELEASE_SQL): pg_sphere_head.sql.in $(addsuffix .in, $(PGS_SQL))
cat $^ > $@
# for "create extension from unpacked*":
UPGRADE_UNP_COMMON = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \
pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \
pgs_box.sql pgs_contains_ops_compat.sql pgs_gist.sql \
pgs_gist_contains_ops.sql contains-ops-fixes-1.sql
AUGMENT_UNP_COMMON = upgrade_scripts/pgs_pre111.sql pgs_contains_ops.sql \
gnomo.sql
# for vanilla 1.1.1 users:
AUGMENT_UNP_111 = $(AUGMENT_UNP_COMMON) pgs_gist_pointkey.sql
# for 1.1.2+ users: 'from unpacked_1.1.2plus'
AUGMENT_UNP_FOR_112plus = $(AUGMENT_UNP_COMMON)
UPGRADE_UNP_FOR_112plus = pgs_gist_pointkey.sql pgs_gist_drop_spoint2.sql.in
# for "alter extension":
# TODO: add dynamic pl/pgsql to do perform an additional
# "ALTER EXTENSION pg_sphere UPDATE TO '1.1.5_from_before_2016-02-07';"
# if required.
#
# default 1.0 (after 2016-02-07) -> 1.1.5
UPGRADE_1_0_PRE_xxxxxx = contains-ops-fixes-2.sql
# '1.1.5_from_2015-08-31'
AUGMENT_1_0_PRE_AAF2D5 = pgs_contains_ops.sql gnomo.sql
UPGRADE_1_0_PRE_AAF2D5 = contains-ops-fixes-1.sql pgs_gist_drop_spoint2.sql.in \
pgs_gist_contains_ops.sql
# vanilla 'create from unpackaged' must assume 1.1.1
# ...
# create "create extension from unpacked*" files
# create "alter extension" files
# local stuff follows here
AUGMENT_GAVO_111 = $(AUGMENT_UNP_111) # for vanilla 1.1.1 users
ifneq ($(USE_HEALPIX),0)
AUGMENT_GAVO_111 += healpix.sql
endif
UPGRADE_GAVO_111 = $(UPGRADE_UNP_COMMON)
# add new HEALPix functions and experimental spoint3
ifneq ($(USE_HEALPIX),0)
AUGMENT_FROM_GAVO = healpix.sql
endif
AUGMENT_FROM_GAVO += pgs_gist_spoint3.sql
AUGMENT_UNP_115B0G = $(AUGMENT_UNP_111) $(AUGMENT_FROM_GAVO)
UPGRADE_UNP_115B0G = $(UPGRADE_UNP_COMMON)
AUGMENT_1_0_115B0G = $(AUGMENT_FROM_GAVO)
UPGRADE_1_0_115B0G = contains-ops-fixes-2.sql pgs_gist_drop_spoint2.sql
# test installation 0
pg_sphere--unpackaged--1.1.5beta0gavo.sql: $(addsuffix .in, \
$(AUGMENT_GAVO_111) \
$(addprefix upgrade_scripts/, $(UPGRADE_GAVO_111)))
cat upgrade_scripts/$@.in $^ > $@
# (The upgrade of test installation A has been completed.)
# test installation B (generic)
pg_sphere--1.0--1.0_gavo.sql: # dummy upgrade to allow for descriptive names
cat upgrade_scripts/$@.in > $@
pg_sphere--1.0_gavo--1.1.5beta0gavo.sql: $(addsuffix .in, \
$(AUGMENT_1_0_115B0G) \
$(addprefix upgrade_scripts/, $(UPGRADE_1_0_115B0G)))
cat upgrade_scripts/$@.in $^ > $@
ifneq ($(USE_HEALPIX),0)
pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql: pgs_moc_type.sql.in
cat upgrade_scripts/$@.in $^ > $@
pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql: pgs_moc_compat.sql.in
cat upgrade_scripts/$@.in $^ > $@
pg_sphere--1.1.5beta4gavo--1.2.0.sql: pgs_moc_ops.sql.in
cat upgrade_scripts/$@.in $^ > $@
pg_sphere--1.2.0--1.2.1.sql: pgs_moc_geo_casts.sql.in pgs_epochprop.sql.in
cat upgrade_scripts/$@.in $^ > $@
pg_sphere--1.2.1--1.2.2.sql: upgrade_scripts/pg_sphere--1.2.1--1.2.2-healpix.sql.in
cat upgrade_scripts/$@.in $^ > $@
else
pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql:
cat upgrade_scripts/$@.in > $@
pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql:
cat upgrade_scripts/$@.in > $@
pg_sphere--1.1.5beta4gavo--1.2.0.sql:
cat upgrade_scripts/$@.in > $@
pg_sphere--1.2.0--1.2.1.sql: pgs_epochprop.sql.in
cat upgrade_scripts/$@.in $^ > $@
pg_sphere--1.2.1--1.2.2.sql:
cat upgrade_scripts/$@.in > $@
endif
pg_sphere--1.2.2--1.2.3.sql:
cat upgrade_scripts/$@.in > $@
pg_sphere--1.2.3--1.3.0.sql: pgs_brin.sql.in
cat upgrade_scripts/$@.in $^ > $@
pg_sphere--1.3.0--1.3.1.sql:
cat upgrade_scripts/$@.in > $@
pg_sphere--1.3.1--1.3.2.sql:
cat upgrade_scripts/$@.in > $@
# end of local stuff
src/sscan.o : src/sparse.c
src/sparse.c: src/sparse.y
ifdef YACC
$(YACC) -d $(YFLAGS) -p sphere_yy -o $@ $<
else
@$(missing) bison $< $@
endif
src/sscan.c : src/sscan.l
ifdef FLEX
$(FLEX) $(FLEXFLAGS) -Psphere -o$@ $<
else
@$(missing) flex $< $@
endif
dist : clean sparse.c sscan.c
find . -name '*~' -type f -exec rm {} \;
cd .. && tar --transform s/$(SRC_DIR)/pgsphere-$(PGSPHERE_VERSION)/ --exclude CVS --exclude .git -czf pgsphere-$(PGSPHERE_VERSION).tar.gz $(SRC_DIR) && cd -