CFLAGS = -pthread -Ofast LDLIBS = -pthread #q := $(shell seq 10 1 19) #N := $(shell for i in $q; do \echo "e($$i)"|bc -l; done) powers := $(shell seq 13 1 25) N := $(shell for i in $(powers); do echo "2^($$i)"|bc -l; done) conv.svg:out.txt Makefile gnuplot -e "\ set title 'Convergence of pi(n) as function of n';\ set term svg background rgb 'white';\ set out '$@';\ set log y;\ set log x;\ set xlabel 'n';\ pi=3.1415927;\ a=1;\ f(x)=a/sqrt(x);\ fit f(x) '$<' u 1:(abs((\$$2)-pi)):(1/sqrt(\$$1)) via a;\ plot\ '$<' u 1:(abs((\$$2)-pi)) with linespoints title 'abs(pi(n)-pi)'\ ,f(x) with lines title sprintf('%.2g/sqrt(n)',a);\ " out.txt:main cat /dev/null > $@ for n in $N; do echo $$n; ./$< -n $$n >> $@; done clean: $(RM) main out.txt conv.svg test: echo $(powers) echo $N echo $(word 1,$N)