SQL_BITS = $(wildcard sql_bits/*.sql)
EXTRA_CLEAN += ${SQL_BITS} sql/*.sql
+# Update PREV_big manually on branching
+# TODO: move this definition in ../../Version.config
+PREV_big=21
+CURV_big=@POSTGIS_MAJOR_VERSION@@POSTGIS_MINOR_VERSION@
ifeq ($(PG91),yes)
sql/$(EXTENSION).sql: sql_bits/postgis.sql sql_bits/postgis_comments.sql sql_bits/rtpostgis.sql sql_bits/mark_editable_objects.sql.in sql_bits/raster_comments.sql sql_bits/spatial_ref_sys.sql
# for casts that are being dropped we need to drop them
# from extension only if they are in the existension so we use our postgis_extension_drop..
# so that it will silently fail if cast is not in extension
-sql_bits/rtpostgis_upgrade_20_21.sql: ../../raster/rt_pg/rtpostgis_upgrade_20_21.sql
+sql_bits/rtpostgis_upgrade_$(PREV_big)_$(CURV_big).sql: ../../raster/rt_pg/rtpostgis_upgrade_$(PREV_big)_$(CURV_big).sql
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' \
-e 's/DROP FUNCTION _rename_raster_tables();/ALTER EXTENSION ${EXTENSION} DROP FUNCTION _rename_raster_tables();DROP FUNCTION _rename_raster_tables();/g' \
-e 's/DROP FUNCTION _drop_st_samealignment();/ALTER EXTENSION ${EXTENSION} DROP FUNCTION _drop_st_samealignment();DROP FUNCTION _drop_st_samealignment();/g' \
#don't drop casts just yet since we don't have provision to remove from extension yet
#need to also drop temporary functions from extenions since it gets auto-added
-sql_bits/postgis_upgrade_20_21.sql: ../../postgis/postgis_upgrade_20_21.sql
+sql_bits/postgis_upgrade_$(PREV_big)_$(CURV_big).sql: ../../postgis/postgis_upgrade_$(PREV_big)_$(CURV_big).sql
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' \
-e '/^\(DROP\|CREATE\) \(CAST\).*;/d' \
-e '/^\(DROP\|CREATE\) \(CAST\)/,/\;/d' \
#postgis_raster_upgrade_minor.sql is the one that contains both postgis AND raster
#TODO: come up with a better name
#TODO: what about postgis_drop_after.sql ? where does it fit ??
-sql_bits/postgis_raster_upgrade_minor.sql: ../postgis_extension_helper.sql sql_bits/remove_from_extension.sql.in sql_bits/postgis_upgrade_20_21.sql sql_bits/rtpostgis_upgrade_20_21.sql ../../doc/raster_comments.sql ../../doc/postgis_comments.sql ../postgis_extension_helper_uninstall.sql
+sql_bits/postgis_raster_upgrade_minor.sql: ../postgis_extension_helper.sql sql_bits/remove_from_extension.sql.in sql_bits/postgis_upgrade_$(PREV_big)_$(CURV_big).sql sql_bits/rtpostgis_upgrade_$(PREV_big)_$(CURV_big).sql ../../doc/raster_comments.sql ../../doc/postgis_comments.sql ../postgis_extension_helper_uninstall.sql
cat $^ > $@
# sql_bits/rtpostgis--unpackaged.sql: ../../raster/rt_pg/rtpostgis.sql
-#############################################################################
+############################################################################
# $Id$
#
# Copyright (c) 2009-2011 Sandro Santilli <strk@keybit.net>
MODULE_big=rtpostgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
MODULEDIR=contrib/postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
+# Update PREV_big manually on branching
+# TODO: move this definition in ../../Version.config
+PREV_big=21
+CURV_big=@POSTGIS_MAJOR_VERSION@@POSTGIS_MINOR_VERSION@
+
# Files to be copied to the contrib/ directory
-DATA_built=rtpostgis.sql rtpostgis_upgrade_20_21.sql rtpostgis_upgrade_21_minor.sql uninstall_rtpostgis.sql rtpostgis_legacy.sql
+DATA_built=rtpostgis.sql rtpostgis_upgrade_$(PREV_big)_$(CURV_big).sql rtpostgis_upgrade_$(CURV_big)_minor.sql uninstall_rtpostgis.sql rtpostgis_legacy.sql
DATA=
# SQL preprocessor
rtpostgis_upgrade.sql: rtpostgis.sql
$(PERL) -0777 -ne 's/^(CREATE|ALTER) (CAST|OPERATOR|TYPE|TABLE|SCHEMA|DOMAIN|TRIGGER).*?;//msg;print;' $< > $@
-rtpostgis_upgrade_20_21.sql: rtpostgis_upgrade_cleanup.sql rtpostgis_drop.sql rtpostgis_upgrade.sql
+rtpostgis_upgrade_$(PREV_big)_$(CURV_big).sql: rtpostgis_upgrade_cleanup.sql rtpostgis_drop.sql rtpostgis_upgrade.sql
cat $^ > $@
-# same as 20_21 until 2.1.0 is released
-rtpostgis_upgrade_21_minor.sql: rtpostgis_upgrade_cleanup.sql rtpostgis_drop.sql rtpostgis_upgrade.sql
+# same as $(PREV_big)_$(CURV_big) until next .0 is released
+rtpostgis_upgrade_$(CURV_big)_minor.sql: rtpostgis_upgrade_cleanup.sql rtpostgis_drop.sql rtpostgis_upgrade.sql
cat $^ > $@
uninstall_rtpostgis.sql: rtpostgis.sql ../../utils/create_undef.pl