-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
106 lines (86 loc) · 2.96 KB
/
Copy pathMakefile
File metadata and controls
106 lines (86 loc) · 2.96 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Standard
NAME = libft.a
# Directories
INC = inc/
SRC_DIR = src/
OBJ_DIR = obj/
HEADERS = inc/libft.h \
inc/ft_printf.h \
inc/get_next_line.h
# Compielr and Flags
CC = gcc
CFLAGS = -Wall -Wextra -Werror -I
RM = rm -f
AR = ar rcs
# Source Files
FTIS_DIR = $(SRC_DIR)ft_is/ft_isalnum.c \
$(SRC_DIR)ft_is/ft_isalpha.c \
$(SRC_DIR)ft_is/ft_isascii.c \
$(SRC_DIR)ft_is/ft_isdigit.c \
$(SRC_DIR)ft_is/ft_isprint.c
FTMEM_DIR = $(SRC_DIR)ft_mem/ft_bzero.c \
$(SRC_DIR)ft_mem/ft_calloc.c \
$(SRC_DIR)ft_mem/ft_memchr.c \
$(SRC_DIR)ft_mem/ft_memcmp.c \
$(SRC_DIR)ft_mem/ft_memcpy.c \
$(SRC_DIR)ft_mem/ft_memmove.c \
$(SRC_DIR)ft_mem/ft_memset.c
FTPUT_DIR = $(SRC_DIR)ft_put/ft_putchar_fd.c \
$(SRC_DIR)ft_put/ft_putendl_fd.c \
$(SRC_DIR)ft_put/ft_putnbr_fd.c \
$(SRC_DIR)ft_put/ft_putstr_fd.c
FTTO_DIR = $(SRC_DIR)ft_to/ft_atoi.c \
$(SRC_DIR)ft_to/ft_itoa.c \
$(SRC_DIR)ft_to/ft_tolower.c \
$(SRC_DIR)ft_to/ft_toupper.c
FTSTR_DIR = $(SRC_DIR)ft_str/ft_split.c \
$(SRC_DIR)ft_str/ft_strchr.c \
$(SRC_DIR)ft_str/ft_strdup.c \
$(SRC_DIR)ft_str/ft_striteri.c \
$(SRC_DIR)ft_str/ft_strjoin.c \
$(SRC_DIR)ft_str/ft_strlcat.c \
$(SRC_DIR)ft_str/ft_strlcpy.c \
$(SRC_DIR)ft_str/ft_strlen.c \
$(SRC_DIR)ft_str/ft_strmapi.c \
$(SRC_DIR)ft_str/ft_strncmp.c \
$(SRC_DIR)ft_str/ft_strnstr.c \
$(SRC_DIR)ft_str/ft_strrchr.c \
$(SRC_DIR)ft_str/ft_strtrim.c \
$(SRC_DIR)ft_str/ft_substr.c
FTLST_DIR = $(SRC_DIR)ft_lst/ft_lstadd_back.c \
$(SRC_DIR)ft_lst/ft_lstadd_front.c \
$(SRC_DIR)ft_lst/ft_lstclear.c \
$(SRC_DIR)ft_lst/ft_lstdelone.c \
$(SRC_DIR)ft_lst/ft_lstiter.c \
$(SRC_DIR)ft_lst/ft_lstlast.c \
$(SRC_DIR)ft_lst/ft_lstmap.c \
$(SRC_DIR)ft_lst/ft_lstnew.c \
$(SRC_DIR)ft_lst/ft_lstsize.c
FTPRINTF_DIR = $(SRC_DIR)ft_printf/ft_printf.c \
$(SRC_DIR)ft_printf/ft_handle_char.c \
$(SRC_DIR)ft_printf/ft_handle_string.c \
$(SRC_DIR)ft_printf/ft_handle_int.c \
$(SRC_DIR)ft_printf/ft_handle_unsigned.c \
$(SRC_DIR)ft_printf/ft_handle_pointer.c \
$(SRC_DIR)ft_printf/ft_handle_hex.c \
$(SRC_DIR)ft_printf/ft_handle_percent.c \
$(SRC_DIR)ft_printf/ft_printf_utils.c
GNL_DIR = $(SRC_DIR)get_next_line/get_next_line.c
# Concatenate all source files
SRC = $(FTIS_DIR) $(FTMEM_DIR) $(FTPUT_DIR) $(FTTO_DIR) $(FTTO_DIR) $(FTSTR_DIR) $(FTLST_DIR) $(FTPRINTF_DIR) $(GNL_DIR)
# Apply the pattern substitution to each source file in SRC and produce a corresponding list of object files in the OBJ_DIR
OBJ = $(patsubst $(SRC_DIR)%.c,$(OBJ_DIR)%.o,$(SRC))
# Build rules
all: $(NAME)
$(NAME): $(OBJ)
@$(AR) $(NAME) $(OBJ)
$(OBJ_DIR)%.o: $(SRC_DIR)%.c $(HEADERS)
@mkdir -p $(@D)
@$(CC) $(CFLAGS) $(INC) -c $< -o $@
clean:
@$(RM) -r $(OBJ_DIR)
@$(RM) .cache_exists
fclean: clean
@$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re