-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (81 loc) · 2.62 KB
/
Makefile
File metadata and controls
99 lines (81 loc) · 2.62 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
90
91
92
93
94
95
96
97
98
99
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: cborrome <cborrome@student.hive.fi> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/02/10 13:57:25 by cborrome #+# #+# #
# Updated: 2025/02/18 10:11:36 by cborrome ### ########.fr #
# #
# **************************************************************************** #
NAME = push_swap
CC = cc
CFLAGS = -Wall -Werror -Wextra
SRC = \
main.c \
validation.c \
libft_split.c \
libft_atoi.c \
libft_strdup.c \
populate_stack.c \
free_error.c \
initialize_sorting.c \
op_push.c \
op_swap.c \
op_rotate.c \
op_reverse_rotate.c \
sort5.c \
sort_big.c \
execute_cheapest_move.c \
OBJ = $(SRC:.c=.o)
all : $(NAME)
$(NAME) : $(OBJ)
$(CC) $(CFLAGS) -o $(NAME) $(OBJ)
clean :
rm -f $(OBJ)
fclean : clean
rm -f $(NAME)
re : fclean all
GREEN = \e[1;32m
PURPLE = \e[1;35m
RESET = \033[0m
100: $(NAME)
@MAX=0; \
for i in $(shell seq 1 500); do \
ARGS=$$(shuf -i 1-2147483647 -n 100 | tr '\n' ' '); \
RESULT=$$(./$(NAME) $$ARGS | wc -l); \
if [ $$RESULT -gt $$MAX ]; then \
MAX=$$RESULT; \
fi; \
COMPLETION=$$(($$i * 100 / 500)); \
printf "\r%% Progress: $$COMPLETION%%"; \
sleep 0.01; \
done; \
echo "$(PURPLE)\nTarget Operations: 700\nWorst Case Operations: $$MAX$(RESET)"
500: $(NAME)
@MAX=0; \
for i in $(shell seq 1 100); do \
ARGS=$$(shuf -i 1-2147483647 -n 500 | tr '\n' ' '); \
RESULT=$$(./$(NAME) $$ARGS | wc -l); \
if [ $$RESULT -gt $$MAX ]; then \
MAX=$$RESULT; \
fi; \
COMPLETION=$$(($$i)); \
printf "\r%% Progress: $$COMPLETION%%"; \
sleep 0.01; \
done; \
echo "$(PURPLE)\nTarget Operations: 5500\nWorst Case Operations: $$MAX$(RESET)"
100check: $(NAME)
@for i in $(shell seq 1 10); do \
ARGS=$$(shuf -i 1-2147483647 -n 100 | tr '\n' ' '); \
./$(NAME) $$ARGS | ./checker_Mac $$ARGS; \
done
# ./$(NAME) $$ARGS | ./checker_linux $$ARGS;
500check: $(NAME)
@for i in $(shell seq 1 10); do \
ARGS=$$(shuf -i 1-2147483647 -n 500 | tr '\n' ' '); \
./$(NAME) $$ARGS | ./checker_Mac $$ARGS; \
done
# ./$(NAME) $$ARGS | ./checker_linux $$ARGS;
.PHONY : all clean fclean re