-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (100 loc) · 2.73 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: awerebea <awerebea@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/04/30 21:56:47 by awerebea #+# #+# #
# Updated: 2020/09/23 22:03:56 by awerebea ### ########.fr #
# #
# **************************************************************************** #
NAME = libft.a
CC = gcc
CFLAGS = -Wall -Wextra -Werror
OFLAGS = -O2
DBGFLAGS = -g
INCLUDES = -I includes/
SRCDIR = srcs/
OBJDIR = objs/
FLSDIR_1 = put/
FLS_1 = $(addprefix $(FLSDIR_1), \
ft_putchar_fd \
ft_putendl_fd \
ft_putnbr_fd \
ft_putstr_fd)
FLSDIR_2 = strings/
FLS_2 = $(addprefix $(FLSDIR_2), \
ft_split \
ft_strchr \
ft_strdup \
ft_strjoin \
ft_strlcat \
ft_strlcpy \
ft_strlen \
ft_strmapi \
ft_strncmp \
ft_strncpy \
ft_strnstr \
ft_strrchr \
ft_strtrim \
ft_substr)
FLSDIR_3 = memory/
FLS_3 = $(addprefix $(FLSDIR_3), \
ft_bzero \
ft_calloc \
ft_memccpy \
ft_memchr \
ft_memcmp \
ft_memcpy \
ft_memmove \
ft_memset)
FLSDIR_4 = symbols/
FLS_4 = $(addprefix $(FLSDIR_4), \
ft_isalnum \
ft_isalpha \
ft_isascii \
ft_isdigit \
ft_isprint \
ft_isspace \
ft_tolower \
ft_toupper)
FLSDIR_5 = numbers/
FLS_5 = $(addprefix $(FLSDIR_5), \
ft_atoi \
ft_itoa)
FLSDIR_6 = lists/
FLS_6 = $(addprefix $(FLSDIR_6), \
ft_lstadd_back \
ft_lstadd_front \
ft_lstclear \
ft_lstdelone \
ft_lstiter \
ft_lstlast \
ft_lstmap \
ft_lstnew \
ft_lstsize)
SRC = $(FLS_1) $(FLS_2) $(FLS_3) $(FLS_4) \
$(FLS_5) $(FLS_6)
OBJ = $(addprefix $(OBJDIR), $(SRC:=.o))
DFLS = $(SRC:=.d)
override FLAGS ?= $(CFLAGS)
all: $(OBJDIR) $(NAME)
$(NAME): $(OBJ)
ar rc $(NAME) $?
ranlib $(NAME)
$(OBJ): $(OBJDIR)%.o: $(SRCDIR)%.c
$(CC) $(FLAGS) $(INCLUDES) -c $< -o $@ -MD
$(OBJDIR):
mkdir -p $(OBJDIR)
mkdir -p $(addprefix $(OBJDIR), $(FLSDIR_1) $(FLSDIR_2) $(FLSDIR_3) \
$(FLSDIR_4) $(FLSDIR_5) $(FLSDIR_6))
debug:
make FLAGS="$(CFLAGS) $(DBGFLAGS)" all
include $(wildcard $(addprefix $(OBJDIR), $(DFLS)))
clean:
rm -rf $(OBJDIR)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY: all debug clean fclean re