-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (59 loc) · 2.75 KB
/
Makefile
File metadata and controls
72 lines (59 loc) · 2.75 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: sarfreit <sarfreit@student.42porto.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/11/17 23:01:48 by sarfreit #+# #+# #
# Updated: 2025/11/17 23:01:48 by sarfreit ### ########.fr #
# #
# **************************************************************************** #
# --------------------------------------------------------------------------- #
# Compiler and flags
# --------------------------------------------------------------------------- #
CC := cc
CFLAGS := -Wall -Wextra -Werror -I .
# --------------------------------------------------------------------------- #
# Library name
# --------------------------------------------------------------------------- #
NAME := libftprintf.a
# --------------------------------------------------------------------------- #
# ft_printf sources
# --------------------------------------------------------------------------- #
SRCS := ft_printf.c \
ft_printf_utils.c
BONUS_SRCS := ft_printf_bonus.c \
ft_printf_utils.c \
ft_flags_bonus.c
OBJS := $(SRCS:.c=.o)
BONUS_OBJS := $(BONUS_SRCS:.c=.o)
# --------------------------------------------------------------------------- #
# Rules
# --------------------------------------------------------------------------- #
all: $(NAME)
$(NAME): $(OBJS)
@$(MAKE) -C libft
cp libft/libft.a $(NAME)
ar rcs $(NAME) $(OBJS)
bonus: $(BONUS_OBJS)
@$(MAKE) -C libft
cp libft/libft.a $(NAME)
ar rcs $(NAME) $(BONUS_OBJS)
# --------------------------------------------------------------------------- #
# Generic compile rule
# --------------------------------------------------------------------------- #
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# --------------------------------------------------------------------------- #
# Clean rules
# --------------------------------------------------------------------------- #
clean:
@$(MAKE) -C libft clean
rm -f $(OBJS) $(BONUS_OBJS)
fclean: clean
@$(MAKE) -C libft fclean
rm -f $(OBJS) $(NAME) $(BONUS_OBJS)
re: fclean all
# --------------------------------------------------------------------------- #
.PHONY: all clean fclean re bonus