-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (42 loc) · 1.23 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
#------------------------------------------------------------------------------#
# VARIABLES #
#------------------------------------------------------------------------------#
NAME = libftprintf.a
LIBFT = libft.a
LDIR = libft/
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Werror -Wextra
RM = rm -f
# Sources are all .c files
SRCS = ft_printf.c\
ft_printnbr.c\
ft_printunnbr.c\
ft_printf_utils.c\
ft_printptr.c\
ft_printhex.c\
ft_printstr.c
OBJS = $(SRCS:.c=.o)
#------------------------------------------------------------------------------#
# TARGETS #
#------------------------------------------------------------------------------#
all: $(LDIR)$(LIBFT) $(NAME)
# Generates output file
$(NAME): $(OBJS) $(LDIR)$(LIBFT)
cp $(LDIR)$(LIBFT) $@
ar -rcs $(NAME) $(OBJS)
# Compiles sources into objects
$(OBJS): $(SRCS)
$(CC) $(CFLAGS) -c $(SRCS)
$(LDIR)$(LIBFT):
$(MAKE) -C $(LDIR)
# Removes objects
clean:
$(RM) $(OBJS)
$(RM) $(LDIR)*.o
# Removes objects and executables
fclean: clean
$(RM) $(NAME)
$(RM) $(LDIR)$(LIBFT)
# Removes objects and executables and remakes
re: fclean all