BINARY=gear

CC=g++
CFLAGS=-O3 -Wall -Wextra -Iimgui -IrlImGui -Iuuid -std=c++11
LDFLAGS=-lraylib -lm

CFILES=$(shell find src -type f -name '*.cpp')
OBJ=$(CFILES:.cpp=.o)
DEPFILES=$(shell echo imgui/*.cpp) \
	 imgui/misc/cpp/imgui_stdlib.cpp \
	 $(shell echo rlImGui/*.cpp) \
	 uuid/uuid.cpp
DEPOBJ=$(DEPFILES:.cpp=.o)

COMPILE=$(CC) $(CFLAGS) -c $< -o $@

$(BINARY): $(OBJ) $(DEPOBJ) Makefile
	$(CC) $(OBJ) $(DEPOBJ) $(LDFLAGS) -o $@

src/%.o: src/%.cpp
	$(COMPILE)

imgui/%.o: imgui/%.cpp
	$(COMPILE)

rlImGui/%.o: rlImGui/%.cpp
	$(COMPILE)

uuid/%.o: uuid/%.cpp
	$(COMPILE)

run: $(BINARY)
	./$(BINARY)

clean:
	rm -rf $(OBJ) $(DEPS) $(BINARY)

