-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (54 loc) · 2 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: roglopes <roglopes@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/09/10 19:27:14 by roglopes #+# #+# #
# Updated: 2023/09/17 15:29:40 by roglopes ### ########.fr #
# #
# **************************************************************************** #
NAME = ./library/libftprintf.a
FOLDER_OBJ = ./objects/
SOURCES = ft_printf.c \
ft_putchar.c \
ft_putstr.c \
ft_putptr.c \
ft_putnbr.c \
ft_putunsign.c\
ft_puthex.c \
SOURCES := $(addprefix ./sources/,$(SOURCES))
OBJECTS = $(SOURCES:./sources/%.c=$(FOLDER_OBJ)%.o)
INCLUDES = ./includes/
CC = cc
CFLAGS = -Wall -Wextra -Werror
RM = rm -f
# Colors
DEF_COLOR = \033[0;39m
GRAY = \033[0;90m
RED = \033[0;91m
GREEN = \033[0;92m
YELLOW = \033[0;93m
BLUE = \033[0;94m
MAGENTA = \033[0;95m
CYAN = \033[0;96m
WHITE = \033[0;97m
all: $(FOLDER_OBJ) $(NAME)
$(FOLDER_OBJ):
mkdir -p $(FOLDER_OBJ)
$(NAME): $(OBJECTS)
@echo "$(GREEN)◞( 、ᐛ)、_/ The Makefile of $(NAME) has been compiled!$(DEF_COLOR)"
$(FOLDER_OBJ)%.o: ./sources/%.c
@$(CC) $(CFLAGS) -c $< -o $@ -I $(INCLUDES)
@ar rcs $(NAME) $@
@echo "Add $@ to $(NAME)"
clean:
@$(RM) $(OBJECTS)
@echo "$(BLUE) $(NAME) Object files cleaned!$(DEF_COLOR)"
fclean: clean
@$(RM) $(NAME)
@echo "$(BLUE) $(NAME) Executable files cleaned!$(DEF_COLOR)"
re: fclean all
@echo "$(BLUE) $(NAME) Cleaned and rebuilt everything!$(DEF_COLOR)"
.PHONY: all clean fclean re