-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
100 lines (79 loc) · 3.23 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: frmarinh <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/05/20 17:57:50 by frmarinh #+# #+# #
# Updated: 2017/12/15 09:56:56 by dmoureu- ### ########.fr #
# #
# **************************************************************************** #
NAME_ABSTRACT_VM = avm
NAME = "Abstract VM"
NAMEBASE = $(shell basename $(NAME))
LENGTHNAME = `printf "%s" $(NAMEBASE) | wc -c`
MAX_COLS = $$(echo "$$(tput cols)-24-$(LENGTHNAME)"|bc)
CC = g++ -std=c++1z
FLAGS = -Wall -Wextra -Werror
FLAGS_O =
SRCDIR_ABSTRACT_VM = srcs/
OBJDIR_ABSTRACT_VM = objs/
INCDIR = includes/
SRCBASE_ABSTRACT_VM = \
main.cpp \
OperandFactory.cpp \
UserEntry.cpp \
Parser.cpp \
Utils.cpp \
Operand.cpp \
templates/OperandTemplate.cpp \
Handler.cpp \
actions/Action.cpp \
actions/Push.cpp \
actions/Pop.cpp \
actions/Add.cpp \
actions/Sub.cpp \
actions/Mul.cpp \
actions/Div.cpp \
actions/Mod.cpp \
actions/Dump.cpp \
actions/Print.cpp \
actions/Assert.cpp \
actions/Mov.cpp \
actions/Swap.cpp \
INCS = $(addprefix $(INCDIR), $(INCBASE))
SRCS_ABSTRACT_VM = $(addprefix $(SRCDIR_ABSTRACT_VM), $(SRCBASE_ABSTRACT_VM))
OBJS_ABSTRACT_VM = $(addprefix $(OBJDIR_ABSTRACT_VM), $(SRCBASE_ABSTRACT_VM:.cpp=.o))
.SILENT:
all: ACTIONS
ACTIONS:
if test -f $(NAME_ABSTRACT_VM) ; then \
echo "make: Nothing to be done for \`all\`."; \
else \
make BUILD && \
echo "\r\033[38;5;184m👥 AUTHOR(s): \033[0m\033[K" && \
echo "\r\033[38;5;15m`cat auteur | sed s/^/\ \ \ \ -/g`\033[0m\033[K" && \
echo "\033[38;5;44m☑️ ALL $(NAMEBASE) is done\033[0m\033[K"; \
fi
$(OBJDIR_ABSTRACT_VM):
mkdir -p $(OBJDIR_ABSTRACT_VM)
mkdir -p $(dir $(OBJS_ABSTRACT_VM))
$(OBJDIR_ABSTRACT_VM)%.o : $(SRCDIR_ABSTRACT_VM)%.cpp | $(OBJDIR_ABSTRACT_VM)
$(CC) $(FLAGS) -MMD -c $< -o $@ \
-I $(INCDIR) \
-I $(INCDIR)
fcleanlib: fclean
re: fclean all
relib: fclean fcleanlib all
.PHONY: fclean fcleanlib clean re relib
BUILD: $(OBJDIR_ABSTRACT_VM) $(OBJS_ABSTRACT_VM)
$(CC) $(FLAGS) $(FLAGS_O) -o $(NAME_ABSTRACT_VM) $(OBJS_ABSTRACT_VM)
echo "\r\033[38;5;22m📗 MAKE $(NAME_ABSTRACT_VM)"
clean:
@rm -rf $(OBJDIR_ABSTRACT_VM)
echo "\r\033[38;5;124m📕 CLEAN $(OBJDIR_ABSTRACT_VM)\033[0m\033[K";
fclean: clean
@rm -rf $(NAME_ABSTRACT_VM)
echo "\r\033[38;5;124m📕 FCLEAN $(NAME_ABSTRACT_VM)\033[0m\033[K";
-include $(OBJS:.o=.d)