-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
122 lines (103 loc) · 3.8 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
115
116
117
118
119
120
121
122
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: caalbert <caalbert@student.42sp.org.br> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/03/04 22:02:38 by caalbert #+# #+# #
# Updated: 2023/05/17 05:22:33 by caalbert ### ########.fr #
# #
# **************************************************************************** #
NAME = push_swap
CC = gcc
RM = rm -rf
CFLAGS = -Wall -Wextra -Werror -g -O3
LIBFT_DIR = ./libft
LIBFT = $(LIBFT_DIR)/libft.a
# valgrind flags.
LFLAGS = --leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--log-file=valgrind-out.txt \
./push_swap 209 390 200 -10 -23 0 5
SRCDIR = ./srcs/
OBJDIR = ./objs/
SRC = main.c \
errors.c \
manage_lists.c \
operating_push.c \
operating_reverse.c \
operating_swap.c \
operating_rotate.c \
radix_algorithimn.c \
sorting_biggest_numbers.c \
sorting_small_numbers.c \
tools_utils.c
OBJ = $(addprefix $(OBJDIR), $(notdir $(SRC:.c=.o)))
CYAN := \033[1;36m
YELLOW := \033[1;33m
GREEN := \033[1;32m
RED := \033[1;31m
RESET := \033[0m
HEADER_NAME = + * $(NAME) Compiled! #
all: $(NAME)
$(OBJDIR)%.o: $(SRCDIR)%.c
mkdir -p $(OBJDIR)
@echo ""
$(CC) $(CFLAGS) -c $< -o $@
$(NAME): $(LIBFT) $(OBJ)
@echo "------------------------------------------"
$(CC) $(CFLAGS) -o $(NAME) $(OBJ) $(LIBFT)
@echo ""
@echo "${GREEN}\
\n/* ************************************************************************** */\
\n/* */\
\n/* ::: :::::::: */\
\n/* :+: :+: :+: */\
\n/* +:+ +:+ +:+ DONE... */\
\n/* +#+ +:+ +#+ */\
\n/* +#+#+#+#+#+ +#${HEADER_NAME}*/\
\n/* #+# #+# By: caalbert <caalbert@student.42sp.org.br> */\
\n/* ### ########.fr */\
\n/* */\
\n/* ************************************************************************** */\n\
${RESET}"
@echo ""
$(LIBFT):
make -C $(LIBFT_DIR)
clean:
$(RM) $(OBJDIR)
make clean -C $(LIBFT_DIR)
fclean: clean
$(RM) $(NAME)
make fclean -C $(LIBFT_DIR)
re: fclean all
leaks:
valgrind $(LFLAGS)
cat valgrind-out.txt
test:
wget https://cdn.intra.42.fr/document/document/14455/checker_linux
mv checker_linux checker
chmod 777 checker
test3: $(NAME)
$(eval ARG = $(shell shuf -i 0-50 -n 3))
./push_swap $(ARG) | ./checker $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
test5: $(NAME)
$(eval ARG = $(shell shuf -i 0-50 -n 5))
./push_swap $(ARG) | ./checker $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
test100: $(NAME)
$(eval ARG = $(shell shuf -i 0-1000 -n 100))
./push_swap $(ARG) | ./checker $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
test500: $(NAME)
$(eval ARG = $(shell shuf -i 0-1000 -n 500))
./push_swap $(ARG) | ./checker $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
.PHONY: all clean fclean re leaks test3 test5 test100