-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (67 loc) · 2.3 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: pguthaus <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/10/15 16:32:36 by pguthaus #+# #+# #
# Updated: 2019/10/29 16:13:37 by pguthaus ### ########.fr #
# #
# **************************************************************************** #
CC = clang
CFLAGS = -g -Wall -Werror -Wextra
INCS = -I includes -I libft/includes
NAME = libftprintf.a
LIBFT = libft/libft.a
T_NAME = tests_bin
SRCS = clear.c \
ft_printf.c \
buff/flush.c \
buff/write_alpha.c \
buff/write_num.c \
buff/write_hex.c \
fmt/fmt.c \
fmt/values.c \
fmt/convert_char.c \
fmt/convert_str.c \
fmt/convert_ptr.c \
fmt/convert_int.c \
fmt/convert_uint.c \
fmt/convert_hex.c \
fmt/convert_hex_up.c\
fmt/convert_percent.c\
T_SRCS = assert.c \
main.c \
tests_static.c \
tests_char.c \
tests_str.c \
tests_ptr.c \
tests_int.c \
tests_uint.c \
tests_hex.c \
tests_poly.c \
OBJS_DIR = ./objs/lib/
OBJS = $(addprefix $(OBJS_DIR),$(SRCS:.c=.o))
T_OBJS_DIR = ./objs/tests/
T_OBJS = $(addprefix $(T_OBJS_DIR),$(T_SRCS:.c=.o))
all: $(NAME)
$(NAME): $(LIBFT) $(OBJS)
@cp $(LIBFT) $(NAME)
ar rcs $(NAME) $(OBJS)
$(OBJS_DIR)%.o: srcs/%.c
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
tests: $(NAME) $(T_OBJS)
@$(CC) $(CFLAGS) $(INCS) $(T_OBJS) $(NAME) -o $(T_NAME)
@./$(T_NAME)
$(T_OBJS_DIR)%.o: tests/%.c
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
$(LIBFT):
$(MAKE) -C libft libft.a
clean:
rm -rf $(OBJS_DIR) $(T_OBJS_DIR)
fclean: clean
rm -f $(NAME) $(T_NAME)
re: fclean $(NAME)