11PGSPHERE_VERSION = 1.2.2
2+ EXTENSION = pg_sphere
3+ RELEASE_SQL =$(EXTENSION ) --$(PGSPHERE_VERSION ) .sql
4+ USE_PGXS = 1
5+ USE_HEALPIX =? 1
26
37# the base dir name may be changed depending on git clone command
48SRC_DIR =$(shell basename$(shell pwd) )
@@ -7,11 +11,13 @@ MODULE_big = pg_sphere
711OBJS = src/sscan.o src/sparse.o src/sbuffer.o src/vector3d.o src/point.o\
812 src/euler.o src/circle.o src/line.o src/ellipse.o src/polygon.o\
913 src/path.o src/box.o src/output.o src/gq_cache.o src/gist.o\
10- src/key.o src/gnomo.o src/healpix.o src/moc.o src/process_moc.o\
11- healpix_bare/healpix_bare.o src/epochprop.o
14+ src/key.o src/gnomo.o src/epochprop.o
15+
16+ ifneq ($(USE_HEALPIX ) ,0)
17+ OBJS += src/healpix.o src/moc.o src/process_moc.o\
18+ healpix_bare/healpix_bare.o
19+ endif
1220
13- EXTENSION = pg_sphere
14- RELEASE_SQL =$(EXTENSION ) --$(PGSPHERE_VERSION ) .sql
1521DATA_built =$(RELEASE_SQL ) \
1622 pg_sphere--unpackaged--1.1.5beta0gavo.sql\
1723 pg_sphere--1.0--1.0_gavo.sql\
@@ -24,14 +30,24 @@ DATA_built = $(RELEASE_SQL) \
2430
2531DOCS = README.pg_sphere COPYRIGHT.pg_sphere
2632REGRESS = init tables points euler circle line ellipse poly path box index\
27- contains_ops contains_ops_compat bounding_box_gist gnomo healpix\
28- moc mocautocast epochprop
33+ contains_ops contains_ops_compat bounding_box_gist gnomo
34+
35+ ifneq ($(USE_HEALPIX ) ,0)
36+ REGRESS += healpix moc mocautocast
37+ endif
38+
39+ REGRESS += epochprop
2940
3041REGRESS_9_5 = index_9.5# experimental for spoint3
3142
32- TESTS = init_test tables points euler circle line ellipse poly path box index\
33- contains_ops contains_ops_compat bounding_box_gist gnomo healpix\
34- moc mocautocast epochprop
43+ TESTS = init_test tables points euler circle line ellipse poly path box\
44+ index contains_ops contains_ops_compat bounding_box_gist gnomo
45+
46+ ifneq ($(USE_HEALPIX ) ,0)
47+ TESTS += healpix moc mocautocast
48+ endif
49+
50+ TESTS += epochprop
3551
3652PG_CFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION )
3753PG_CPPFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION )
@@ -48,14 +64,25 @@ CRUSH_TESTS = init_extended circle_extended
4864
4965# order of sql files is important
5066PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql\
51- pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql\
52- pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql\
53- pgs_gist.sql gnomo.sql\
54- healpix.sql pgs_gist_spoint3.sql pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql\
55- pgs_moc_geo_casts.sql pgs_epochprop.sql
67+ pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql\
68+ pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql\
69+ pgs_gist.sql gnomo.sql
70+
71+ ifneq ($(USE_HEALPIX ) ,0)
72+ PGS_SQL += healpix.sql
73+ endif
74+
75+ PGS_SQL += pgs_gist_spoint3.sql
76+
77+ ifneq ($(USE_HEALPIX ) ,0)
78+ PGS_SQL += pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql\
79+ pgs_moc_geo_casts.sql
80+ endif
81+
82+ PGS_SQL += pgs_epochprop.sql
83+
5684PGS_SQL_9_5 = pgs_9.5.sql# experimental for spoint3
5785
58- USE_PGXS = 1
5986ifdef USE_PGXS
6087 ifndef PG_CONFIG
6188PG_CONFIG := pg_config
7097include $(top_srcdir ) /contrib/contrib-global.mk
7198endif
7299
100+ ifneq ($(USE_HEALPIX ) ,0)
73101# compiler settings
74102PKG_CONFIG = pkg-config
75103override CPPFLAGS +=$(shell $(PKG_CONFIG ) --cflags healpix_cxx)
76104SHLIB_LINK +=$(shell $(PKG_CONFIG ) --libs healpix_cxx)
77105LINK.shared = g++ -shared
106+ endif
78107
79108# healpix_bare.c isn't ours so we refrain from fixing the warnings in there
80109healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c
@@ -96,9 +125,11 @@ has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n)
96125crushtest : REGRESS +=$(CRUSH_TESTS )
97126crushtest : installcheck
98127
128+ ifneq ($(USE_HEALPIX ) ,0)
99129ifeq ($(has_explain_summary ) ,y)
100130REGRESS += moc1 moc100
101131endif
132+ endif
102133
103134ifeq ($(pg_version_9_5_plus ) ,y)
104135PGS_TMP_DIR = --temp-instance=tmp_check
@@ -159,12 +190,17 @@ else
159190endif
160191
161192# local stuff follows here
162-
163- AUGMENT_GAVO_111 =$(AUGMENT_UNP_111 ) healpix.sql# for vanilla 1.1.1 users
193+ AUGMENT_GAVO_111 =$(AUGMENT_UNP_111 ) # for vanilla 1.1.1 users
194+ ifneq ($(USE_HEALPIX ) ,0)
195+ AUGMENT_GAVO_111 += healpix.sql
196+ endif
164197UPGRADE_GAVO_111 =$(UPGRADE_UNP_COMMON )
165198
166- # add new Healpix functions and experimental spoint3
167- AUGMENT_FROM_GAVO = healpix.sql pgs_gist_spoint3.sql
199+ # add new HEALPix functions and experimental spoint3
200+ ifneq ($(USE_HEALPIX ) ,0)
201+ AUGMENT_FROM_GAVO = healpix.sql
202+ endif
203+ AUGMENT_FROM_GAVO += pgs_gist_spoint3.sql
168204
169205AUGMENT_UNP_115B0G =$(AUGMENT_UNP_111 ) $(AUGMENT_FROM_GAVO )
170206UPGRADE_UNP_115B0G =$(UPGRADE_UNP_COMMON )
@@ -188,20 +224,37 @@ pg_sphere--1.0_gavo--1.1.5beta0gavo.sql: $(addsuffix .in, \
188224$(addprefix upgrade_scripts/,$(UPGRADE_1_0_115B0G ) ) )
189225cat upgrade_scripts/$@ .in$^ > $@
190226
227+ ifneq ($(USE_HEALPIX ) ,0)
191228pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql : pgs_moc_type.sql.in
192229cat upgrade_scripts/$@ .in$^ > $@
193230
194231pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql : pgs_moc_compat.sql.in
195232cat upgrade_scripts/$@ .in$^ > $@
196233
197234pg_sphere--1.1.5beta4gavo--1.2.0.sql : pgs_moc_ops.sql.in
198- cat$^ > $@
235+ catupgrade_scripts/ $@ .in $^ > $@
199236
200237pg_sphere--1.2.0--1.2.1.sql : pgs_moc_geo_casts.sql.in pgs_epochprop.sql.in
201238cat$^ > $@
202239
203- pg_sphere--1.2.1--1.2.2.sql : upgrade_scripts/pg_sphere--1.2.1--1.2.2.sql.in
204- cat$^ > $@
240+ pg_sphere--1.2.1--1.2.2.sql : upgrade_scripts/pg_sphere--1.2.1--1.2.2-healpix.sql.in
241+ cat upgrade_scripts/$@ .in$^ > $@
242+ else
243+ pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql :
244+ cat upgrade_scripts/$@ .in> $@
245+
246+ pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql :
247+ cat upgrade_scripts/$@ .in> $@
248+
249+ pg_sphere--1.1.5beta4gavo--1.2.0.sql :
250+ cat upgrade_scripts/$@ .in> $@
251+
252+ pg_sphere--1.2.0--1.2.1.sql : pgs_epochprop.sql.in
253+ cat upgrade_scripts/$@ .in$^ > $@
254+
255+ pg_sphere--1.2.1--1.2.2.sql :
256+ cat upgrade_scripts/$@ .in> $@
257+ endif
205258
206259# end of local stuff
207260