-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (32 loc) · 824 Bytes
/
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
NAME = program
### compile options ###
CXX = g++
CXXFLAGS = -Wall -Werror -Wextra
#OPTS = -fsanitize=address -g3
### files define ###
MAIN = main.cpp
SRCS = $(wildcard srcs/*.cpp)
INCS = $(wildcard incs/*.hpp)
OBJS = $(MAIN:%.cpp=%.o) $(SRCS:%.cpp=%.o)
### color define ###
GREEN = \033[32m
RED = \033[31m
YELLOW = \033[33m
RESET = \033[0m
all : $(NAME)
%.o :%.c
$(CXX) $(CXXFLAGS) -c $< -o $@
$(NAME): $(OBJS)
@$(CXX) $(CXXFLAGS) $(OBJS) -I $(INCS) -o $(NAME)
@$(CXX) $(CXXFLAGS) $(MAIN) $(SRCS) -I $(INCS) -o $(NAME)
@echo "make: $(GREEN)$(NAME) was created$(RESET)"
clean :
@rm -rf $(OBJS)
@echo "make: $(YELLOW)$(NAME) was fully cleaned up$(RESET)"
fclean :
@rm -rf $(OBJS)
@rm -rf $(NAME)
@echo "make: $(RED)$(NAME) was fully cleaned up$(RESET)"
re: fclean
make all
.PHONY: all clean fclean re