-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (38 loc) · 1.18 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
# VAR ---------------------------------------------------------------
OBJS_DIR = .OBJS/
SRCS = src/parsing.c src/index.c \
algo/solve.c algo/radix.c \
instructions/swap.c instructions/push.c instructions/rotate.c instructions/reverse_rotate.c \
utils/list.c utils/list_utils.c utils/number.c utils/put_str_fd.c \
main.c
OBJS = $(addprefix $(OBJS_DIR), $(SRCS:.c=.o))
DEP = $(addprefix $(OBJS_DIR), $(SRCS:.c=.d))
NAME = push_swap
HEAD_DIR = INCLUDES/
CC = cc
RM = rm -rf
FLAGS = -Wall -Wextra -Werror -g3
FLAGS += -MMD -MP
# RULES -------------------------------------------------------------
all: $(NAME)
run: all
./$(NAME) 0 2 1 8 99 7 6
norm:
norminette
$(NAME): $(OBJS)
$(CC) $(FLAGS) $(OBJS) -o $(NAME)
-include $(DEP)
$(OBJS_DIR)%.o: %.c | dir
$(CC) $(FLAGS) -I $(HEAD_DIR) -c $< -o $@
dir:
@mkdir -p $(OBJS_DIR)
@mkdir -p $(OBJS_DIR)/src
@mkdir -p $(OBJS_DIR)/algo
@mkdir -p $(OBJS_DIR)/instructions
@mkdir -p $(OBJS_DIR)/utils
clean:
$(RM) $(OBJS_DIR)
fclean: clean
$(RM) $(NAME) $(NAME_BON)
re: fclean all
.PHONY: all run norm dir clean fclean re