-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (62 loc) · 1.63 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
NAME = push_swap
CC = cc
CFLAGS = -Wall -Werror -Wextra
SRC_PATH = src/
OBJ_PATH = obj/
SRC = main.c \
action.c \
cost.c \
exit_statement.c \
init.c \
mini_sort.c \
pos.c \
rule_push.c \
rule_rev_rotate.c \
rule_rotate.c \
rule_swap.c \
sort.c \
stack.c \
utils.c \
validate_input.c \
validate_input_utils.c
SRCS = $(addprefix $(SRC_PATH), $(SRC))
OBJ = $(SRC:.c=.o)
OBJS = $(addprefix $(OBJ_PATH), $(OBJ))
all: $(OBJ_PATH) $(NAME)
$(OBJ_PATH)%.o: $(SRC_PATH)%.c
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJ_PATH):
@mkdir $(OBJ_PATH)
$(NAME): $(OBJS)
@$(CC) $(CFLAGS) $(OBJS) -o $(NAME)
clean:
@rm -rf $(OBJ_PATH)
fclean: clean
@rm -f $(NAME)
re: fclean all
test2: $(NAME)
$(eval ARG = $(shell shuf -i 0-100 -n 2))
./push_swap $(ARG) | ./checker_linux $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
test3: $(NAME)
$(eval ARG = $(shell shuf -i 0-100 -n 3))
./push_swap $(ARG) | ./checker_linux $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
test5: $(NAME)
$(eval ARG = $(shell shuf -i 0-5000 -n 5))
./push_swap $(ARG) | ./checker_linux $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
test100: $(NAME)
$(eval ARG = $(shell shuf -i 0-5000 -n 100))
./push_swap $(ARG) | ./checker_linux $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
test500: $(NAME)
$(eval ARG = $(shell shuf -i 0-5000 -n 500))
./push_swap $(ARG) | ./checker_linux $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
.PHONY: all clean fclean re test2 test3 test5 test100 test500