-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (45 loc) · 1.56 KB
/
Makefile
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Compiler
CXX = g++
# Compiler flags
CXXFLAGS = -std=c++17 -Wall -Isrc/constants -Isrc/database/header -Isrc/database/queries/ -Isrc/models/header -Isrc/server -Isrc/states -Isrc/messages -Isrc/services -Isrc/repositories -Iinclude
# Directories
SRC_DIR = src
BUILD_DIR = build
# Source files
SRCS = $(wildcard $(SRC_DIR)/main/*.cpp) \
$(wildcard $(SRC_DIR)/server/*.cpp) \
$(wildcard $(SRC_DIR)/database/queries/*.cpp) \
$(wildcard $(SRC_DIR)/database/functions/*.cpp) \
$(wildcard $(SRC_DIR)/models/entities/*.cpp) \
$(wildcard $(SRC_DIR)/services/*.cpp) \
$(wildcard $(SRC_DIR)/repositories/*.cpp) \
$(wildcard $(SRC_DIR)/messages/*.cpp) # Ensure these exist
# Object files
OBJS = $(SRCS:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o)
# Include directories
INCLUDES = -I$(SRC_DIR)/constants \
-I$(SRC_DIR)/database/header \
-I$(SRC_DIR)/database/queries/ \
-I$(SRC_DIR)/models/header \
-I$(SRC_DIR)/server \
-I$(SRC_DIR)/states \
-I$(SRC_DIR)/messages \
-I$(SRC_DIR)/services \
-I$(SRC_DIR)/repositories \
-Iinclude
# Libraries
LIBS = -lsqlite3 -lcrypto
# Target executable
TARGET = rubik-server
# Default target
all: $(TARGET)
# Link the target executable
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LIBS)
# Compile source files to object files
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
mkdir -p $(dir $@) # Create directories as needed
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
# Clean build files
clean:
rm -rf $(BUILD_DIR) $(TARGET)