#!/bin/csh
#
#


CXX = g++
CXXOPTIONS = -O3 -DVTK -std=c++11 -pthread
#CXXOPTIONS = -g -DVTK -std=c++11
CXXFLAGS = $(CXXOPTIONS) -I/usr/local/VTK-8.2.0/include/vtk-8.2 \
-I/usr/include/eigen3 -I./ttcr

LFLAGS = -L/usr/local/VTK-8.2.0/lib64/

LIBS = -lboost_system -lvtkIOXML-8.2 -lvtkCommonDataModel-8.2 -lvtkCommonCore-8.2 -lvtkIOXMLParser-8.2 -lvtkIOCore-8.2 -lvtkCommonExecutionModel-8.2 \
-lvtkCommonSystem-8.2 -lvtkCommonTransforms-8.2 -lvtkCommonMisc-8.2 -lvtkCommonMath-8.2 -lvtksys-8.2 -lvtkexpat-8.2 -lvtklz4-8.2 \
-lvtklzma-8.2 -lvtkzlib-8.2 -lvtkdoubleconversion-8.2

HEADERS = ttcr/Cell.h ttcr/Grad.h ttcr/Grid2D.h ttcr/Grid2Drcfs.h ttcr/Grid2Drc.h ttcr/Grid2Drcsp.h ttcr/Grid2Drnfs.h \
ttcr/Grid2Drn.h ttcr/Grid2Drnsp.h ttcr/Grid2Ducfm.h ttcr/Grid2Ducfs.h ttcr/Grid2Duc.h ttcr/Grid2Ducsp.h \
ttcr/Grid2Dunfm.h ttcr/Grid2Dunfs.h ttcr/Grid2Dun.h ttcr/Grid2Dunsp.h ttcr/Grid3D.h ttcr/Grid3Drc.h \
ttcr/Grid3Drcsp.h ttcr/Grid3Drnfs.h ttcr/Grid3Drn.h ttcr/Grid3Drnsp.h ttcr/Grid3Ducfm.h \
ttcr/Grid3Ducfs.h ttcr/Grid3Duc.h ttcr/Grid3Ducsp.h ttcr/Grid3Dunfm.h ttcr/Grid3Dunfs.h ttcr/Grid3Dun.h \
ttcr/Grid3Dunsp.h ttcr/Interface.h ttcr/Interpolator.h ttcr/Metric.h ttcr/msh2vtk_io.h ttcr/MSHReader.h \
ttcr/Node2Dc.h ttcr/Node2Dcsp.h ttcr/Node2Dn.h ttcr/Node2Dnsp.h ttcr/Node3Dc.h ttcr/Node3Dcsp.h ttcr/Node3Dn.h \
ttcr/Node3Dnsp.h ttcr/Node.h ttcr/Rcv2D.h ttcr/Rcv.h ttcr/Src2D.h ttcr/Src.h ttcr/structs_msh2vtk.h \
ttcr/structs_ttcr.h ttcr/ttcr_io.h ttcr/ttcr_t.h ttcr/utils.h ttcr/VTUReader.h

ttcr3d : ttcr3d.o ttcr_io.o
	$(CXX) $(CXXFLAGS) $(LFLAGS) $(LIBS) ttcr_io.o ttcr3d.o -o ttcr3d

ttcr3d.o : ttcr/ttcr3d.cpp $(HEADERS)
	$(CXX) $(CXXFLAGS) -c ttcr/ttcr3d.cpp

ttcr_io.o : ttcr/ttcr_io.h ttcr/ttcr_io.cpp ttcr/structs_ttcr.h
	$(CXX) $(CXXFLAGS) -c ttcr/ttcr_io.cpp

ttcr2d : ttcr2d.o ttcr_io.o
	$(CXX) $(CXXFLAGS) $(LFLAGS) $(LIBS) ttcr_io.o ttcr2d.o -o ttcr2d

ttcr2d.o : ttcr/ttcr2d.cpp $(HEADERS)
	$(CXX) $(CXXFLAGS) -c ttcr/ttcr2d.cpp

ttcr3d_raypath : ttcr3d_raypath.o ttcr_io.o
	$(CXX) $(CXXFLAGS) $(LFLAGS) $(LIBS) ttcr_io.o ttcr3d_raypath.o -o ttcr3d_raypath

ttcr3d_raypath.o : ttcr/ttcr3d_raypath.cpp $(HEADERS)
	$(CXX) $(CXXFLAGS) -c ttcr/ttcr3d_raypath.cpp
