-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (66 loc) · 2.14 KB
/
Copy pathMakefile
File metadata and controls
85 lines (66 loc) · 2.14 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tbui-quo <tbui-quo@student.42wolfsburg.d> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/12/15 14:25:15 by tbui-quo #+# #+# #
# Updated: 2023/12/15 14:25:15 by tbui-quo ### ########.fr #
# #
# **************************************************************************** #
# Target names
NAME = fdf
# Directories and source files
SRC = src/main.c \
src/read_file.c \
src/read_file_utils.c \
src/draw.c \
src/draw_helper.c \
src/utils.c \
src/keys_handler.c \
src/set_param.c \
src/help_menu.c
OBJ = $(SRC:.c=.o)
LIBS = -Llib/libft -lft \
-Llib/ft_printf -lftprintf \
-Llib/mlx_linux -lmlx_Linux $(shell pkg-config --libs x11 xext)
# Compiler and compilation flags
CC = cc
CFLAGS = -Wall -Wextra -Werror
# ANSI escape codes
BLUE = \033[0;34m
RESET = \033[0m
# Commands
all: $(NAME)
$(NAME): $(OBJ)
@make -C lib/libft
@make -C lib/ft_printf
@make -C lib/mlx_linux
@echo "$(BLUE)$(CC) $(CFLAGS) -o $(NAME) $(OBJ) $(LIBS)$(RESET)"
@$(CC) $(CFLAGS) -o $(NAME) $(OBJ) $(LIBS)
%.o: %.c
@$(CC) $(CFLAGS) -c $< -o $@
debug: CFLAGS += -g -fsanitize=address
debug: fclean all
test: CFLAGS := -g #Only g flag for valgrind memoryleak test
test: $(OBJ)
@make -C lib/libft
@make -C lib/ft_printf
@make -C lib/mlx_linux
@echo "$(BLUE)$(CC) -o $(NAME) $(OBJ) $(LIBS)$(RESET)"
@$(CC) -o $(NAME) $(OBJ) $(LIBS)
clean:
@make clean -C lib/libft
@make clean -C lib/ft_printf
@rm -f $(OBJ)
fclean: clean
@make fclean -C lib/libft
@make fclean -C lib/ft_printf
@rm -f $(NAME)
re: fclean all
run:
@make re
@make clean
@./$(NAME)
.PHONY: all clean fclean re