Update Makefile-windows

This commit is contained in:
junseopark-digipen
2026-09-14 18:12:35 +09:00
parent e80f96391f
commit 7f237ea2ba

View File

@@ -8,10 +8,10 @@ BUILD_DIR := build/windows
BINARY := game.exe BINARY := game.exe
# Specify what flags to give to the compiler # Specify what flags to give to the compiler
CXX_FLAGS := -g -std=c++20 -Wall -Werror -Wextra -c -I ./lib/windows/include -D GLEW_STATIC -D SDL_MAIN_HANDLED CXX_FLAGS := -g -std=c++20 -Wall -Werror -Wextra -c -I ./lib/windows/include -D SDL_MAIN_HANDLED -D GLEW_STATIC
# Specify what flags to give to the linker # Specify what flags to give to the linker
LINK_FLAGS := -lglew32s -lopengl32 -lSDL2 -L ./lib/windows/lib LINK_FLAGS := -lglew32s -lopengl32 -lSDL2 -L ./lib/windows/lib -static-libgcc -static-libstdc++
# Find all the source files # Find all the source files
CXX_FILES := $(shell find $(SOURCE_DIR) -name *.cpp) CXX_FILES := $(shell find $(SOURCE_DIR) -name *.cpp)
@@ -19,10 +19,13 @@ CXX_FILES := $(shell find $(SOURCE_DIR) -name *.cpp)
# Find all the source shaders # Find all the source shaders
SHADER_FILES := $(shell find $(SOURCE_DIR) -name *.vert) $(shell find $(SOURCE_DIR) -name *.frag) SHADER_FILES := $(shell find $(SOURCE_DIR) -name *.vert) $(shell find $(SOURCE_DIR) -name *.frag)
LIBS_DIR := lib/windows/bin
DLL_FILES := $(shell find $(LIBS_DIR) -name *.dll)
# Determine a list of object and dependency files from all the source files # Determine a list of object and dependency files from all the source files
OBJ_FILES := $(patsubst $(SOURCE_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(CXX_FILES)) OBJ_FILES := $(patsubst $(SOURCE_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(CXX_FILES))
DEP_FILES := $(patsubst %.o,%.d,$(OBJ_FILES)) DEP_FILES := $(patsubst %.o,%.d,$(OBJ_FILES))
COPIED_FILES := $(patsubst $(SOURCE_DIR)/%,$(BUILD_DIR)/%,$(SHADER_FILES)) COPIED_FILES := $(patsubst $(SOURCE_DIR)/%,$(BUILD_DIR)/%,$(SHADER_FILES)) $(patsubst $(LIBS_DIR)/%,$(BUILD_DIR)/%,$(DLL_FILES))
.PHONY: program .PHONY: program
program: $(BUILD_DIR)/$(BINARY) $(COPIED_FILES) program: $(BUILD_DIR)/$(BINARY) $(COPIED_FILES)
@@ -48,3 +51,6 @@ $(BUILD_DIR)/%.vert: $(SOURCE_DIR)/%.vert
$(BUILD_DIR)/%.frag: $(SOURCE_DIR)/%.frag $(BUILD_DIR)/%.frag: $(SOURCE_DIR)/%.frag
cp $< $@ cp $< $@
$(BUILD_DIR)/%: $(LIBS_DIR)/%
cp $< $@