FFLAGS = -ffree-form -fimplicit-none -std=gnu -O
LDLIBS = -lgfortran -lm
FC = gfortran

all:plot.svg
plot.svg:out.txt Makefile
	echo '\
	set term svg size 640,480 background rgb "white" font "times,14";\
	set out "$@";\
	set xlabel "x";\
	set ylabel "y";\
	set title "Integrating ü=-u with mid-point method";\
	plot\
	 "$<" using 1:2 with linespoints\
	,"$<" using 1:3 with linespoints\
	'|gnuplot

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

%.o %.mod: %.f
	$(FC) $(FFLAGS) -c $<
	touch $@

main:main.o ode.o
main.o: ode.mod

clean:
	find . -type f -executable -delete
	rm -f *.o *.mod out*
