CXX      = clang++
#CXX      = g++
CXXFLAGS += -Wall -std=c++17 -O1 -I/usr/local/include
MATRIX   = ../matrix
CXXFLAGS += -I$(MATRIX)
LDLIBS   = -lstdc++ -lm -L/usr/local/lib/ -lgc

Out.png:out.data Makefile
	echo '\
	set term png ;\
	set out "$@" ;\
	set key out ;\
	set title "u´´=-u, u(0)=0, u´(0)=1" ;\
	set xlabel "x/π" ;\
	set ylabel "y" ;\
	set xzeroaxis ;\
	set grid ;\
	plot \
	 "$<" using ($$1/pi):2 with linespoints pointtype 4 title "u" \
	,"$<" using ($$1/pi):3 with linespoints pointtype 5 title "u´" \
	'|gnuplot

out.data:main
	./$< > $@

main: main.o vec.o ode.o
main.o ode.o vec.o: $(MATRIX)/vec.h
main.o ode.o: ode.h
vec.o:$(MATRIX)/vec.cc
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< 
clean:
	find -type f -executable -delete
	$(RM) *.o
