# Directories INCLUDE_DIR = inc SRC_DIR = src BUILD_DIR = build # imgui bs IMGUI_DIR = lib/imgui INCLUDE_DIR += $(IMGUI_DIR) $(IMGUI_DIR)/backends # Compiler, flags and libraries CXX = g++ CXXFLAGS = -std=c++17 LIBS = -lGL -lglm `pkg-config --libs sdl3 sdl3-image` # =============================== Don't touch below pwease :3 =============================== # Compiler and linker settings CXXFLAGS += $(addprefix -I, $(INCLUDE_DIR)) # Source files SRC = $(wildcard $(SRC_DIR)/*.cpp) # Imgui specific stuff SRC += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp SRC += $(IMGUI_DIR)/backends/imgui_impl_sdl3.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp # Target executable UNAME := $(shell uname -s) BUILD_DIR := $(BUILD_DIR)/$(UNAME) OBJ_DIR := $(BUILD_DIR)/objs BIN = $(BUILD_DIR)/main # Object files corresponding to the source files OBJS = $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(basename $(notdir $(SRC))))) # black magic wizardry below this line (pwease don't touch i beg you) dev: CXXFLAGS += -g -Wall -Wformat dev: all release: CXXFLAGS += -O3 release: all dirs: @mkdir -p $(BUILD_DIR) @mkdir -p $(OBJ_DIR) # Even more imgui specific stuff >:( $(OBJ_DIR)/%.o: $(IMGUI_DIR)/%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< $(OBJ_DIR)/%.o: $(IMGUI_DIR)/backends/%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< all: dirs $(BIN) @echo Build complete $(BIN): $(OBJS) $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) clean: rm -rf $(BUILD_DIR)