-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·114 lines (89 loc) · 4.45 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: mfouadi <mfouadi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/11/23 02:49:03 by mfouadi #+# #+# #
# Updated: 2022/12/02 05:45:09 by mfouadi ### ########.fr #
# #
# **************************************************************************** #
#----------------------------------------------------------------------------------------------
# Source Files
#----------------------------------------------------------------------------------------------
SRC = wr_address.c conv_hex.c ft_putunbr_fd.c ft_printf.c
#----------------------------------------------------------------------------------------------
# Object Files
#----------------------------------------------------------------------------------------------
OBJ = $(addprefix $(OBJ_D)/, $(SRC:.c=.o))
SRC_PATH = $(addprefix $(SRC_D), /)
LIBFT_OBJ_M = libft_printf/obj/*.o
LIBFT_OBJ_B = libft_printf/obj_B/*.o
#----------------------------------------------------------------------------------------------
# Archives
#----------------------------------------------------------------------------------------------
NAME = libftprintf.a
LIBFT_ARCHIVE = libft_printf/libft.a
#----------------------------------------------------------------------------------------------
# Variables
#----------------------------------------------------------------------------------------------
CFLAGS = -Wall -Werror -Wextra -c
HEADER = include/ft_printf.h
OBJ_D = obj
SRC_D = src
COMPILE = compiling
TITLE = FT_PRINTF
AR = ar -rcs
RM = rm -rf
#----------------------------------------------------------------------------------------------
# Terminal Ansi Colors
#----------------------------------------------------------------------------------------------
HBLK = '\e[1;90m'
HRED = '\e[1;91m'
HGRN = '\e[1;92m'
HYEL = '\e[1;93m'
HBLU = '\e[1;94m'
HMAG = '\e[1;95m'
HCYN = '\e[1;96m'
HWHT = '\e[1;97m'
NC = '\e[0m'
#----------------------------------------------------------------------------------------------
# Creating libftprintf.a
#----------------------------------------------------------------------------------------------
all : $(NAME)
$(TITLE) :
@ printf $(HMAG)"\n□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n"
@ printf "❚ ✍❡ FT_PRINTF ❡✍ ❚\n"$
@ printf "□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n\n"$(NC)
$(NAME) : $(TITLE) $(OBJ_D) $(OBJ) $(LIBFT_ARCHIVE)
$(AR) $(NAME) $(OBJ) $(LIBFT_OBJ_M) $(LIBFT_OBJ_B)
# $(CC) $(NAME) $(LIBFT_ARCHIVE)
@ printf ${HYEL}"\nft_Printf: Compilation steps finished 👻 "$(HRED)"Run ./a.out\n\n"${NC}
$(OBJ_D)/%.o : $(SRC_PATH)%.c $(HEADER)
@ $(CC) $(CFLAGS) $< -o $@
@ printf $(HWHT)"🧐 Compiling ▻ "${HRED}"$(notdir $@)\n"${NC}
$(OBJ_D) :
mkdir obj
#----------------------------------------------------------------------------------------------
# Libft rules
#----------------------------------------------------------------------------------------------
$(LIBFT_ARCHIVE) :
cd ./libft_printf ; make ; make bonus
re_all :
cd libft_printf ; make re ; make bonus ; cd .. ; make re
#----------------------------------------------------------------------------------------------
# Cleaning Object files
#----------------------------------------------------------------------------------------------
clean :
$(RM) $(OBJ_D)
@ printf $(HWHT)" Deleted : "$(HRED)" Object files\n"$(NC)
fclean : clean
$(RM) $(NAME)
@ printf $(HWHT)" Deleted : "$(HRED)" libftprintf.a\n"$(NC)
re : fclean all
#----------------------------------------------------------------------------------------------
# Built-in Targets
#----------------------------------------------------------------------------------------------
.SILENT : fclean clean clean_libft re_all $(OBJ_D) $(NAME) $(LIBFT_ARCHIVE)
.DEFAULT_GOAL := all