# Compiler and flags CXX := g++ CXXFLAGS := -std=c++20 -Wall -Wextra -O2 -I/c/msys64/mingw64/include -Ivendor/imgui-docking # Use this to link against the correct import lib LDFLAGS := -Llib -lglfw3 -lopengl32 -lglew32 -lglu32 # Source and build directories (including vendor folder) SRC_DIRS := . Editor Engine vendor/imgui-docking Engine/Components BUILD_DIR := build # Find all source files SRC := $(foreach dir, $(SRC_DIRS), $(wildcard $(dir)/*.cpp)) # Generate .o paths in build folder, mirroring source structure OBJ := $(patsubst %.cpp, $(BUILD_DIR)/%.o, $(SRC)) # Output binary TARGET := Three-Labs.exe # Default rule all: $(TARGET) # Link object files $(TARGET): $(OBJ) $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) # Compile source files to object files in build/ $(BUILD_DIR)/%.o: %.cpp @mkdir "$(dir $@)" 2>nul || exit 0 $(CXX) $(CXXFLAGS) -c $< -o $@ # Clean clean: del /Q /S $(subst /,\,$(BUILD_DIR)\*.o) $(TARGET) 2>nul || exit 0 rmdir /S /Q $(BUILD_DIR) 2>nul || exit 0 .PHONY: all clean