-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (42 loc) · 1.1 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
# <-- Library's Name --> #
NAME = gnl.a
# <-- Compilation Command --> #
CC = gcc
# <-- Compilation Flags --> #
CFLAGS = -Wall -Werror -Wextra
# <-- Remove Command -->#
RM = rm -f
# <-- HEADER --> #
HEADER = get_next_line.h
# <-- MAKEFILE --> #
MAKEFILE = Makefile
# <-- AR --> #
AR = ar -rcs
# <-- Files --> #
SRC_FILES = get_next_line.c get_next_line_utils.c
# <-- Objects --> #
OBJS = $(SRC_FILES:.c=.o)
# <-- Main Target --> #
all: $(NAME)
# <-- Objects Creation --> #
%.o: %.c $(HEADER) $(MAKEFILE)
@echo "🧩 ☁️ Compiling... $<..."
@$(CC) $(CFLAGS) -c $< -o $@
@echo "🔨 🦔 $@ created!"
# <--Library Creation--> #
$(NAME): $(OBJS)
@echo "✅ 🚀 0bjects created successfully!"
@$(AR) $@ $(OBJS)
@echo "✅ 🛰 $(NAME) created successfully!"
# <-- Objects Destruction --> #
clean:
@$(RM) $(OBJS)
@echo "🗑️ 🚀 Objects destroyed successfully!"
# <-- Clean Execution + .a Destruction --> #
fclean: clean
@$(RM) $(NAME) *.out
@echo "🗑️ 🛰 $(NAME) destroyed successfully!"
# <-- Fclean Execution -->
re: fclean all
# <-- Targets Declaration --> #
.PHONY : all clean fclean re