-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (28 loc) · 845 Bytes
/
Makefile
File metadata and controls
38 lines (28 loc) · 845 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
# Compiler and flags
CXX = g++
CXXFLAGS = -std=c++20 -Wall -Wextra -Iinclude
# Source directories
SRC_DIR = src
INCLUDE_DIR = include
BUILD_DIR = build
# Output binary
TARGET = server
# Source files and object files
SRCS = $(SRC_DIR)/Matcher.cpp $(SRC_DIR)/Server.cpp $(SRC_DIR)/tokenizer.cpp $(SRC_DIR)/tokens.cpp
OBJS = $(SRCS:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o)
# Dependencies
DEPS = $(INCLUDE_DIR)/Matcher.hpp $(INCLUDE_DIR)/tokenizer.hpp $(INCLUDE_DIR)/tokens.hpp $(INCLUDE_DIR)/utils.hpp
# Default target
all: $(TARGET)
# Compile target
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJS)
# Create the build directory and compile each object file
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(DEPS)
@mkdir -p $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean up
clean:
rm -rf $(BUILD_DIR) $(TARGET)
# Phony targets
.PHONY: all clean