#############################################################################
#
# Copyright (c) 2009-2022 Sandro Santilli <strk@kbt.io>
# Copyright (c) 2009 Pierre Racine <pierre.racine@sbf.ulaval.ca>
# Copyright (c) 2011 Jorge Arevalo <jorge.arevalo@deimos-space.com>
# Copyright (c) 2011-2013 Regents of the University of California
#   <bkpark@ucdavis.edu>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU General Public Licence. See the COPYING file.
# 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.
#
#############################################################################

top_srcdir = @top_srcdir@
srcdir = @srcdir@
top_builddir = @top_builddir@

POSTGIS_SRC=../../..
PERL=@PERL@

# MingW hack: rather than use PGSQL_BINDIR directly, we change
# to the directory and then use "pwd" to return the path. This
# ensures that the returned path is in MSYS format, otherwise
# colons in drive letters will break PATH.
PGSQL_BINDIR=$(shell cd "@PGSQL_BINDIR@" && pwd)

# Where we put our regression installation
REGRESS_INSTALLDIR = $(realpath $(top_builddir) )/regress/00-regress-install

#
# Put path from pg_config into front of search path
#
PATH := $(PGSQL_BINDIR):$(PATH)
export PATH

all:
	@echo "Use 'make check' to run all tests"

distclean: clean
	rm -f Makefile

clean:
	$(RM) -f rtpostgis.sql

rtpostgis.sql: ../../rt_pg/rtpostgis.sql
	$(PERL) -lpe "s'\\\$$libdir'$(REGRESS_INSTALLDIR)/lib'g" $< > $@


include $(srcdir)/tests.mk
include $(top_srcdir)/regress/runtest.mk

check: check-regress
