-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (88 loc) · 2.84 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: pchadeni <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/01/08 14:57:58 by pchadeni #+# #+# #
# Updated: 2019/05/26 22:26:35 by pchadeni ### ########.fr #
# #
# **************************************************************************** #
#------Name of the project------#
NAME = ft_retro
#------All sources------#
SRCS = main.cpp \
AShips.cpp \
Enemy.cpp \
Fighter.cpp \
Game.cpp \
Player.cpp \
Boss.cpp \
AElement.cpp \
Stars.cpp \
Logger.cpp
OBJ += $(addprefix ./$(OBJ_PATH)/, $(SRCS:.cpp=.o))
#------Includes------#
INCLUDES = ./inc/
INC += -I $(INCLUDES)
INC += -I $(LIB_PATH)/$(INCLUDES)
HEAD = $(INCLUDES)/AShips.hpp \
$(INCLUDES)/Enemy.hpp \
$(INCLUDES)/Fighter.hpp \
$(INCLUDES)/Game.hpp \
$(INCLUDES)/defs.hpp \
$(INCLUDES)/Player.hpp \
$(INCLUDES)/Boss.hpp \
$(INCLUDES)/AElement.hpp \
$(INCLUDES)/Stars.hpp \
$(INCLUDES)/Logger.hpp
#------Path------#
SRCS_PATH = srcs
OBJ_PATH = obj
#------Main rules------#
all: $(OBJ_PATH) $(NAME)
$(NAME): $(LIB) $(OBJ)
@printf "\33[2KObjects created $(BOLD_GREEN)✓$(EOC)\n"
@printf "Start making $(NAME)...\n"
@$(CCPP) $(CPP_FLAGS) $(LIBCURSES) $(FLAGS) $(INC) -o $(NAME) $(OBJ)
@printf "$(BOLD_GREEN)⤖ $(NAME)$(EOC) created $(BOLD_GREEN)✓$(EOC)\n"
$(OBJ_PATH):
@mkdir -p $(OBJ_PATH)
@printf "$(OBJ_PATH) created\n"
$(OBJ_PATH)/%.o: $(SRCS_PATH)/%.cpp $(HEAD)
@$(CCPP) $(FLAGS) $(CPP_FLAGS) $(INC) -o $@ -c $<
@printf " $(COL_GREEN)[OK]$(EOC) $(COL_YELLOW)Compiling:$(EOC) $<\r"
clean:
@rm -Rf $(OBJ_PATH)
@echo "$(BOLD_GREEN)$(NAME)$(EOC) clean $(BOLD_GREEN)✓$(EOC)"
fclean: clean
@rm -Rf $(NAME)
@echo "$(BOLD_GREEN)$(NAME)$(EOC) fclean $(BOLD_GREEN)✓$(EOC)"
re:
$(MAKE) fclean
$(MAKE) all
#------Compilation's flags------#
CCPP = clang++
# flags
CPP_FLAGS = -Wall -Wextra
ifneq ($(NOERR),yes)
CPP_FLAGS += -Werror
endif
CPP_FLAGS += -std=c++11
LIBCURSES += -lncurses
ifeq ($(DEV),yes)
FLAGS += -g
endif
ifeq ($(SAN),yes)
FLAGS += -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls
endif
ifneq ($(LOG),yes)
FLAGS += -D NLOG
endif
#------Define colors------#
BOLD_GREEN = \033[01;32m
COL_GREEN = \033[0;32m
COL_YELLOW = \033[0;33m
EOC = \033[0m
.PHONY: all re fclean clean