CFLAGS = -Wall -std=gnu99
CFLAGS += `gsl-config --cflags`
LDLIBS += `gsl-config --libs`

report = dvf-latex-intro
arxiv  = dvf-latex-intro

all: $(report).pdf $(arxiv).tgz

$(report).pdf: $(report).tex plot.pdf plot2.tex
	pdflatex $<
	pdflatex $<

plot2.tex: gnuplot.plot2.gpi data2 ; gnuplot $<

plot.pdf: pyxplot.plot.gpi data ; pyxplot $<

data data2: main; ./main 1> data 2> data2

main: main.o myerf.o myerfc.o

clean:
	$(RM) main *.o *.log *.aux plot.pdf plot2.tex $(report).pdf data $(arxiv).tgz

$(arxiv).tgz: Makefile $(report).tex *.c *.gpi
	tar --file $@ --create --gzip $^
	@/bin/echo -e "\nhave archived the following files\n"
	@tar --file $@ --list
