# Project: shapes_grid
# Linux GCC Makefile
# Created by O. Conrad

PRJ_NAME = shapes_grid
SAGA     = ./../../..
BIN_SAGA = $(SAGA)/../bin/saga_gtk
TMP_SAGA = $(SAGA)/../bin/tmp/saga_gtk
INC_SAGA = $(SAGA)/saga_core
MLB_TEMP = $(TMP_SAGA)/$(PRJ_NAME)
MLB_PATH = $(BIN_SAGA)/modules
MLB_NAME = $(MLB_PATH)/$(PRJ_NAME).so

CPP      = g++
LD       = g++

DEP_INCS = 
DEP_DEFS = 
DEP_LIBS = 
DEP_LFLG = 

OBJ      = $(MLB_TEMP)/Grid_Classes_To_Shapes.o $(MLB_TEMP)/Grid_Polygon_Clip.o $(MLB_TEMP)/Grid_Statistics_AddTo_Polygon.o $(MLB_TEMP)/Grid_To_Contour.o $(MLB_TEMP)/Grid_To_Gradient.o $(MLB_TEMP)/Grid_To_Points.o $(MLB_TEMP)/Grid_To_Points_Random.o $(MLB_TEMP)/Grid_Values_AddTo_Points.o $(MLB_TEMP)/Grid_Values_AddTo_Shapes.o $(MLB_TEMP)/MLB_Interface.o

DEF_SAGA = -D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD
CXX_INCS =
CXX_DEFS =
CXX_FLGS = -O2
CXXFLAGS = $(CXX_INCS) $(CXX_DEFS) $(CXX_FLGS) $(DEP_INCS) $(DEP_DEFS) -I$(INC_SAGA) $(DEF_SAGA)

LDFLAGS  = -shared $(DEP_LFLG)
LIBS     = $(DEP_LIBS)

.PHONY: all all-before all-after clean clean-custom

all: all-before $(MLB_NAME) all-after

clean: clean-custom
	rm -f $(OBJ) $(MLB_NAME)

$(TMP_SAGA):
	-mkdir $(TMP_SAGA)

$(MLB_TEMP): $(TMP_SAGA)
	-mkdir $(MLB_TEMP)

$(MLB_PATH):
	-mkdir $(MLB_PATH)

$(MLB_NAME): $(MLB_TEMP) $(MLB_PATH) $(OBJ)
	$(LD) $(LDFLAGS) -o $(MLB_NAME) $(OBJ) $(LIBS)


$(MLB_TEMP)/Grid_Classes_To_Shapes.o: ./Grid_Classes_To_Shapes.cpp
	$(CPP) -c ./Grid_Classes_To_Shapes.cpp -o $(MLB_TEMP)/Grid_Classes_To_Shapes.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_Polygon_Clip.o: ./Grid_Polygon_Clip.cpp
	$(CPP) -c ./Grid_Polygon_Clip.cpp -o $(MLB_TEMP)/Grid_Polygon_Clip.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_Statistics_AddTo_Polygon.o: ./Grid_Statistics_AddTo_Polygon.cpp
	$(CPP) -c ./Grid_Statistics_AddTo_Polygon.cpp -o $(MLB_TEMP)/Grid_Statistics_AddTo_Polygon.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_To_Contour.o: ./Grid_To_Contour.cpp
	$(CPP) -c ./Grid_To_Contour.cpp -o $(MLB_TEMP)/Grid_To_Contour.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_To_Gradient.o: ./Grid_To_Gradient.cpp
	$(CPP) -c ./Grid_To_Gradient.cpp -o $(MLB_TEMP)/Grid_To_Gradient.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_To_Points.o: ./Grid_To_Points.cpp
	$(CPP) -c ./Grid_To_Points.cpp -o $(MLB_TEMP)/Grid_To_Points.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_To_Points_Random.o: ./Grid_To_Points_Random.cpp
	$(CPP) -c ./Grid_To_Points_Random.cpp -o $(MLB_TEMP)/Grid_To_Points_Random.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_Values_AddTo_Points.o: ./Grid_Values_AddTo_Points.cpp
	$(CPP) -c ./Grid_Values_AddTo_Points.cpp -o $(MLB_TEMP)/Grid_Values_AddTo_Points.o $(CXXFLAGS)

$(MLB_TEMP)/Grid_Values_AddTo_Shapes.o: ./Grid_Values_AddTo_Shapes.cpp
	$(CPP) -c ./Grid_Values_AddTo_Shapes.cpp -o $(MLB_TEMP)/Grid_Values_AddTo_Shapes.o $(CXXFLAGS)

$(MLB_TEMP)/MLB_Interface.o: ./MLB_Interface.cpp
	$(CPP) -c ./MLB_Interface.cpp -o $(MLB_TEMP)/MLB_Interface.o $(CXXFLAGS)
