# Compiler and flags
CPPC = g++
#CPPC_FLAGS = -std=c++23 -s -O3 -Wall -Wextra -lSDL3 -lSDL3_image
# Debug flags:
CPPC_FLAGS = -std=c++23 -ggdb -Wall -Wextra -lSDL3 -lSDL3_image

SRC_PATH := src
OBJ_PATH := build/obj
BIN_PATH := build/bin


SRC_FILES := $(shell find $(SRC_PATH) -name '*.cpp')
# Generate corresponding object file paths by replacing src/ with build/obj/
OBJ_FILES := $(patsubst $(SRC_PATH)/%.cpp,$(OBJ_PATH)/%.o,$(SRC_FILES))



all: make-build-dir $(BIN_PATH)/naval_swarm


make-build-dir:
	mkdir -p $(OBJ_PATH)
	mkdir -p $(BIN_PATH)


$(BIN_PATH)/naval_swarm: $(OBJ_FILES)
	$(CPPC) $(CPPC_FLAGS) $^ -o $@


$(OBJ_PATH)/%.o: $(SRC_PATH)/%.cpp
	$(CPPC) $(CPPC_FLAGS) -c $< -o $@


clean:
	rm -fr build

.PHONY: all clean make-build-dir
