-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_previous2
69 lines (50 loc) · 1.96 KB
/
Makefile_previous2
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
CC = cc
CFLAGS = -Wall -Wextra -Werror
NAME = libft.a
INCLUDES = ./
SRC_DIR = src/
SRCS = $(addprefix ft_is_check/, ft_isalnum.c ft_isalpha.c ft_isascii.c ft_isdigit.c ft_isprint.c)
SRCS += $(addprefix ft_memory/, ft_calloc.c ft_memchr.c ft_memcmp.c ft_memcpy.c ft_memmove.c ft_memset.c ft_bzero.c)
SRCS += $(addprefix ft_put/, $(addsuffix .c, ft_putchar_fd ft_putendl_fd ft_putnbr_fd ft_putstr_fd))
SRCS += $(addprefix ft_string/, $(addsuffix .c, ft_split ft_strchr ft_strdup ft_striteri ft_strjoin ft_strlcat ft_strlcpy ft_strlen ft_strmapi ft_strncmp ft_strnstr ft_strrchr ft_strtrim ft_substr))
SRCS += ft_to/ft_atoi.c ft_to/ft_tolower.c ft_to/ft_toupper.c ft_to/ft_itoa.c
OBJ_DIR = obj/
OBJS = $(addprefix $(OBJ_DIR), $(SRCS:%.c=%.o)) # $(addsuffix .o, $(SRCS))
BONUS_DIR = src/ft_lst
BONUS_SRCS = $(addprefix $(BONUS_DIR)/, $(addsuffix .c, ft_lstadd_back ft_lstadd_front ft_lstclear ft_lstdelone ft_lstiter ft_lstlast ft_lstmap ft_lstnew ft_lstsize))
BONUS_OBJS = $(addprefix $(OBJ_DIR), $(BONUS_SRCS:$(BONUS_DIR)/%.c=%.o))
# $(NAME): $(OBJ)
# @$(AR) $(NAME) $(OBJ)
# @ranlib $(NAME)
all : $(NAME)
$(NAME) : $(OBJS)
ar -rc $(NAME) $(OBJS)
# @ranlib $(NAME) # optimization
# $(CC) $(CFLAGS) -o $(NAME) $(SRCS) libft_main_test.c
$(OBJS) : $(OBJ_DIR)%.o : $(SRC_DIR)%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -I$(INCLUDES) -c $< -o $@
$(BONUS_OBJS) : $(OBJ_DIR)%.o : $(BONUS_DIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -I$(INCLUDES) -c $< -o $@
clean:
rm -rf $(OBJ_DIR)
fclean : clean
rm -f $(NAME)
re : fclean all
bonus : $(OBJS) $(BONUS_OBJS) $(NAME)
.PHONY : $(NAME) all clean fclean re bonus
# $(OBJ_DIR)ft_is_check:
# mkdir -p $(OBJ_DIR)ft_is_check
# $(OBJ_DIR)ft_lst:
# mkdir -p $(OBJ_DIR)ft_lst
# $(OBJ_DIR)ft_memory:
# mkdir -p $(OBJ_DIR)ft_memory
# $(OBJ_DIR)ft_other:
# mkdir -p $(OBJ_DIR)ft_other
# $(OBJ_DIR)ft_put:
# mkdir -p $(OBJ_DIR)ft_put
# $(OBJ_DIR)ft_string:
# mkdir -p $(OBJ_DIR)ft_string
# $(OBJ_DIR)ft_to:
# mkdir -p $(OBJ_DIR)ft_to