-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (45 loc) · 947 Bytes
/
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
NAME = libftprintf.a
SRC_DIR = ./src
SRC := ft_printf.c\
f_get_params.c\
f_calc_params.c\
fs_cs.c\
fs_diuxp.c\
fs_wcs.c\
fs_f.c\
fs_e_print.c\
fs_e_count.c\
fs_g.c\
fs_g_support.c\
fs_float_utils.c\
fs_float_print_utils.c\
fs_float_inf_nan.c
FT_DIR = ./ft_src
FT_SRC := ft_memset.c\
ft_calloc.c\
ft_bzero.c\
ft_strchr.c\
ft_min.c\
ft_print_num_base.c\
ft_countdigits_base.c
OBJ = $(addprefix $(BIN)/, $(SRC:c=o))\
$(addprefix $(BIN)/, $(FT_SRC:c=o))
INCLUDES = $(NAME:.a=.h)
BIN = ./bin
.PHONY: all clean fclean re bonus
all bonus: $(NAME)
$(BIN):
@mkdir $(BIN)
$(NAME): $(OBJ) $(INCLUDES)
@ar rc $@ $?
@ranlib $@
@echo "$(NAME) compiled"
$(BIN)/%.o: ./*/%.c $(INCLUDES) | $(BIN)
@gcc -Wall -Wextra -Werror -c $< -o $@
clean:
rm -rf $(OBJ)
@echo "Object files deleted"
fclean: clean
@rm -rf $(NAME)
@echo "$(NAME) deleted"
re: fclean all