CC	=	@CC@
CXX	=	@CXX@
LD	=	@CXX@

CPPFLAGS = -DUSE_CPL -DGRASS_GISBASE=\"@GRASS_GISBASE@\" \
	  @GDAL_INC@ @GRASS_INCLUDE@ @PQ_INCLUDE@ @CPPFLAGS@
CXXFLAGS = @CXX_WFLAGS@ @CXX_PIC@
CFLAGS   = @CFLAGS@
LDFLAGS  = @LDFLAGS@

RANLIB		=	@RANLIB@
SO_EXT		=	@SO_EXT@
LD_SHARED	=	@LD_SHARED@

LIBS	=	@LIBS@

AUTOLOAD_DIR	=	@AUTOLOAD_DIR@

GLIBNAME =	gdal_GRASS.so
OLIBNAME =	ogr_GRASS.so

default:	$(GLIBNAME) $(OLIBNAME)

install:	default
	install -d $(AUTOLOAD_DIR)
	cp $(GLIBNAME) $(AUTOLOAD_DIR)
	cp $(OLIBNAME) $(AUTOLOAD_DIR)

clean:
	rm -f $(OLIBNAME) $(GLIBNAME) *.o

distclean: clean
	rm -fr Makefile config.status config.log autom*.cache


$(GLIBNAME):	grass57dataset.o
	$(LD_SHARED) $(LDFLAGS) grass57dataset.o $(LIBS) -o $(GLIBNAME)

$(OLIBNAME):	ogrgrassdriver.o ogrgrassdatasource.o ogrgrasslayer.o
	$(LD_SHARED) $(LDFLAGS) ogrgrassdriver.o ogrgrassdatasource.o ogrgrasslayer.o $(LIBS) -o $(OLIBNAME)

%.o:	%.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<

