| 1 | # **********************************************************************
|
|---|
| 2 | # *
|
|---|
| 3 | # * PostGIS - Spatial Types for PostgreSQL
|
|---|
| 4 | # * http://postgis.net
|
|---|
| 5 | # *
|
|---|
| 6 | # * PostGIS is free software: you can redistribute it and/or modify
|
|---|
| 7 | # * it under the terms of the GNU General Public License as published by
|
|---|
| 8 | # * the Free Software Foundation, either version 2 of the License, or
|
|---|
| 9 | # * (at your option) any later version.
|
|---|
| 10 | # *
|
|---|
| 11 | # * PostGIS is distributed in the hope that it will be useful,
|
|---|
| 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 14 | # * GNU General Public License for more details.
|
|---|
| 15 | # *
|
|---|
| 16 | # * You should have received a copy of the GNU General Public License
|
|---|
| 17 | # * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 18 | # *
|
|---|
| 19 | # **********************************************************************
|
|---|
| 20 | # *
|
|---|
| 21 | # * Copyright 2008 Mark Cave-Ayland
|
|---|
| 22 | # *
|
|---|
| 23 | # **********************************************************************
|
|---|
| 24 |
|
|---|
| 25 | POSTGIS_PGSQL_VERSION=@POSTGIS_PGSQL_VERSION@
|
|---|
| 26 | PROTOC_VERSION=@PROTOC_VERSION@
|
|---|
| 27 | MODULE_big=postgis-@POSTGIS_MAJOR_VERSION@
|
|---|
| 28 | MODULEDIR=contrib/postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
|
|---|
| 29 | MODULEPATH = $$libdir/postgis-@POSTGIS_MAJOR_VERSION@
|
|---|
| 30 |
|
|---|
| 31 | ifeq (@LIBINCLUDEMINORVERSION@,yes)
|
|---|
| 32 | MODULEPATH=$$libdir/postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
|
|---|
| 33 | MODULE_big=postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
|
|---|
| 34 | endif
|
|---|
| 35 |
|
|---|
| 36 | # Files to be copied to the contrib/ directory
|
|---|
| 37 | SQL_built=postgis.sql uninstall_postgis.sql postgis_upgrade.sql postgis_proc_set_search_path.sql legacy.sql uninstall_legacy.sql legacy_minimal.sql legacy_gist.sql
|
|---|
| 38 | DATA=../spatial_ref_sys.sql
|
|---|
| 39 |
|
|---|
| 40 | # SQL objects (files requiring pre-processing)
|
|---|
| 41 | SQL_objs=postgis.sql legacy.sql legacy_minimal.sql
|
|---|
| 42 |
|
|---|
| 43 | GEOM_BACKEND_OBJ = lwgeom_geos.o
|
|---|
| 44 | SFCGAL_BACKEND_OBJ = lwgeom_sfcgal.o
|
|---|
| 45 |
|
|---|
| 46 | ifeq (@SFCGAL@,sfcgal)
|
|---|
| 47 | DATA_built=$(SQL_built) sfcgal.sql sfcgal_upgrade.sql uninstall_sfcgal.sql
|
|---|
| 48 | SQL_OBJS=$(SQL_objs) sfcgal.sql
|
|---|
| 49 | BACKEND_OBJ=$(GEOM_BACKEND_OBJ) $(SFCGAL_BACKEND_OBJ)
|
|---|
| 50 | else
|
|---|
| 51 | BACKEND_OBJ=$(GEOM_BACKEND_OBJ)
|
|---|
| 52 | DATA_built=$(SQL_built)
|
|---|
| 53 | SQL_OBJS=$(SQL_objs)
|
|---|
| 54 | endif
|
|---|
| 55 |
|
|---|
| 56 | ifeq (@HAVE_SPGIST@,yes)
|
|---|
| 57 | SPGIST_OBJ= gserialized_spgist_2d.o gserialized_spgist_3d.o gserialized_spgist_nd.o
|
|---|
| 58 | endif
|
|---|
| 59 |
|
|---|
| 60 | ifeq (@HAVE_PROTOBUF@,yes)
|
|---|
| 61 | PROTOBUF_OBJ = vector_tile.pb-c.o
|
|---|
| 62 | ifeq (@HAVE_GEOBUF@,yes)
|
|---|
| 63 | PROTOBUF_OBJ += geobuf.pb-c.o
|
|---|
| 64 | endif
|
|---|
| 65 | UTHASH_INCLUDE = -I../deps/uthash/include
|
|---|
| 66 | endif
|
|---|
| 67 |
|
|---|
| 68 | WAGYU_LIBPATH = ../deps/wagyu/@WAGYU_LIB@
|
|---|
| 69 | ifeq (@HAVE_WAGYU@,yes)
|
|---|
| 70 | WAYGU_INCLUDE = -I../deps/wagyu
|
|---|
| 71 | WAYGU_LIB = $(WAGYU_LIBPATH) @WAGYU_LDFLAGS@
|
|---|
| 72 | WAGYU_DEP = $(WAGYU_LIBPATH)
|
|---|
| 73 | endif
|
|---|
| 74 |
|
|---|
| 75 | # SQL preprocessor
|
|---|
| 76 | SQLPP = @SQLPP@
|
|---|
| 77 |
|
|---|
| 78 | # PostgreSQL objects
|
|---|
| 79 | PG_OBJS= \
|
|---|
| 80 | postgis_module.o \
|
|---|
| 81 | lwgeom_accum.o \
|
|---|
| 82 | lwgeom_spheroid.o \
|
|---|
| 83 | lwgeom_ogc.o \
|
|---|
| 84 | lwgeom_functions_analytic.o \
|
|---|
| 85 | lwgeom_inout.o \
|
|---|
| 86 | lwgeom_functions_basic.o \
|
|---|
| 87 | lwgeom_btree.o \
|
|---|
| 88 | lwgeom_box.o \
|
|---|
| 89 | lwgeom_box3d.o \
|
|---|
| 90 | $(BACKEND_OBJ) \
|
|---|
| 91 | lwgeom_geos_prepared.o \
|
|---|
| 92 | lwgeom_geos_clean.o \
|
|---|
| 93 | lwgeom_geos_relatematch.o \
|
|---|
| 94 | lwgeom_export.o \
|
|---|
| 95 | lwgeom_in_gml.o \
|
|---|
| 96 | lwgeom_in_kml.o \
|
|---|
| 97 | lwgeom_in_geohash.o \
|
|---|
| 98 | lwgeom_in_geojson.o \
|
|---|
| 99 | lwgeom_in_encoded_polyline.o \
|
|---|
| 100 | lwgeom_triggers.o \
|
|---|
| 101 | lwgeom_dump.o \
|
|---|
| 102 | lwgeom_dumppoints.o \
|
|---|
| 103 | lwgeom_functions_lrs.o \
|
|---|
| 104 | lwgeom_functions_temporal.o \
|
|---|
| 105 | lwgeom_rectree.o \
|
|---|
| 106 | long_xact.o \
|
|---|
| 107 | lwgeom_sqlmm.o \
|
|---|
| 108 | lwgeom_rtree.o \
|
|---|
| 109 | lwgeom_transform.o \
|
|---|
| 110 | lwgeom_window.o \
|
|---|
| 111 | gserialized_typmod.o \
|
|---|
| 112 | gserialized_gist_2d.o \
|
|---|
| 113 | gserialized_gist_nd.o \
|
|---|
| 114 | gserialized_supportfn.o \
|
|---|
| 115 | $(SPGIST_OBJ) \
|
|---|
| 116 | brin_2d.o \
|
|---|
| 117 | brin_nd.o \
|
|---|
| 118 | brin_common.o \
|
|---|
| 119 | gserialized_estimate.o \
|
|---|
| 120 | geography_inout.o \
|
|---|
| 121 | geography_btree.o \
|
|---|
| 122 | geography_centroid.o \
|
|---|
| 123 | geography_measurement.o \
|
|---|
| 124 | geography_measurement_trees.o \
|
|---|
| 125 | geometry_inout.o \
|
|---|
| 126 | postgis_libprotobuf.o \
|
|---|
| 127 | $(PROTOBUF_OBJ) \
|
|---|
| 128 | mvt.o \
|
|---|
| 129 | lwgeom_out_mvt.o \
|
|---|
| 130 | geobuf.o \
|
|---|
| 131 | lwgeom_out_geobuf.o \
|
|---|
| 132 | lwgeom_out_geojson.o \
|
|---|
| 133 | postgis_legacy.o
|
|---|
| 134 |
|
|---|
| 135 | # Objects to build using PGXS
|
|---|
| 136 | OBJS=$(PG_OBJS)
|
|---|
| 137 |
|
|---|
| 138 | # Libraries to link into the module (proj, geos)
|
|---|
| 139 | #
|
|---|
| 140 | # Note: we specify liblwgeom.a directly in SHLIB_LINK rather than using
|
|---|
| 141 | # -L... -l options to prevent issues with some platforms trying to link
|
|---|
| 142 | # to an existing liblwgeom.so in the PostgreSQL $libdir supplied by an
|
|---|
| 143 | # older version of PostGIS, rather than with the static liblwgeom.a
|
|---|
| 144 | # supplied with newer versions of PostGIS
|
|---|
| 145 | PG_CPPFLAGS += -I../liblwgeom @CFLAGS@ -I../libpgcommon $(WAYGU_INCLUDE) $(UTHASH_INCLUDE) @CPPFLAGS@ @PICFLAGS@
|
|---|
| 146 | SHLIB_LINK_F = $(WAYGU_LIB) ../libpgcommon/libpgcommon.a ../liblwgeom/.libs/liblwgeom.a @SHLIB_LINK@
|
|---|
| 147 |
|
|---|
| 148 | # Add SFCGAL Flags if defined
|
|---|
| 149 | ifeq (@SFCGAL@,sfcgal)
|
|---|
| 150 | PG_CPPFLAGS += @SFCGAL_CPPFLAGS@
|
|---|
| 151 | SHLIB_LINK_F += @SFCGAL_LDFLAGS@
|
|---|
| 152 | endif
|
|---|
| 153 |
|
|---|
| 154 | # Extra files to remove during 'make clean'
|
|---|
| 155 | EXTRA_CLEAN=$(SQL_OBJS) \
|
|---|
| 156 | uninstall_postgis.sql \
|
|---|
| 157 | uninstall_legacy.sql \
|
|---|
| 158 | uninstall_sfcgal.sql \
|
|---|
| 159 | postgis_upgrade.sql.in \
|
|---|
| 160 | postgis_upgrade.sql \
|
|---|
| 161 | sfcgal_upgrade.sql.in \
|
|---|
| 162 | sfcgal_upgrade.sql \
|
|---|
| 163 | vector_tile.pb-c.c \
|
|---|
| 164 | vector_tile.pb-c.h \
|
|---|
| 165 | geobuf.pb-c.c \
|
|---|
| 166 | geobuf.pb-c.h
|
|---|
| 167 |
|
|---|
| 168 | # PGXS information
|
|---|
| 169 | PG_CONFIG := @PG_CONFIG@
|
|---|
| 170 | PGXS := @PGXS@
|
|---|
| 171 | # NO_TEMP_INSTALL is a workaround for a 9.5dev bug. See:
|
|---|
| 172 | # http://www.postgresql.org/message-id/CAB7nPqTsR5o3g-fBi6jbsVdhfPiLFWQ_0cGU5=94Rv_8W3qvFA@mail.gmail.com
|
|---|
| 173 | NO_TEMP_INSTALL=yes
|
|---|
| 174 | include $(PGXS)
|
|---|
| 175 |
|
|---|
| 176 | # Set PERL _after_ the include of PGXS
|
|---|
| 177 | PERL=@PERL@
|
|---|
| 178 |
|
|---|
| 179 | # This is to workaround a bug in PGXS 8.4 win32 link line,
|
|---|
| 180 | # see http://trac.osgeo.org/postgis/ticket/1158#comment:57
|
|---|
| 181 | SHLIB_LINK := $(SHLIB_LINK_F) $(SHLIB_LINK)
|
|---|
| 182 |
|
|---|
| 183 | # If REGRESS=1 passed as a parameter, change the default install paths
|
|---|
| 184 | # so that no prefix is included. This allows us to relocate to a temporary
|
|---|
| 185 | # directory for regression testing.
|
|---|
| 186 | ifeq ($(REGRESS),1)
|
|---|
| 187 | bindir=/bin
|
|---|
| 188 | pkglibdir=/lib
|
|---|
| 189 | datadir=/share
|
|---|
| 190 | datamoduledir=contrib/postgis
|
|---|
| 191 | endif
|
|---|
| 192 |
|
|---|
| 193 | # Make all PostGIS objects depend upon liblwgeom, so that if an underlying
|
|---|
| 194 | # change is made, a PostGIS rebuild is triggered.
|
|---|
| 195 | #
|
|---|
| 196 | # Also they are all dependent on postgis_config.h
|
|---|
| 197 | # and thus postgis_svn_revision.h
|
|---|
| 198 | #
|
|---|
| 199 | $(PG_OBJS): ../liblwgeom/.libs/liblwgeom.a ../libpgcommon/libpgcommon.a ../postgis_config.h ../postgis_svn_revision.h $(WAGYU_DEP)
|
|---|
| 200 |
|
|---|
| 201 | ../postgis_svn_revision.h:
|
|---|
| 202 | $(MAKE) -C .. postgis_svn_revision.h
|
|---|
| 203 |
|
|---|
| 204 | ../liblwgeom/.libs/liblwgeom.a:
|
|---|
| 205 | $(MAKE) -C ../liblwgeom liblwgeom.la
|
|---|
| 206 |
|
|---|
| 207 | ../libpgcommon/libpgcommon.a:
|
|---|
| 208 | $(MAKE) -C ../libpgcommon libpgcommon.a
|
|---|
| 209 |
|
|---|
| 210 | $(WAGYU_LIBPATH):
|
|---|
| 211 | $(MAKE) -C ../deps/wagyu all
|
|---|
| 212 |
|
|---|
| 213 | # Get protobuf-c compiler command
|
|---|
| 214 | PROTOCC=@PROTOCC@
|
|---|
| 215 |
|
|---|
| 216 | # Generate Mapbox Vector Tile encoder/decoder using protobuf-c compiler
|
|---|
| 217 | vector_tile.pb-c.c vector_tile.pb-c.h: vector_tile.proto
|
|---|
| 218 | $(PROTOCC) --c_out=. $<
|
|---|
| 219 |
|
|---|
| 220 | # Generate Geobuf encoder/decoder using protobuf-c compiler
|
|---|
| 221 | geobuf.pb-c.c geobuf.pb-c.h: geobuf.proto
|
|---|
| 222 | $(PROTOCC) --c_out=. $<
|
|---|
| 223 |
|
|---|
| 224 | ifeq (@HAVE_PROTOBUF@,yes)
|
|---|
| 225 | lwgeom_out_mvt.o: vector_tile.pb-c.h
|
|---|
| 226 | mvt.o: vector_tile.pb-c.h
|
|---|
| 227 | ifeq (@HAVE_GEOBUF@,yes)
|
|---|
| 228 | lwgeom_out_geobuf.o: geobuf.pb-c.h
|
|---|
| 229 | geobuf.o: geobuf.pb-c.h
|
|---|
| 230 | endif
|
|---|
| 231 | endif
|
|---|
| 232 |
|
|---|
| 233 | # Borrow the $libdir substitution from PGXS but customise by running the preprocessor
|
|---|
| 234 | # and adding the version number
|
|---|
| 235 | # replace @extschema@. with nothing, this is only used as placeholder for extension install
|
|---|
| 236 | %.sql: %.sql.in
|
|---|
| 237 | $(SQLPP) -I../libpgcommon $< | grep -v '^#' | \
|
|---|
| 238 | $(PERL) -lpe "s'MODULE_PATHNAME'\$(MODULEPATH)'g;s'@extschema@\.''g" > $@
|
|---|
| 239 |
|
|---|
| 240 | #this is redundant but trying to fold in with extension just hangs
|
|---|
| 241 | postgis_upgrade.sql.in: postgis.sql ../utils/postgis_proc_upgrade.pl
|
|---|
| 242 | $(PERL) ../utils/postgis_proc_upgrade.pl $< UNUSED > $@
|
|---|
| 243 |
|
|---|
| 244 | postgis_proc_set_search_path.sql: postgis.sql ../utils/postgis_proc_set_search_path.pl
|
|---|
| 245 | $(PERL) ../utils/postgis_proc_set_search_path.pl $< UNUSED > $@
|
|---|
| 246 |
|
|---|
| 247 | postgis_upgrade.sql: postgis_before_upgrade.sql postgis_upgrade.sql.in postgis_after_upgrade.sql
|
|---|
| 248 | echo "BEGIN;" > $@
|
|---|
| 249 | cat $^ >> $@
|
|---|
| 250 | echo "COMMIT;" >> $@
|
|---|
| 251 |
|
|---|
| 252 | sfcgal_upgrade.sql.in: sfcgal.sql ../utils/postgis_proc_upgrade.pl
|
|---|
| 253 | $(PERL) ../utils/postgis_proc_upgrade.pl $< UNUSED > $@
|
|---|
| 254 |
|
|---|
| 255 | sfcgal_upgrade.sql: sfcgal_upgrade.sql.in postgis_after_upgrade.sql
|
|---|
| 256 | cat $^ > $@
|
|---|
| 257 |
|
|---|
| 258 | # SQL objects are also dependent on postgis_config.h for PostgreSQL version
|
|---|
| 259 | $(SQL_OBJS): ../postgis_config.h ../postgis_svn_revision.h
|
|---|
| 260 |
|
|---|
| 261 | #postgis.sql.in: sqldefines.h long_xact.sql.in.c geography.sql.in.c
|
|---|
| 262 |
|
|---|
| 263 | uninstall_postgis.sql: postgis.sql ../utils/create_undef.pl
|
|---|
| 264 | $(PERL) ../utils/create_undef.pl $< $(POSTGIS_PGSQL_VERSION) > $@
|
|---|
| 265 |
|
|---|
| 266 | uninstall_legacy.sql: legacy.sql ../utils/create_undef.pl
|
|---|
| 267 | $(PERL) ../utils/create_undef.pl $< $(POSTGIS_PGSQL_VERSION) > $@
|
|---|
| 268 |
|
|---|
| 269 | uninstall_sfcgal.sql: sfcgal.sql ../utils/create_undef.pl
|
|---|
| 270 | $(PERL) ../utils/create_undef.pl $< $(POSTGIS_PGSQL_VERSION) > $@
|
|---|
| 271 |
|
|---|
| 272 | distclean: clean
|
|---|
| 273 | rm -f Makefile
|
|---|
| 274 |
|
|---|
| 275 | check-unit:
|
|---|
| 276 |
|
|---|
| 277 | check-regress:
|
|---|
| 278 |
|
|---|
| 279 | maintainer-clean: distclean
|
|---|