39 lines
1.1 KiB
Makefile
39 lines
1.1 KiB
Makefile
# Compiler and flags
|
|
CXX := g++
|
|
CXXFLAGS := -std=c++20 -Wall -Wextra -O2 -I/c/msys64/mingw64/include -Ivendor/imgui-docking -Ivendor/stb -Ivendor/tini_obj
|
|
|
|
# Use this to link against the correct import lib
|
|
LDFLAGS := -Llib -lglfw3 -lopengl32 -lglew32 -lglu32 -lyaml-cpp
|
|
|
|
# Source and build directories (including vendor folder)
|
|
SRC_DIRS := . Editor Engine vendor/imgui-docking Engine/Components Engine/Entity Engine/utils
|
|
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
|