-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (70 loc) · 2.59 KB
/
Makefile
File metadata and controls
89 lines (70 loc) · 2.59 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: sadoming <sadoming@student.42barcel> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/08/31 17:32:13 by sadoming #+# #+# #
# Updated: 2023/09/13 16:03:46 by sadoming ### ########.fr #
# #
# **************************************************************************** #
TEST = test.out
DIR = ./GetNextLine/
CFLAGS = -Wall -Wextra -Werror -D BUFFER_SIZE=10
# Sources:
MAK = Makefile
LIB = $(DIR)get_next_line.h $(DIR)get_next_line_bonus.c
TLIB = Tests/test_getnextline.h
SRC = $(DIR)get_next_line.c $(DIR)get_next_line_utils.c
BNS = $(DIR)get_next_line_bonus.c $(DIR)get_next_line_utils_bonus.c
TSRC = Tests/test_getnextline_main.c Tests/test_utils.c $(SRC)
OBJ = $(patsubst %.c, %.o, $(SRC))
OBJB = $(patsubst %.c, %.o, $(BNS))
TOBJ = $(patsubst %.c, %.o, $(TSRC)) $(LIB)
#------------------------------------------------------------------------------#
all: $(TEST)
%.o : %.c $(MAK) $(LIB)
@gcc $(CFLAGS) -c -o $@ $<
$(NAME): $(OBJ)
ar rc $(NAME) $(OBJ)
bonus: $(OBJB)
ar rc $(NAME) $(OBJB)
# make test.out:
$(TEST): $(OBJ) $(TOBJ)
@echo "\n\033[1;93m~ Norminette:"
@norminette $(SRC)
@norminette $(BNS)
@echo "\033[0;37m\n"
@gcc $(CFLAGS) -o $(TEST) $(DIR)*.o Tests/*.o
@echo * "\n"
# ./test.out:
test: $(TEST)
@leaks -atExit -- ./$(TEST)
@/bin/rm -f $(DIR)*.o
# ******************************************************************************* #
# lldb:
DEB = debug.out
DEBB = $(SRC) $(TSRC)
$(DEB): $(DEBB)
@gcc -g $(CFLAGS) -o $(DEB) $(DEBB)
debug: $(DEB)
@lldb $(DEB)
valgrind: $(DEB)
@gcc -g $(FLAGS) -o $(DEB) $(DEBB)
@valgrind ./$(DEB)
# ********************************************************************************* #
clean:
@/bin/rm -f *.o
@/bin/rm -f Tests/*.o
@/bin/rm -f $(TEST)
@/bin/rm -f $(DEB)
fclean: clean
@/bin/rm -frd test.out.dSYM
@/bin/rm -frd debug.out.dSYM
@/bin/rm -f .DS_Store
clear: fclean
@clear
# -------------------- #
.PHONY: all clean clear fclean debug test valgrind
# ********************************************************************************** #