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

all: gamma.png

gamma.png: data Makefile
	echo \
'set term png;   ' \
'set out "$@";   ' \
'set grid;       ' \
'set tics out;   ' \
'set key bottom; ' \
'set xlabel "$$x$$"; ' \
'set ylabel "$$y$$"; ' \
'set tics 1; ' \
'set mtics 0.5; ' \
'plot [-5:5][-5:5] "$<" title "$$i\Gamma(x)$$" with lines color red'\
| sed 's/; */;\n/g' | tee log | pyxplot

data: main
	./$< > $@

main: main.o igamma.o

clean:
	$(RM) gamma.png main data log *.o

test:
	@echo CFLAGS: $(CFLAGS)
	@echo LDLIBS: $(LDLIBS)
	echo 'hello'
	echo "hello"
	echo hello
	printf 'a'\
'b'\
'c\n'
