CFLAGS = -Wno-unused-command-line-argument -Wno-missing-field-initializers  -Wall -Wextra -Wpedantic -lm  -mavx
OPENMPFLAGS=  -fopenmp=libomp
#OPENMPFLAGS= -fopenmp
#CLFLAGS= -D CL_TARGET_OPENCL_VERSION=100  -lOpenCL

#DEBUG_CFLAGS = -g -DDEBUG -pg -O0 

LDLIBS = $(shell pkg-config --libs sdl2 SDL2_ttf)

CFLAGS := $(CFLAGS) -O3
CFLAGS := $(CFLAGS) $(DEBUG_CFLAGS) $(CLFLAGS) $(OPENMPFLAGS)

SRCDIR=src
BIULDDIR=build
# compiler
#CC = gcc
CC = clang

OBJS = $(BIULDDIR)/mouse.o $(BIULDDIR)/ui.o

all: mandelbrot

mandelbrot: $(SRCDIR)/mandelbrot.c $(OBJS)
	$(CC) $(CFLAGS) $(LDLIBS) $^ -o $@

$(BIULDDIR)/mouse.o: $(SRCDIR)/mouse.c
	$(CC) -c $(CFLAGS) $< -o $@

$(BIULDDIR)/ui.o: $(SRCDIR)/ui.c
	$(CC) -c $(CFLAGS) $< -o $@

clean:
	rm mandelbrot $(OBJS)
