TERM = png
PLOT = Out.$(TERM)
SIZE = 1280,960
LDLIBS = -lm

$(PLOT): gamma.gpi out.gamma.txt
	gnuplot $<

out.gamma.txt: main
	./$< > $@ 2>log

main:main.o gamma.o

clean:
	$(RM) [Oo]ut* [Ll]og* gamma.gpi *.o main

gamma.gpi: Makefile
	>$@
	echo 'set term $(TERM) size $(SIZE) \' >> $@
	echo 'font arial 28 background rgb "white"' >> $@
	echo 'set out "$(PLOT)"'  >> $@
	echo 'set view ,310' >>$@
	echo 'set title "|Γ(z)|"' >>$@
	echo 'set hidden3d' >>$@
	echo 'set pm3d' >>$@
	echo 'set grid' >>$@
	echo 'set xlabel "Re(z)"' >>$@
	echo 'set ylabel "Im(z)"' >>$@
	echo '#set zlabel "|Gamma(z)|" rotate parallel' >>$@
	echo 'set contour both' >>$@
	echo 'set cntrlabel onecolor' >>$@
	echo 'set linetype 1 linecolor rgb "black"' >>$@
	echo 'zmax=6' >>$@
	echo 'set cntrparam levels incremental 0.0,0.25,zmax' >>$@
	echo 'set palette rgb 33,13,10' >>$@
	echo 'cut(z)=z>zmax?zmax:z' >>$@
	echo 'splot [][][:zmax]\' >>$@
	echo ' "out.gamma.txt" using 1:2:(cut($$3)) with lines notitle' >> $@

test:
	echo $(PI)
