-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (54 loc) · 1.71 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: qdegraev <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2015/12/07 08:41:32 by qdegraev #+# #+# #
# Updated: 2016/02/19 12:56:10 by qdegraev ### ########.fr #
# #
# **************************************************************************** #
NAME = ft_printf
LIBPRINT = libftprintf.a
LIBPATH = libft
LIB = $(LIBPATH)/libft.a
CC = gcc
CFLAGS = -Wall -Wextra -Werror
LDFLAGS = -L libft -lft
SRC = ft_printf.c \
types.c \
arg_length.c \
flags.c \
ft_putnbru.c \
ft_utoa_base.c \
type_d_i.c \
type_s.c \
type_x.c \
type_percent.c \
type_f.c \
type_c.c \
type_u.c \
type_o.c \
type_p.c \
ft_wchar.c \
OBJ = $(SRC:.c=.o)
all: $(LIB) $(LIBPRINT) $(NAME)
$(NAME): $(LIBPRINT)
$(CC) $(CFLAGS) $(LDFLAGS) -L. -lftprintf -o $@ main.c
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
$(LIBPRINT): $(OBJ)
ar rc temp.a $(OBJ)
ranlib temp.a
libtool -static -o $(LIBPRINT) $(LIB) temp.a
$(LIB):
make -C $(LIBPATH)
clean:
make clean -C $(LIBPATH)
rm -f $(OBJ)
fclean: clean
make fclean -C $(LIBPATH)
rm -f $(NAME) $(LIBPRINT) temp.a
re: fclean all
.PHONY: all re clean flcean $(NAME)