CFLAGS += -O -march=native -Wall -std=gnu11 $$(gsl-config --cflags)
LDLIBS += $$(gsl-config --libs)

all:Out.plot.svg

Out.plot.svg: Out.data.txt Makefile
	echo '\
	set term svg background rgb "white";\
	set out "$@";\
	set xlabel "Time t (days)";\
	set ylabel "log(activity) arb. u.";\
	set tics out;\
	set key out;\
set title "least-squares fit F_c(x)=c_0+c_1*t to log(Rutherford/Soddy data)" ;\
	plot "$<" index 0 with errorbars title "data"\
	,"$<" index 1 using 1:2 with lines title "F_c(x)"\
	,"$<" index 1 using 1:3 with lines title "F_C(x)_{c0+dc0}"\
	,"$<" index 1 using 1:4 with lines title "F_C(x)_{c0-dc0}"\
	,"$<" index 2 using 1:3 with lines title "F_C(x)_{c1+dc1}"\
	,"$<" index 2 using 1:4 with lines title "F_C(x)_{c1-dc1}"\
	'|gnuplot

Out.data.txt:main
	./$< 1>$@ 2>log
main: main.o lsfit.o qr.o
qr.o: qr.c
	$(CC) $(CFLAGS) -c -o $@ $< 
clean:; $(RM) *.o main [Oo]ut* *.svg [Ll]og
