TERM = pdfcairo mono enhanced font "Times-New-Roman, 12" size 12cm,7cm
berrut.pdf: out.txt Makefile
	echo '\
set term $(TERM);\
set out "$@";\
set xlabel "{/:Italic x}";\
set ylabel "{/:Italic y}";\
set key right;\
set tics out;\
plot [][:1]\
 "$<" index 0 with points pointtype 7 pointsize 0.7 title "data"\
,"$<" index 1 using 1:2 with lines lt 1 title "polynomial"\
,"$<" index 1 using 1:3 with lines lt 2 title "rational B_1"\
	'| tee log | gnuplot

out.txt: main.exe
	mono $< >$@

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

matlib.dll: berrut.cs
	mcs $< -target:library -out:$@

$(PLOT).gpi: Makefile

clean:
	rm -f *.exe *.dll $(PLOTFILE) $(DATA) *.gif *.svg *.png out* log*
