-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (32 loc) · 978 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (32 loc) · 978 Bytes
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
NAME = libftprintf.a
CC = cc
CFLAGS = -Wall -Wextra -Werror
SRCS = ft_printf.c ft_print_char.c ft_print_str.c \
ft_print_ptr.c ft_print_nbr.c ft_print_unsigned.c ft_print_hex.c \
ft_print_utils.c
BONUS_SRCS = ft_printf_bonus.c ft_parse_format_bonus.c ft_print_char_bonus.c \
ft_print_str_bonus.c ft_print_ptr_bonus.c ft_print_nbr_bonus.c \
ft_print_unsigned_bonus.c ft_print_hex_bonus.c ft_print_utils_bonus.c
OBJS = $(SRCS:.c=.o)
BONUS_OBJS = $(BONUS_SRCS:.c=.o)
LIBFT_DIR = libft
LIBFT = $(LIBFT_DIR)/libft.a
all: $(NAME)
$(NAME): $(LIBFT) $(OBJS)
cp $(LIBFT) $(NAME)
ar rcs $(NAME) $(OBJS)
$(LIBFT):
$(MAKE) -C $(LIBFT_DIR)
bonus: $(LIBFT) $(BONUS_OBJS)
cp $(LIBFT) $(NAME)
ar rcs $(NAME) $(BONUS_OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
$(MAKE) -C $(LIBFT_DIR) clean
rm -f $(OBJS) $(BONUS_OBJS)
fclean: clean
$(MAKE) -C $(LIBFT_DIR) fclean
rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re bonus