root/trunk/raster/rt_pg/Makefile.in

Revision 9639, 4.1 KB (checked in by strk, 6 weeks ago)

Use an SQLPP command for pre-processing SQL files (#1694)

The SQLPP command is figured at ./configure time.
It will use cpp(1) or gpp(1) if any is found in that order or
fallback to whatever CPP expands to (usually the compiler with -E)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1#############################################################################
2# $Id$
3#
4# Copyright (c) 2009-2011 Sandro Santilli <strk@keybit.net>
5#
6# This is free software; you can redistribute and/or modify it under
7# the terms of the GNU General Public Licence. See the COPYING file.
8#
9#############################################################################
10
11POSTGIS_PGSQL_VERSION=@POSTGIS_PGSQL_VERSION@
12
13MODULE_big=rtpostgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
14MODULEDIR=contrib/postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
15
16# Files to be copied to the contrib/ directory
17DATA_built=rtpostgis.sql rtpostgis_upgrade_20_minor.sql uninstall_rtpostgis.sql rtpostgis_legacy.sql
18DATA=
19
20# SQL preprocessor
21SQLPP = @SQLPP@
22
23# SQL objects (files requiring pre-processing)
24SQL_OBJS=rtpostgis.sql.in rtpostgis_drop.sql.in rtpostgis_upgrade_cleanup.sql.in rtpostgis_legacy.sql.in
25
26# Objects to build using PGXS
27OBJS=rt_pg.o
28
29# Libraries to link into the module (proj, geos)
30#
31# Note: we specify liblwgeom.a directly in SHLIB_LINK rather than using
32# -L... -l options to prevent issues with some platforms trying to link
33# to an existing liblwgeom.so in the PostgreSQL $libdir supplied by an
34# older version of PostGIS, rather than with the static liblwgeom.a
35# supplied with newer versions of PostGIS
36#
37LIBLWGEOM_LDFLAGS=../../liblwgeom/.libs/liblwgeom.a
38LIBLWGEOM_CFLAGS="-I../../liblwgeom"
39LIBPGCOMMON_CFLAGS="-I../../libpgcommon"
40LIBPGCOMMON_LDFLAGS=../../libpgcommon/libpgcommon.a
41LIBGDAL_CFLAGS=@LIBGDAL_CFLAGS@
42LIBGDAL_LDFLAGS=@LIBGDAL_LDFLAGS@
43LIBPROJ_CFLAGS=@PROJ_CPPFLAGS@
44
45PG_CPPFLAGS+=@CPPFLAGS@ $(LIBLWGEOM_CFLAGS) $(LIBGDAL_CFLAGS) $(LIBPGCOMMON_CFLAGS) $(LIBPROJ_CFLAGS) -I../rt_core
46SHLIB_LINK_F = ../rt_core/librtcore.a $(LIBLWGEOM_LDFLAGS) $(LIBPGCOMMON_LDFLAGS) $(LIBGDAL_LDFLAGS) @SHLIB_LINK@
47
48# Extra files to remove during 'make clean'
49EXTRA_CLEAN=$(SQL_OBJS) $(DATA_built) rtpostgis_upgrade.sql
50
51# PGXS information
52PG_CONFIG = @PGCONFIG@
53PGXS := @PGXS@
54include $(PGXS)
55
56# Set PERL _after_ the include of PGXS
57PERL=@PERL@
58
59# This is to workaround a bug in PGXS 8.4 win32 link line,
60# see http://trac.osgeo.org/postgis/ticket/1158#comment:57
61SHLIB_LINK := $(SHLIB_LINK_F) $(SHLIB_LINK)
62
63# PGXS override feature. The ability to allow PostGIS to install itself
64# in a versioned directory is only available in PostgreSQL >= 8.5. To
65# do this by default on older PostgreSQL versions, we need to override
66# the existing PGXS targets.
67#
68# Once PostgreSQL 8.5 becomes the minimum supported version, this entire
69# section and its associated Makefile.pgxs should be removed.
70PGXSOVERRIDE = @PGXSOVERRIDE@
71ifeq ($(PGXSOVERRIDE),1)
72        include Makefile.pgxs
73endif
74
75# If REGRESS=1 passed as a parameter, change the default install paths
76# so that no prefix is included. This allows us to relocate to a temporary
77# directory for regression testing.
78ifeq ($(REGRESS),1)
79        bindir=/bin
80        pkglibdir=/lib
81        datadir=/share
82        datamoduledir=contrib/postgis
83endif
84
85# Borrow the $libdir substitution from PGXS but customise by adding the version number
86%.sql: %.sql.in
87        sed 's,MODULE_PATHNAME,$$libdir/rtpostgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@,g' $< >$@
88
89
90# Objects dependencies
91$(OBJS): ../../liblwgeom/.libs/liblwgeom.a ../../libpgcommon/libpgcommon.a ../../postgis_config.h ../../postgis_svn_revision.h
92
93# Generate any .sql.in files from .sql.in.c files by running them through the SQL pre-processor
94$(SQL_OBJS): %.in: %.in.c
95        $(SQLPP) -I../../postgis/ -I../../ $< | grep -v '^#' > $@
96
97# SQL objects deps here
98$(SQL_OBJS): ../../postgis/sqldefines.h ../../postgis_svn_revision.h
99
100#remove all create object types since these can't be done cleanly in an upgrade
101rtpostgis_upgrade.sql: rtpostgis.sql
102        $(PERL) -0777 -ne 's/^(CREATE|ALTER) (CAST|OPERATOR|TYPE|TABLE|SCHEMA|DOMAIN|TRIGGER).*?;//msg;print;' $< > $@
103
104rtpostgis_upgrade_20_minor.sql: rtpostgis_drop.sql rtpostgis_upgrade_cleanup.sql rtpostgis_upgrade.sql
105        cat $^ > $@
106
107uninstall_rtpostgis.sql: rtpostgis.sql ../../utils/create_undef.pl
108        $(PERL) ../../utils/create_undef.pl $< $(POSTGIS_PGSQL_VERSION) > $@
109
110distclean: clean
111        rm -f Makefile
Note: See TracBrowser for help on using the browser.