-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (68 loc) · 2.21 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# ------------------------------------------------------------------------------
# Makefile for FEC_cleaner project
# ------------------------------------------------------------------------------
# Author: Camille BERNOT (camil.bernot.cb@gmail.com)
# Description: Makefile for building the FEC_cleaner project.
# Version: 0.1
# Date: 2024-06-26
# ------------------------------------------------------------------------------
.PHONY: all clean fclean re
NAME := FEC_cleaner
# ------------------------------------------------------------------------------
# ALL FILES
# ------------------------------------------------------------------------------
# Files
LST_SRC := cleaner.cpp
# Directories
DIR_SRC := src/
DIR_OBJ := .obj/
# Shortcuts
SRCS := $(addprefix $(DIR_SRC), $(LST_SRC))
OBJS := $(subst $(DIR_SRC), $(DIR_OBJ), $(SRCS:.cpp=.o))
# ------------------------------------------------------------------------------
# COMMAND VARIABLES
# ------------------------------------------------------------------------------
# Commands
CC := c++
CFLAGS := -Wall -Wextra -Werror -std=c++17
RM := rm -rf
# Colors
BLACK=\033[30m
RED=\033[31m
GREEN=\033[32m
YELLOW=\033[33m
BLUE=\033[34m
PURPLE=\033[35m
CYAN=\033[36m
WHITE=\033[37m
# Text
ERASE=\033[2K\r
RESET=\033[0m
BOLD=\033[1m
FAINT=\033[2m
ITALIC=\033[3m
UNDERLINE=\033[4m
# ------------------------------------------------------------------------------
# RULES
# ------------------------------------------------------------------------------
all: $(NAME)
$(NAME): $(OBJS) $(INCS)
@$(CC) $(CFLAGS) $(CI) $(OBJS) -o $@
@echo "$(ERASE)\n$(PURPLE)$(BOLD)🎉🎉 executable $(NAME) created 🎉🎉$(RESET)"
$(DIR_OBJ)%.o: $(DIR_SRC)%.cpp $(INCS) | $(DIR_OBJ)
@$(CC) $(CFLAGS) $(CI) -c $< -o $@
@echo "$(ERASE)$(BOLD)$(NAME)$(RESET)$(GREEN) compiling... $(RESET)$<"
$(DIR_OBJ):
@mkdir -p $(DIR_OBJ)
@echo "$(ERASE)$(BOLD)$(NAME)$(RESET)$(GREEN) objects directory created.$(RESET)"
# Cleaning
clean:
@$(RM) $(OBJS)
@if [ -d "$(DIR_OBJ)" ]; then \
$(RM) $(DIR_OBJ); echo "$(ERASE)$(BOLD)$(NAME)$(RESET)$(RED) objects deleted.$(RESET)"; \
fi
fclean: clean
@if [ -f "$(NAME)" ]; then \
$(RM) $(NAME); echo "$(ERASE)$(RED)$(BOLD)🗑️ $(NAME) deleted.$(RESET)"; \
fi
re: fclean all