-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
77 lines (60 loc) · 1.79 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
CC = gcc
CFLAGS = -Wall -Werror -Wextra
NAME = push_swap
SRC_PATH = src/
OBJ_PATH = obj/
SRC = main.c \
input_check.c input_check_utils.c \
initialization.c \
stack.c \
swap.c push.c rotate.c reverse_rotate.c \
sort_tiny.c sort.c \
position.c cost.c do_move.c \
utils.c
SRCS = $(addprefix $(SRC_PATH), $(SRC))
OBJ = $(SRC:.c=.o)
OBJS = $(addprefix $(OBJ_PATH), $(OBJ))
INCS = -I ./includes/
all: $(OBJ_PATH) $(NAME)
$(OBJ_PATH)%.o: $(SRC_PATH)%.c
$(CC) $(CFLAGS) -c $< -o $@ $(INCS)
$(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
test1000: $(NAME)
$(eval ARG = $(shell shuf -i 0-5000 -n 1000))
./push_swap $(ARG) | ./checker_linux $(ARG)
@echo -n "Instructions: "
@./push_swap $(ARG) | wc -l
.PHONY: all clean fclean re test2 test3 test5 test100 test500 test1000