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
|
include ../upgradeable_versions.mk
EXTENSION = postgis_tiger_geocoder
EXTVERSION = 2.1.4
MINORVERSION = 2011.2.1
MICRO_NUMBER = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
PREREL_NUMBER = $(shell echo $(EXTVERSION) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
grep "[a-zA-Z]" | \
sed "s/[0-9][a-zA-Z]\([0-9]*\)[a-zA-Z]*/\1/")
MICRO_PREV = $(shell if test "$(MICRO_NUMBER)x" != "x"; then expr $(MICRO_NUMBER) - 1; fi)
PREREL_PREV = $(shell if test "$(PREREL_NUMBER)x" != "x"; then expr $(PREREL_NUMBER) - 1; fi)
PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
grep "[a-zA-Z]" | \
sed "s/\([0-9][a-zA-Z]*\)[0-9]*/\1/")
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
PG_CONFIG = /var/lib/jenkins/workspace/pg/rel/pg9.2w64/bin/pg_config
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)
SQL_BITS = $(wildcard sql_bits/*.sql)
EXTRA_CLEAN += sql/*.sql ${SQL_BITS}
ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql sql_minor_upgrade
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
mkdir -p sql
cp $< $@
sql/$(EXTENSION).sql: sql_bits/tiger_geocoder.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql
mkdir -p sql
cat $^ > $@
#this is a cludge to allow upgrading from same SVN to same SVN
sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: ../postgis_extension_helper.sql sql_bits/remove_from_extension.sql.in sql/tiger_geocoder_upgrade_minor.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql ../postgis_extension_helper_uninstall.sql
mkdir -p sql
cat $^ > $@
sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql: sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql
mkdir -p sql
cp $< $@
#strip BEGIN/COMMIT since these are not allowed in extensions
#strip CREATE SCHEMA since we force extension
# to create schema by setting schema to tiger_geocoder in control
sql_bits/tiger_geocoder_minor.sql.in: ../../extras/tiger_geocoder/tiger_2011/utility/set_search_path.sql \
../../extras/tiger_geocoder/tiger_2011/tiger_loader_2013.sql \
../../extras/tiger_geocoder/tiger_2011/utility/utmzone.sql \
../../extras/tiger_geocoder/tiger_2011/utility/cull_null.sql \
../../extras/tiger_geocoder/tiger_2011/utility/nullable_levenshtein.sql \
../../extras/tiger_geocoder/tiger_2011/utility/levenshtein_ignore_case.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/end_soundex.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/count_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/state_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/get_last_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/normalize_address.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/pprint_addy.sql \
../../extras/tiger_geocoder/tiger_2011/pagc_normalize/pagc_tables.sql \
../../extras/tiger_geocoder/tiger_2011/pagc_normalize/pagc_normalize_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/other_helper_functions.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/rate_attributes.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/includes_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/interpolate_from_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_location.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_intersection.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/reverse_geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/census_tracts_functions.sql
cat $^ > $@
sql_bits/tiger_geocoder.sql.in: sql_bits/norm_addy_create.sql.in \
../../extras/tiger_geocoder/tiger_2011/utility/set_search_path.sql \
../../extras/tiger_geocoder/tiger_2011/geocode_settings.sql \
../../extras/tiger_geocoder/tiger_2011/tables/lookup_tables_2011.sql \
../../extras/tiger_geocoder/tiger_2011/tiger_loader_2013.sql \
../../extras/tiger_geocoder/tiger_2011/census_loader.sql \
../../extras/tiger_geocoder/tiger_2011/utility/set_search_path.sql \
../../extras/tiger_geocoder/tiger_2011/utility/utmzone.sql \
../../extras/tiger_geocoder/tiger_2011/utility/cull_null.sql \
../../extras/tiger_geocoder/tiger_2011/utility/nullable_levenshtein.sql \
../../extras/tiger_geocoder/tiger_2011/utility/levenshtein_ignore_case.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/end_soundex.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/count_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/state_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/get_last_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/normalize_address.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/pprint_addy.sql \
../../extras/tiger_geocoder/tiger_2011/pagc_normalize/pagc_tables.sql \
../../extras/tiger_geocoder/tiger_2011/pagc_normalize/pagc_normalize_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/other_helper_functions.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/rate_attributes.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/includes_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/interpolate_from_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_location.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_intersection.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/reverse_geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/census_tracts_functions.sql \
../../extras/tiger_geocoder/tiger_2011/topology/tiger_topology_loader.sql \
../postgis_extension_helper.sql \
sql_bits/add_search_path.sql \
../postgis_extension_helper_uninstall.sql
cat $^ > $@
sql_bits/tiger_geocoder.sql: sql_bits/tiger_geocoder.sql.in
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' -e '/^CREATE SCHEMA/d;' $< > $@
sql_bits/add_search_path.sql: sql_bits/add_search_path.sql.in
cp $< $@
../../doc/tiger_geocoder_comments.sql:
$(MAKE) -C ../../doc comments
sql_bits/tiger_geocoder_comments.sql: ../../doc/tiger_geocoder_comments.sql
cp $< $@
#grep all lines that start with CREATE OR REPLACE FUNCTION, TRIGGER...
#then replace CREATE OR REPLACE .. with ALTER EXTENSION..;
#then remove default values and extra junk
# sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../tiger_geocoder/tiger_geocoder.sql
# sed -e '/^CREATE \(OR REPLACE\|TYPE\|TABLE\|VIEW\|CAST\)/!d;' \
# -e 's/OR REPLACE//g' \
# -e 's/CREATE\(.*\)/ALTER EXTENSION $(EXTENSION) ADD\1;/' \
# -e 's/DEFAULT [\.0-9a-zA-Z]\+//g' \
# -e 's/\(BEFORE\|WITH FUNCTION\)\(.*\)/;/' \
# -e 's/[ \t]+;/;/' \
# -e 's/(;/;/' \
# -e 's/\\(;/;/' \
# -e 's/;;/;/g' $< > $@
#hardcode for now using
#the extensions/make_unpackaged.sql script form an install
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: sql_bits/tiger_geocoder--unpackaged.sql.in
mkdir -p sql
cp $< $@
#upgrade script should have everything but table, schema, type creation/alter
#NOTE: we assume all object definitions end in ;
#first expression deletes all non-removable objects defined on same line
#second deletes all non-removable defined on multiple lines
# the end of the body of object we assume ends in ;
#aggregates are special
#they can be dropped but we need to remove
#them from the extension first
sql/tiger_geocoder_upgrade_minor.sql: sql_bits/tiger_geocoder_minor.sql.in
mkdir -p sql
sed -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \
-e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \
-e 's/BEGIN;//g' -e 's/COMMIT;//g' \
$< > $@
sql_minor_upgrade: ../postgis_extension_helper.sql sql_bits/remove_from_extension.sql.in sql/tiger_geocoder_upgrade_minor.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql ../postgis_extension_helper_uninstall.sql
for OLD_VERSION in $(UPGRADEABLE_VERSIONS); do \
cat $^ > sql/$(EXTENSION)--$$OLD_VERSION--$(EXTVERSION).sql; \
done
DATA = $(wildcard sql/*--*.sql)
EXTRA_CLEAN += sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql
endif
distclean: clean
rm Makefile
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
|