-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
81 lines (63 loc) · 2.5 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: apuchill <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/08 15:21:34 by apuchill #+# #+# #
# Updated: 2021/03/21 15:32:58 by apuchill ### ########.fr #
# #
# **************************************************************************** #
NAME = miniRT
MLX_FLAGS = -lbsd -lmlx -lXext -lX11 -lm
INCLUDES = -I includes -I $(LIBFT_DIR)/includes/
LIBFT = $(LIBFT_DIR)libft.a
LIBFT_DIR = libft/
LIB_FLAGS = -L $(LIBFT_DIR) -lft
CC = clang
CFLAGS = -Wall -Wextra -Werror
# CFLAGS = -Wall -Wextra -Werror -g3 -fsanitize=address
RM = /bin/rm -f
NORM = ~/.norminette/norminette.rb
DIR_SRCS = srcs
DIR_OBJS = objs
SUBDIRS = main errors scene vectors bitmap
SRCS_DIRS = $(foreach dir, $(SUBDIRS), $(addprefix $(DIR_SRCS)/, $(dir)))
OBJS_DIRS = $(foreach dir, $(SUBDIRS), $(addprefix $(DIR_OBJS)/, $(dir)))
SRCS = $(foreach dir, $(SRCS_DIRS), $(wildcard $(dir)/*.c))
OBJS = $(subst $(DIR_SRCS), $(DIR_OBJS), $(SRCS:.c=.o))
$(DIR_OBJS)/%.o : $(DIR_SRCS)/%.c
@mkdir -p $(DIR_OBJS) $(OBJS_DIRS)
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
all: $(NAME)
$(LIBFT):
@make --no-print-directory -C $(LIBFT_DIR)
$(NAME): $(OBJS) $(LIBFT)
@$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(MLX_FLAGS) $(LIB_FLAGS)
clean:
@make clean --no-print-directory -C $(LIBFT_DIR)
@$(RM) $(OBJS)
@$(RM) -r $(DIR_OBJS)
fclean: clean
@make fclean --no-print-directory -C $(LIBFT_DIR)
@$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re
.PHONY: reset
reset:
@$(RM) $(OBJS) $(NAME)
.PHONY: rt
rt: reset all
./minirt "scenes/base_file.rt"
.PHONY: norm
norm:
@$(NORM) */*.h */*/*.h */*/*.c */*/*/*.c
.PHONY: norm2
norm2:
@$(NORM) */minirt.h */errors.h */scene.h */vectors.h */bitmap.h && echo ""
@$(NORM) srcs/main/*.c && echo ""
@$(NORM) srcs/errors/*.c && echo ""
@$(NORM) srcs/scene/*.c && echo ""
@$(NORM) srcs/vectors/*.c && echo ""
@$(NORM) srcs/bitmap/*.c