-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
87 lines (69 loc) · 2.18 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ldulling <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/09/25 12:48:32 by ldulling #+# #+# #
# Updated: 2023/10/22 21:55:27 by ldulling ### ########.fr #
# #
# **************************************************************************** #
NAME = libftprintf.a
I = ./
D = build/dep/
O = build/obj/
L = libft/
SRC = ft_printf.c \
ft_putnbr_base_fd.c \
ft_putnchar_fd.c \
ft_putnstr_fd.c \
print_char.c \
print_nbr.c \
print_parsed.c \
print_ptr.c \
print_str.c \
set_format.c
CC = cc
CFLAGS = -Wall -Wextra -Werror $(foreach X,$I,-I$X)
ARFLAGS = rcs
DEP = $(SRC:%.c=$D%.d)
OBJ = $(SRC:%.c=$O%.o)
.PHONY: all bonus cleandep cleanobj clean fclean re norminette
all: $(NAME)
$(NAME): $(OBJ)
make -C $L
cp $Llibft.a ./$@
ar $(ARFLAGS) $(NAME) $^
bonus: all
$(OBJ): $O%.o: %.c | $O
$(CC) $(CFLAGS) -c $< -o $@
$(DEP): $D%.d: %.c | $D
@$(CC) $(CFLAGS) -MM -MP -MF $@ -MT "$O$*.o $@" $<
$O $D:
@mkdir -p $@
cleandep:
ifeq ($(filter $(MAKECMDGOALS),clean fclean re),)
make -C $L cleandep
endif
rm -rf $D
cleanobj:
ifeq ($(filter $(MAKECMDGOALS),clean fclean re),)
make -C $L cleanobj
endif
rm -rf $O
clean: cleandep cleanobj
rm -rf build/
ifeq ($(filter $(MAKECMDGOALS),fclean re),)
make -C $L clean
endif
fclean: clean
make -C $L fclean
rm -f $(NAME)
re: fclean all
norminette:
norminette -R CheckForbiddenSourceHeader
norminette -R CheckDefine $I*.h
ifeq ($(filter $(MAKECMDGOALS),cleandep cleanobj clean fclean),)
-include $(DEP)
endif