-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (47 loc) · 2.57 KB
/
Copy pathMakefile
File metadata and controls
60 lines (47 loc) · 2.57 KB
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
57
58
59
# ────────────────────────────────────────────────
# Compiler and flags
# ────────────────────────────────────────────────
CXX := g++
CXXFLAGS := -std=c++20 -Wall -Wextra -O2 -Iinclude
LDFLAGS := -lsodium -lsqlite3 -lyaml-cpp
ifeq ($(DEBUG),1)
CXXFLAGS += -g -DDEBUG -O0
endif
# ────────────────────────────────────────────────
# Directories
# ────────────────────────────────────────────────
SRC_DIR := src
OBJ_DIR := build
BIN_DIR := bin
# Output binary
TARGET := $(BIN_DIR)/agniv
# ────────────────────────────────────────────────
# Source and object files
# ────────────────────────────────────────────────
SRCS := $(shell find $(SRC_DIR) -name '*.cpp')
OBJS := $(SRCS:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
# ────────────────────────────────────────────────
# Build rules
# ────────────────────────────────────────────────
all: $(TARGET)
$(TARGET): $(OBJS)
@mkdir -p $(BIN_DIR)
@echo "[+] Linking $(TARGET)"
$(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LDFLAGS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(dir $@)
@echo "[+] Compiling $<"
$(CXX) $(CXXFLAGS) -c $< -o $@
# ────────────────────────────────────────────────
# Utility targets
# ────────────────────────────────────────────────
run: $(TARGET)
@echo "[+] Running AgniVault..."
@$(TARGET)
clean:
@echo "[+] Cleaning build files..."
rm -rf $(OBJ_DIR) $(BIN_DIR)
rebuild: clean all
# ────────────────────────────────────────────────
# End of Makefile
# ────────────────────────────────────────────────