#############################################################################
#
# Copyright (c) 2009-2022 Sandro Santilli <strk@kbt.io>
#
# 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.
#
#############################################################################

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

AR = @AR@ @AR_FLAGS@

CC = @CC@
LIBLWGEOM_LDFLAGS = $(top_builddir)/liblwgeom/.libs/liblwgeom.a
LIBLWGEOM_CFLAGS = -I$(top_srcdir)/liblwgeom -I$(top_builddir)/liblwgeom -I$(top_builddir) -I$(top_builddir)/raster -I$(builddir)
LIBGDAL_CFLAGS = @LIBGDAL_CFLAGS@
LIBGDAL_LDFLAGS = @LIBGDAL_LDFLAGS@
GEOS_LDFLAGS = @GEOS_LDFLAGS@
PROJ_LDFLAGS = @PROJ_LDFLAGS@
LDFLAGS = $(LIBLWGEOM_LDFLAGS) $(LIBGDAL_LDFLAGS) $(PROJ_LDFLAGS) $(GEOS_LDFLAGS)
CFLAGS = $(LIBLWGEOM_CFLAGS) @CPPFLAGS@ @CFLAGS@ @PICFLAGS@ $(LIBGDAL_CFLAGS) @PROJ_CPPFLAGS@ @GEOS_CPPFLAGS@

# Standalone RTCORE objects
RT_OBJS = \
	rt_util.o \
	rt_spatial_relationship.o \
	rt_mapalgebra.o \
	rt_geometry.o \
	rt_statistics.o \
	rt_pixel.o \
	rt_warp.o \
	rt_gdal.o \
	rt_band.o \
	rt_raster.o \
	rt_serialize.o \
	rt_wkb.o \
	rt_context.o

RT_LIB = librtcore.a
RT_HEADERS = \
	rt_serialize.h \
	librtcore.h \
	librtcore_internal.h \
	../raster_config.h

VPATH = $(srcdir)

all: $(RT_LIB)

$(RT_OBJS): $(RT_HEADERS)

clean:
	rm -f $(RT_OBJS)
	rm -f $(RT_LIB)

distclean: clean
	rm -f Makefile

librtcore.a: $(RT_OBJS)
	$(AR) $(RT_LIB) $(RT_OBJS)
