forked from Maxenceee/ft_shmup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (36 loc) · 1.12 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
NAME = ft_shmup
SRCS_DIR = srcs
SRCS = $(shell find $(SRCS_DIR) -name "*.cpp")
CFLAGS = -MMD -Wall -Wextra -Werror -MP -I includes -g3 -std=c++17
OUTDIR = .objs
OBJECTS = $(patsubst $(SRCS_DIR)%.cpp, $(OUTDIR)%.o, $(SRCS))
HEADERS_DIR = includes
HEADERS = $(shell find $(HEADERS_DIR) -name "*.h")
HEADERS_SOURCES = $(shell find $(SRCS_DIR) -name "*.h")
DEPS_FILES = ${OBJECTS:.o=.d}
CFLAGS = -MMD -MP -I$(HEADERS_DIR) -g3 -std=c++17
GREEN = \033[1;32m
BLUE = \033[1;34m
RED = \033[1;31m
YELLOW = \033[1;33m
DEFAULT = \033[0m
UP = "\033[A"
CUT = "\033[K"
all: $(NAME)
-include $(DEPS_FILES)
$(OUTDIR)/%.o: $(SRCS_DIR)/%.cpp $(HEADERS) $(HEADERS_SOURCES) Makefile
@mkdir -p $(@D)
@echo "$(YELLOW)Compiling [$<]$(DEFAULT)"
@c++ $(CFLAGS) -o $@ -c $<
@printf ${UP}${CUT}
${NAME}: $(OBJECTS)
@c++ $(CFLAGS) -lncursesw -o $(NAME) $(OBJECTS)
@echo "$(GREEN)$(NAME) compiled!$(DEFAULT)"
clean:
@echo "$(RED)Cleaning build folder$(DEFAULT)"
@rm -f $(OBJECTS) $(DEPS_FILES)
fclean: clean
@echo "$(RED)Cleaning $(NAME)$(DEFAULT)"
@rm -f $(NAME)
re: fclean all
.PHONY: clean fclean re all libft