CC = gcc
FLAGS = -Wall -Wextra -g
LFLAGS = -lm src/glad.c -ldl -lglfw -lcglm -lpng -lSOIL

all: bin/back

test: bin/back
	bin/back

mem: bin/back
	valgrind --leak-check=full ./bin/back

bin/back: obj/main.o obj/generation.o obj/display.o obj/proj.o obj/entities.o obj/bullets.o obj/menus.o obj/move.o obj/base.o obj/hash.o
	mkdir -p bin
	$(CC) $(FLAGS) $^ $(LFLAGS) -o $@

obj/%.o: src/%.c
	@mkdir -p obj
	$(CC) -o $@ -c $(FLAGS) $<

obj/main.o: src/main.c
obj/generation.o: src/generation.c
obj/display.o: src/display.c
obj/entities.o: src/entities.c
obj/bullets.o: src/bullets.c
obj/move.o: src/move.c
obj/base.o: src/base.c
obj/proj.o: src/proj.c
obj/menus.o: src/menus.c
obj/hash.o: src/hash.c

.PHONY: clean mrproper

clean:
	rm -rf obj/

mrproper: clean
	rm -rf bin/
