QT_FLAGS	=-fPIC `pkg-config --cflags --libs Qt5OpenGL`
QT_LIB		=`pkg-config --libs Qt5OpenGL` -lGL -lGLU
QT_MOC		= moc
GPP		= g++
FLAGS 		= -g -O3 -Isrc

QT_FILES	= mainwindow input input_physics input_time input_geometry input_initial_state input_view view input_tank input_pump input_pump_tab input_cloud input_clouds_tab
QT_MOC_FILES	= mainwindow input_physics input input_view input_geometry input_initial_state input_tank input_pump_tab input_pump input_cloud input_clouds_tab
MATH_FILES	= poly3 algo spline
SRC_FILES	= physics time geometry kernel initial_state source

QT_OBJS		= $(addprefix obj/qt/,$(addsuffix .o,$(QT_FILES)))
QT_MOCS		= $(addprefix moc/,$(addsuffix .cpp,$(QT_MOC_FILES)))
MATH_OBJS	= $(addprefix obj/math/,$(addsuffix .o,$(MATH_FILES)))
SRC_OBJS	= $(addprefix obj/,$(addsuffix .o,$(SRC_FILES)))
EXE		= RichardsFastSlow

all : $(EXE)

$(EXE) : src/main.cpp $(MATH_OBJS) $(SRC_OBJS) $(QT_MOCS) $(QT_OBJS)
	$(GPP) $(FLAGS) $(QT_FLAGS) $^ $(QT_LIB) -o $@

obj/qt/%.o : src/qt/%.cpp src/qt/%.hpp
	$(GPP) $(FLAGS) $(QT_FLAGS) -c $< -o $@

obj/math/%.o : src/math/%.cpp src/math/%.hpp
	$(GPP) $(FLAGS) -c $< -o $@

obj/%.o : src/%.cpp src/%.hpp
	$(GPP) $(FLAGS) -c $< -o $@

moc/%.cpp : src/qt/%.hpp
	$(QT_MOC) $< -o $@

clean:
	-$(RM) $(EXE) moc/* obj/*.o obj/math/*.o obj/qt/*.o src/*~ src/qt/*~ src/math/*~
