-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (44 loc) · 1.7 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: arabenst <arabenst@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/10/14 17:40:26 by arabenst #+# #+# #
# Updated: 2024/01/26 16:40:53 by arabenst ### ########.fr #
# #
# **************************************************************************** #
NAME = libftprintf.a
SRCDIR = src
OBJDIR = obj
INCDIRS = $(SRCDIR) libft
CC = gcc
INCFLAGS = $(foreach D,$(INCDIRS),-I $(D))
CFLAGS = -Wall -Werror -Wextra $(INCFLAGS)
AR = ar
ARFLAGS = rcs
RM = rm
RMFLAGS = -rf
LIBFT_DIR = libft
LIBFT = $(LIBFT_DIR)/libft.a
SRCS = $(wildcard $(SRCDIR)/*.c)
OBJS = $(addprefix $(OBJDIR)/,$(notdir $(SRCS:.c=.o)))
DEPS = $(foreach D,$(INCDIRS),$(wildcard $(D)/*.h))
$(NAME): $(LIBFT) $(OBJS)
cp $(LIBFT) $@
$(AR) $(ARFLAGS) $@ $^
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(DEPS)
@mkdir -p $(@D)
$(CC) -c $(CFLAGS) $< -o $@
$(LIBFT):
git clone https://github.com/aaron-22766/libft.git $(LIBFT_DIR); make -C $(LIBFT_DIR)
all: $(NAME)
bonus: all
clean:
$(RM) $(RMFLAGS) $(OBJDIR)
fclean: clean
$(RM) $(RMFLAGS) $(NAME) test
make fclean -C $(LIBFT_DIR)
re: fclean all
.PHONY: all clean fclean re