root/spike/wktraster/scripts/Makefile.rt.sample

Revision 4645, 2.4 KB (checked in by mloskot, 2 years ago)

[wktraster] Improved version of genraster.py utility

  • Property svn:keywords set to Id
Line 
1#############################################################################
2# $Id$
3#
4# Makefile used to simplify creation of PostGIS and WKT Raster enabled
5# database. Run make -f Makefile.rt to see usage message.
6#
7#############################################################################
8# Copyright (C) 2009 Mateusz Loskot <mateusz@loskot.net>
9#
10# This is free software; you can redistribute and/or modify it under
11# the terms of the GNU General Public Licence. See the COPYING file.
12#
13#############################################################################
14#
15# Instructions:
16# You may need to update the location of SQL scripts of PostGIS
17# and WKT Raster extensions.
18#
19### BEGIN OF CONFIGURATION ##################################################
20POSTGIS = /usr/share/postgresql/8.4/contrib
21WKTRASTER = ${POSTGIS}
22### END OF CONFIGURATION ####################################################
23#
24# *** DO NOT EDIT ANYTHING BELOW ***
25
26ifndef VERBOSE
27        ERROUT=2>&1
28endif
29
30all:
31        @echo "****** Makefile.rt usage ******"
32        @echo "*** Create PostGIS and WKT Raster enabled database:"
33        @echo "\tDBNAME=mydb make -f Makefile.rt create"
34        @echo "*** Drop PostGIS and WKT Raster enabled database:"
35        @echo "\tDBNAME=mydb make -f Makefile.rt drop"
36        @echo "*** Check if database exists:"
37        @echo "\tDBNAME=mydb make -f Makefile.rt check"
38        @echo "PostGIS installation scripts: $(POSTGIS)"
39drop:
40        @echo "****** Makefile.rt ******"
41ifdef DBNAME
42        @echo "*** Dropping database '$(DBNAME)'..."
43        @dropdb $(DBNAME) > /dev/null $(ERROUT);
44        @echo "****** END. *******"
45else
46        @echo "****** Missing DBNAME option. Aborting."
47endif
48
49create:
50        @echo "****** Makefile.rt ******"
51ifdef DBNAME
52        @echo "****** Creating database '$(DBNAME)'..."
53        @createdb --tablespace=tablespace2 $(DBNAME) > /dev/null $(ERROUT);
54        @createlang plpgsql $(DBNAME) > /dev/null $(ERROUT);
55        @echo "****** Loading PostGIS into '$(DBNAME)'..."
56        @psql -d $(DBNAME) -f $(POSTGIS)/postgis.sql > /dev/null $(ERROUT);
57        @psql -d $(DBNAME) -f $(POSTGIS)/spatial_ref_sys.sql > /dev/null $(ERROUT);
58        @echo "****** Loading WKT Raster into '$(DBNAME)'..."
59        @psql -d $(DBNAME) -f $(WKTRASTER)/rtpostgis.sql > /dev/null $(ERROUT);
60        @echo "****** END. *******"
61else
62        @echo "****** Missing DBNAME option. Aborting."
63endif
64
65check:
66        @echo "****** Makefile.rt ******"
67ifeq ($(shell psql -l | grep ' $(DBNAME) '  | wc -l), 1)
68        @echo "****** Database '$(DBNAME)' found"
69else
70        @echo "****** Database '$(DBNAME)' not found"
71endif
Note: See TracBrowser for help on using the browser.