-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (65 loc) · 1.98 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
ifneq (,$(findstring xterm,${TERM}))
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
RESET := $(shell tput -Txterm sgr0)
ARGS_5 := $(shell seq 5 | shuf | tr '\n' ' ')
ARGS_3 := $(shell seq 3 | shuf | tr '\n' ' ')
ARGS_100 := $(shell seq 100 | shuf | tr '\n' ' ')
ARGS_500 := $(shell seq 500 | shuf | tr '\n' ' ')
endif
define GIT =
git add .
git status
read -p "${YELLOW}Commit Message:${RESET}" commit_message
read -p "${YELLOW}Branch:${RESET}" branch
git commit -m "$$commit_message"
git push origin $$branch
endef
define TESTS =
echo "${LIGHTPURPLE} ----- Sorting 3 args ----- ${RESET}"
./push_swap ${ARGS_3} | wc -l
echo "${LIGHTPURPLE} ----- checker_linux ----- ${RESET}"
./push_swap ${ARGS_3} | ./checker_linux ${ARGS_3}
echo "${LIGHTPURPLE} ----- Sorting 5 args ----- ${RESET}"
./push_swap ${ARGS_5} | wc -l
echo "${LIGHTPURPLE} ----- checker_linux ----- ${RESET}"
./push_swap ${ARGS_5} | ./checker_linux ${ARGS_5}
echo "${LIGHTPURPLE} ----- Sorting 100 args ----- ${RESET}"
./push_swap ${ARGS_100} | wc -l
echo "${LIGHTPURPLE} ----- checker_linux ----- ${RESET}"
./push_swap ${ARGS_100} | ./checker_linux ${ARGS_100}
echo "${LIGHTPURPLE} ----- Sorting 500 args ----- ${RESET}"
./push_swap ${ARGS_500} | wc -l
echo "${LIGHTPURPLE} ----- checker_linux ----- ${RESET}"
./push_swap ${ARGS_500} | ./checker_linux ${ARGS_500}
endef
NAME = push_swap
CC = cc
WFLAGS = -Wall -Werror -Wextra
LIBFT = libft.a
SRC = push_swap.c \
push_swap_utils.c \
push_swap_operations.c \
push_swap_stack_alloc.c
OBJ = $(SRC:.c=.o)
all: $(NAME)
$(NAME): $(OBJ) $(LIBFT)
$(CC) $(WFLAGS) $(OBJ) -g3 -L ./ -lft -o $(NAME)
%.o: %.c
$(CC) $(WFLAGS) -g3 -c $< -o $@
$(LIBFT):
make -C libft
re: fclean all
fclean: clean
@rm -rf $(NAME)
clean:
@rm -rf *.o
fclean_libft: fclean
@make fclean -C libft
commit: fclean_libft
@$(GIT)
test:
@${TESTS}
.PONHY: re fclean clean all
.ONESHELL: