File: Makefile.rt.sample

package info (click to toggle)
postgis 3.5.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 70,052 kB
  • sloc: ansic: 162,204; sql: 93,950; xml: 53,121; cpp: 12,646; perl: 5,658; sh: 5,369; makefile: 3,434; python: 1,205; yacc: 447; lex: 151; pascal: 58
file content (80 lines) | stat: -rw-r--r-- 3,018 bytes parent folder | download | duplicates (2)
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
#############################################################################
#
# Makefile used to simplify creation of PostGIS and WKT Raster enabled
# database. Run make -f Makefile.rt to see usage message.
#
#############################################################################
# Copyright (C) 2009 Mateusz Loskot <mateusz@loskot.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
#############################################################################
#
# Instructions:
# You may need to update the location of SQL scripts of PostGIS
# and WKT Raster extensions.
#
### BEGIN OF CONFIGURATION ##################################################
POSTGIS = /usr/share/postgresql/8.4/contrib/postgis-2.0
RTPOSTGIS = /usr/share/postgresql/8.4/contrib/rtpostgis-2.0
### END OF CONFIGURATION ####################################################
#
# *** DO NOT EDIT ANYTHING BELOW ***

ifndef VERBOSE
	ERROUT=2>&1
endif

all:
	@echo "****** Makefile.rt usage ******"
	@echo "*** Create PostGIS and WKT Raster enabled database:"
	@echo "\tDBNAME=mydb make -f Makefile.rt create"
	@echo "*** Drop PostGIS and WKT Raster enabled database:"
	@echo "\tDBNAME=mydb make -f Makefile.rt drop"
	@echo "*** Check if database exists:"
	@echo "\tDBNAME=mydb make -f Makefile.rt check"
	@echo "PostGIS installation scripts: $(POSTGIS)"
drop:
	@echo "****** Makefile.rt ******"
ifdef DBNAME
	@echo "*** Dropping database '$(DBNAME)'..."
	@dropdb $(DBNAME) > /dev/null $(ERROUT);
	@echo "****** END. *******"
else
	@echo "****** Missing DBNAME option. Aborting."
endif

create:
	@echo "****** Makefile.rt ******"
ifdef DBNAME
	@echo "****** Creating database '$(DBNAME)'..."
	@createdb --tablespace=tablespace2 $(DBNAME) > /dev/null $(ERROUT);
	@echo "****** Loading PostGIS into '$(DBNAME)'..."
	@psql -d $(DBNAME) -f $(POSTGIS)/postgis.sql > /dev/null $(ERROUT);
	@psql -d $(DBNAME) -f $(POSTGIS)/spatial_ref_sys.sql > /dev/null $(ERROUT);
	@echo "****** Loading WKT Raster into '$(DBNAME)'..."
	@psql -d $(DBNAME) -f $(RTPOSTGIS)/rtpostgis.sql > /dev/null $(ERROUT);
	@echo "****** END. *******"
else
	@echo "****** Missing DBNAME option. Aborting."
endif

check:
	@echo "****** Makefile.rt ******"
ifeq ($(shell psql -l | grep ' $(DBNAME) '  | wc -l), 1)
	@echo "****** Database '$(DBNAME)' found"
else
	@echo "****** Database '$(DBNAME)' not found"
endif