CC=gcc

LDFLAGS = -lSDL $(shell sdl-config --libs) -lpthread
#debug + profiling
CFLAGS = -g -O4 -march=core2 -Wall -DDEBUG $(shell sdl-config --cflags)
#optimized
#CFLAGS = -O3 -march=core2 -Wall -DNDEBUG $(shell sdl-config --cflags)
SOURCE = $(shell ls -1 *.c)
HEADERS = $(shell ls -1 *.h)
OBJECTS = $(SOURCE:.c=.o)

#the app
all: $(OBJECTS)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o genetic

%.o: %.c $(HEADERS) Makefile
	$(CC) -c $(CFLAGS) $< -o $@

clean:
	-rm -rf *.o genetic
