-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (57 loc) · 2.28 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lgaume <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/11 02:41:59 by lgaume #+# #+# #
# Updated: 2023/11/15 19:03:23 by lgaume ### ########.fr #
# #
# **************************************************************************** #
NAME = push_swap
# Compiler
CC = gcc
FLAGS = -Wall -Wextra -Werror -I
RM = rm -f
# Directories
LIBFT = ./libft/libft.a
INC = include/
SRC_DIR = src/
OBJ_DIR = obj/
# Source Files
OPERATIONS_DIR = $(SRC_DIR)operations/push.c \
$(SRC_DIR)operations/reverse_rotate.c \
$(SRC_DIR)operations/rotate.c \
$(SRC_DIR)operations/swap.c
UTILS_DIR = $(SRC_DIR)utils/stack_utils.c \
$(SRC_DIR)utils/stack_utils2.c \
$(SRC_DIR)utils/split.c \
$(SRC_DIR)utils/frees.c
ALGORITHMS_DIR = $(SRC_DIR)algorithms/sort_three.c \
$(SRC_DIR)algorithms/sort_stacks.c
STACKS_DIR = $(SRC_DIR)stacks/stack_init.c \
$(SRC_DIR)stacks/init_a_to_b.c \
$(SRC_DIR)stacks/init_b_to_a.c
ERRORS_DIR = $(SRC_DIR)errors/handle_errors.c
SRCS_DIR = $(SRC_DIR)main.c
SRCS = $(OPERATIONS_DIR) $(UTILS_DIR) $(ALGORITHMS_DIR) $(ERRORS_DIR) $(STACKS_DIR) $(SRCS_DIR)
OBJ = $(patsubst $(SRC_DIR)%.c,$(OBJ_DIR)%.o,$(SRCS))
# Rules
$(LIBFT) :
@make -C ./libft
all : $(NAME)
$(NAME) : $(OBJ) $(LIBFT)
@$(CC) $(FLAGS) $(INC) $(OBJ) $(LIBFT) -o $(NAME)
## Compile object files from source files
$(OBJ_DIR)%.o: $(SRC_DIR)%.c
@mkdir -p $(@D)
@$(CC) $(FLAGS) $(INC) -c $< -o $@
clean:
@$(RM) -r $(OBJ_DIR)
@make clean -C ./libft
fclean: clean
@$(RM) $(NAME)
@$(RM) $(LIBFT)
re : fclean all
.PHONY : all re clean fclean