HEADERS=triangle.h linalg.h queue.h initcairo.h main.h exp_equation.h

SPECIAL_OPTIONS=-O0 -g -D_DEBUG
#SPECIAL_OPTIONS=-O3 -pg -funroll-loops -fno-inline
#SPECIAL_OPTIONS=-O3 -flto -funroll-loops -Winline -Wall -Wno-unused-function -Werror=implicit-function-declaration
#SPECIAL_OPTIONS=

CAIRO_OPTIONS=$(shell pkg-config --cflags cairo)
GENERAL_OPTIONS=-m64 -march=native -mtune=native -std=gnu99 -D_GNU_SOURCE
OPTIONS=$(GENERAL_OPTIONS) $(CAIRO_OPTIONS) $(SPECIAL_OPTIONS)

all: limit_set

limit_set: limit_set.o linalg.o triangle.o initcairo.o draw.o main.o exp_equation.o
	gcc $(OPTIONS) -o limit_set limit_set.o linalg.o triangle.o initcairo.o draw.o main.o exp_equation.o -lm -lgsl -lcblas -lcairo -lX11

linalg.o: linalg.c $(HEADERS)
	gcc $(OPTIONS) -c linalg.c

triangle.o: triangle.c $(HEADERS)
	gcc $(OPTIONS) -c triangle.c

limit_set.o: limit_set.c $(HEADERS)
	gcc $(OPTIONS) -c limit_set.c

initcairo.o: initcairo.c $(HEADERS)
	gcc $(OPTIONS) -c initcairo.c

draw.o: draw.c $(HEADERS)
	gcc $(OPTIONS) -c draw.c

main.o: main.c $(HEADERS)
	gcc $(OPTIONS) -c main.c

exp_equation.o: exp_equation.c $(HEADERS)
	gcc $(OPTIONS) -c exp_equation.c

clean:
	rm -f limit_set linalg.o triangle.o limit_set.o draw.o main.o exp_equation.o