1# **********************************************************************
2# *
3# * PostGIS - Spatial Types for PostgreSQL
4# * http://postgis.net
5# *
6# * Copyright 2008 Mark Cave-Ayland
7# *
8# * This is free software; you can redistribute and/or modify it under
9# * the terms of the GNU General Public Licence. See the COPYING file.
10# *
11# **********************************************************************
12
13# Separate PGXS-enabled Makefile for documentation installation (it is
14# not possible to merge into the main Makefile as has been done for
15# the shapefile loader)
16
17MODULE_doc=postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
18MODULEDIR=contrib/$(MODULE_doc)
19
20# Files to be copied to the contrib/ directory
21DATA_built=postgis_restore.pl
22
23# PGXS information
24PG_CONFIG := @PG_CONFIG@
25PGXS := @PGXS@
26include $(PGXS)
27
28SHELL = @SHELL@
29INSTALL = $(SHELL) ../build-aux/install-sh
30
31SCRIPTS_built = postgis_restore.pl
32
33SCRIPTS = \
34	create_undef.pl \
35	repo_revision.pl \
36	postgis_proc_upgrade.pl \
37	profile_intersects.pl \
38	test_estimation.pl \
39	test_joinestimation.pl
40
41SRID_MAXIMUM = @SRID_MAX@
42SRID_USER_MAXIMUM = @SRID_USR_MAX@
43
44all: postgis_restore.pl
45	chmod +x $(SCRIPTS)
46
47DROP_FILES = \
48  ../raster/rt_pg/rtpostgis_upgrade_cleanup.sql.in \
49  ../raster/rt_pg/rtpostgis_drop.sql.in \
50  ../postgis/postgis_after_upgrade.sql \
51  ../postgis/postgis_before_upgrade.sql
52
53update-restore:
54	tac postgis_restore.pl.in | sed '/^__END__/q' | grep -v '^__END__' \
55    > postgis_restore_data
56	grep '^DROP FUNCTION IF EXISTS' $(DROP_FILES) | \
57    cut -d: -f2 | sed 's/^DROP FUNCTION IF EXISTS //' | \
58    sed 's/ *, */,/g' | \
59    sed 's/ *( */(/g' | \
60    sed 's/ *) */)/g' | \
61    tr '[A-Z]' '[a-z]' | \
62    sed 's/varchar/character varying/g' | \
63    sed 's/float8/double precision/g' | \
64    sed 's/\<int\>/integer/g' | \
65    sed 's/\<int4\>/integer/g' | \
66    sed 's/\<int8\>/bigint/g' | \
67    sed 's/\(.*\); *\(--.*\)\?/FUNCTION \1/' >> postgis_restore_data
68	cat postgis_restore.pl.in | sed '/^__END__/q' > postgis_restore.pl.in.new
69	cat postgis_restore_data | sort -u >> postgis_restore.pl.in.new
70	mv postgis_restore.pl.in.new postgis_restore.pl.in
71	rm -f postgis_restore_data
72
73postgis_restore.pl: postgis_restore.pl.in
74	sed 's,@SRID_MAXIMUM@,$(SRID_MAXIMUM),g;s,@SRID_USER_MAXIMUM@,$(SRID_USER_MAXIMUM),' $< >$@
75
76distclean: clean
77	rm -f Makefile
78
79# And there's nothing to check
80check check-unit check-regress:
81