MCS = mcs -optimize+ -platform:arm
MONO = mono --optimize=all

Out.svg: out.txt Makefile
	echo '\
	set term svg background rgb "white";\
	set out "$@";\
	set title "u´´=-u, u(0)=0, u´(0)=1" ;\
	set key out;\
	set tics out;\
	set xlabel "x/π";\
	set grid ;\
	plot [][]\
	 "$<" using ($$1/pi):2 with linespoints pt 7 ps 0.5 title "u" \
	,"$<" using ($$1/pi):3 with linespoints pt 5 ps 0.5 title "u´" \
	'|gnuplot

out.txt:main.exe
	$(MONO) $< > $@ 2>log

main.exe: main.cs matlib.dll
	$(MCS) $< -reference:$(lastword $^)

cmath.dll: ../matrix/complex.cs ../matrix/cmath.cs
	$(MCS) $^ -target:library -out:$@

matlib.dll: \
	../matrix/matrix.cs \
	../matrix/vector.cs \
	../complex/complex.cs \
	../complex/cmath.cs \
	ode.cs
	$(MCS) $^ -target:library -out:$@

clean:
	rm -rf [Oo]ut* *.dll *.exe log* *log
