-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (30 loc) · 732 Bytes
/
Copy pathMakefile
File metadata and controls
40 lines (30 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Compiler
CXX := g++
# Directories
SRC_DIR := src
INC_DIR := include
THIRD_PARTY := third_party
BUILD_DIR := build
# Output binary
TARGET := game
# Source files
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
# Object files
OBJS := $(SRCS:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o)
# Compiler flags (DEBUG + MEMORY SAFE)
CXXFLAGS := -std=c++17 -g -O0 -Wall -Wextra \
-fsanitize=address -fno-omit-frame-pointer \
-I$(INC_DIR) -I$(THIRD_PARTY)
# Default target
all: $(TARGET)
# Link step
$(TARGET): $(OBJS)
$(CXX) $(OBJS) -fsanitize=address -o $@
# Compile step
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean
clean:
rm -rf $(BUILD_DIR) $(TARGET)
.PHONY: all clean