-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (52 loc) · 1.9 KB
/
Makefile
File metadata and controls
67 lines (52 loc) · 1.9 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
60
61
62
63
64
65
66
67
# ************************************************************************************** #
# #
# File: Makefile #
# Purpose: Main compilation file of the application #
# Author: barlukh (Boris Gazur) #
# Updated: 2026/01/27 #
# #
# ************************************************************************************** #
NAME = pathfinding
CC = g++
CFLAGS = -Wall -Werror -Wextra -O0 -std=c++17 -g
LFLAGS = -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
VGFLAGS = --show-leak-kinds=all \
--show-reachable=yes \
--leak-check=full \
--track-origins=yes \
--undef-value-errors=yes \
--track-fds=yes \
--suppressions=vg.supp
RM = rm -rf
DIR_LIB = lib
DIR_HDR = include
DIR_OBJ = obj
DIR_SRC = src
HDR = $(wildcard $(DIR_HDR)/*.hpp)
OBJ = $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(SRC))
SRC = $(shell find $(DIR_SRC) -name "*.cpp")
all: $(NAME)
$(NAME): $(DIR_OBJ) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) -o $(NAME) -L$(DIR_LIB) $(LFLAGS)
@echo "✅ Compilation successful"
$(DIR_OBJ):
mkdir -p $(DIR_OBJ)
@echo "📁 Created directory for object files"
$(DIR_OBJ)/%.o: $(DIR_SRC)/%.cpp $(HDR) | prepare_dirs
$(CC) $(CFLAGS) -I$(DIR_HDR) -c $< -o $@
clean:
$(RM) $(DIR_OBJ)
@echo "🧹 Object files removed"
fclean:
$(RM) $(DIR_OBJ)
@echo "🧹 Object files removed"
$(RM) $(NAME)
@echo "🧹 Executable removed"
prepare_dirs:
mkdir -p $(sort $(dir $(OBJ)))
re: fclean all
run: $(NAME)
./$(NAME)
valgrind: $(NAME)
valgrind $(VGFLAGS) ./$(NAME)
.PHONY: all clean fclean prepare_dirs re run valgrind