-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (39 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
52
53
54
55
56
NAME = fdf
INCLUDES = fdf.h keycode.h
INC_PATH = $(addprefix include/, $(INCLUDES))
SOURCES = main.c load_data.c scene.c draw_line.c draw_utils.c events.c
SOURCES += data_convert.c scene_utils.c transform.c rotation.c controls.c
LIBFT = ./libft/libft.a
MLX = ./mlx_linux/libmlx_Linux.a
SRCS_PATH = src
OBJS_PATH = obj
SRCS = $(addprefix $(SRCS_PATH)/, $(SOURCES))
OBJS = $(addprefix $(OBJS_PATH)/, $(SOURCES:.c=.o))
CFLAGS = -Wall -Wextra -Werror -O3 -g
RM = rm -f
CYAN = \033[1;36m
RESET = \033[0m
LOG = printf "$(CYAN)info:$(RESET) %s\n"
all: $(NAME)
bonus: all
norma:
@norminette $(SRCS_PATH) include
$(NAME): $(OBJS_PATH) $(LIBFT) $(MLX) $(OBJS) $(INC_PATH)
@$(LOG) "Compiling $(NAME)"
$(CC) $(CFLAGS) $(OBJS) $(LIBFT) -Lmlx_linux -lmlx -lXext -lX11 -lm -o $(NAME)
$(OBJS_PATH):
@mkdir -p $(OBJS_PATH)
$(OBJS_PATH)/%.o: $(SRCS_PATH)/%.c
@$(LOG) "Compiling $<"
$(CC) $(CFLAGS) -c $< -o $@
$(LIBFT):
@$(LOG) "Compiling libft..."
@make -C libft --no-print-directory
$(MLX):
@make -C mlx_linux
clean:
@$(RM) -r $(OBJS_PATH)
fclean: clean
@$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re bonus