CC      = gcc
CFLAGS  = -std=c90 -Wall -Wextra -Wpedantic -O2
LDFLAGS =

OBJS = table.o test.o
TARGET = tp2

.PHONY: all clean test benchmark debug

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS)

table.o: table.c table.h
	$(CC) $(CFLAGS) -c table.c

test.o: test.c table.h
	$(CC) $(CFLAGS) -c test.c

test: $(TARGET)
	./$(TARGET) --test

benchmark: $(TARGET)
	./$(TARGET) --benchmark 1600 10 > benchmark.csv

debug: CFLAGS += -DDEBUG=1
debug: clean $(TARGET)

clean:
	rm -f $(OBJS) $(TARGET) benchmark.csv
