-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
95 lines (77 loc) · 2.38 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: slisandr <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/01/21 15:25:21 by fcatina #+# #+# #
# Updated: 2020/11/23 08:16:56 by slisandr ### ########.fr #
# #
# **************************************************************************** #
.PHONY: all clean fclean re libft exec norm memcheck
CC = gcc
CFLAGS = -Wall -Wextra -Werror
NAME = libftprintf.a
EXEC = ft_printf
SRC_DIR = src
SRC_RAW = \
ft_printf.c \
ft_itoa_base.c \
x_ft_itoa_base.c\
ft_itoa_unsigned_base.c \
ft_itoa_unsigned_base.c \
handle_c.c \
handle_s.c \
handle_o.c \
handle_u.c \
handle_xxp.c \
handle_id.c \
handle_f.c \
handle_percent.c \
handle_precision.c \
putchar_and_count.c \
putstr_and_count.c \
print_string_ouxxp.c \
process_flags.c \
reset_struct.c \
ft_dtoa.c \
ft_ldtoa.c \
get_s_f.c \
get_s_o.c \
get_s_xx.c \
fix_s.c
SRC = $(addprefix $(SRC_DIR)/,$(SRC_RAW))
MAIN_RAW = main.c
MAIN = $(addprefix $(SRC_DIR)/,$(MAIN_RAW))
OBJ_DIR = obj
OBJ = $(addprefix $(OBJ_DIR)/,$(SRC_RAW:.c=.o))
all: $(NAME)
$(EXEC): $(NAME)
@ $(CC) $(CFLAGS) -o $(EXEC) $(MAIN) -I "includes/" -I "libft/includes/" -L . -lftprintf -L "libft/" -lft
$(NAME): libft $(OBJ_DIR) $(OBJ)
@ cp ./libft/libft.a $(NAME)
@ ar -rc $(NAME) $(OBJ)
@ ranlib $(NAME)
libft:
@ make -C libft/
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@ $(CC) $(CFLAGS) -I "includes/" -I "libft/includes/" -c $< -o $@
$(OBJ_DIR):
@ mkdir -p $(OBJ_DIR)
exec: $(EXEC)
clean:
@ rm -rf $(OBJ_DIR)
@ make -C libft/ clean
fclean: clean
@ rm -f $(NAME)
@ make -C libft/ fclean
re: fclean all
norm:
@ ./check_norm.sh
memcheck: exec
@ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt ./$(EXEC)
@ vim valgrind-out.txt
test: exec
@ clear && clear && clear
@ ./$(EXEC)