Sources :=	$(wildcard *.[ch]pp)
CPPFiles :=	$(wildcard *.cpp)
Objects :=	$(patsubst %.cpp,%.o,$(CPPFiles))
Target :=	${patsubst %.cpp,%,${shell grep -l '\<main *(' $(CPPFiles)}}

CC :=		g++
CXX :=		g++ -fdiagnostics-color=always
CXXFLAGS :=	-Wall -g `pkg-config --cflags gdk-pixbuf-2.0`
CPPFLAGS :=	-std=c++11 -fopenmp -Ofast
LDLIBS :=	-fopenmp -lm `pkg-config --libs gdk-pixbuf-2.0`

.PHONY:		all depend clean realclean install
all:		Makefile $(Target) $(PDFs)
depend: ;	gcc-makedepend $(CPPFLAGS) $(CPPFiles)
Makefile:	$(Sources)
		gcc-makedepend $(CPPFLAGS) $(CPPFiles)
clean: ;	rm -f $(Objects)
realclean:	clean
		rm -f $(Target) jacobi.jpg

$(Target):	$(Objects)
		$(CXX) -o $@ $(LDFLAGS) $(Objects) $(LOADLIBES) $(LDLIBS)

# DO NOT DELETE
testit.o: testit.cpp jacobi.hpp
