-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (101 loc) · 3.1 KB
/
Copy pathMakefile
File metadata and controls
122 lines (101 loc) · 3.1 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: prasingh <prasingh@student.42berlin.de> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/12/19 22:55:07 by prasingh #+# #+# #
# Updated: 2025/12/21 17:48:43 by prasingh ### ########.fr #
# #
# **************************************************************************** #
NAME = push_swap
BONUS_NAME = checker
CC = cc
CFLAGS = -Wall -Wextra -Werror
INCLUDES = -I includes
SRC_DIR = src
BONUS_DIR = bonus
OBJ_DIR = obj
SRC_FILES = main.c \
main_helpers.c \
stack.c \
operation_helpers.c \
operations_a.c \
operations_b.c \
operations_both.c \
validation.c \
validation_helpers.c \
validation_token.c \
io.c \
atoi.c \
atoi_helpers.c \
indexing.c \
memory.c \
stack_utils.c \
sort_small.c \
sort_small_helpers.c \
sort_five_helpers.c \
sort_large.c \
rotation_helpers.c \
rotation_helpers_2.c \
insertion_helpers.c \
lis.c \
lis_helpers.c \
lis_helpers_2.c \
cost.c \
cost_helpers.c
SHARED_FILES = stack.c \
operation_helpers.c \
operations_a.c \
operations_b.c \
operations_both.c \
validation.c \
validation_helpers.c \
validation_token.c \
io.c \
atoi.c \
atoi_helpers.c \
indexing.c \
memory.c \
stack_utils.c \
sort_small.c \
sort_small_helpers.c \
sort_five_helpers.c \
sort_large.c \
rotation_helpers.c \
rotation_helpers_2.c \
insertion_helpers.c \
lis.c \
lis_helpers.c \
lis_helpers_2.c \
cost.c \
cost_helpers.c
SRC = $(addprefix $(SRC_DIR)/, $(SRC_FILES))
OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
BONUS_FILES = checker.c \
checker_utils.c \
checker_io.c \
checker_ops.c
BONUS_CHECKER_SRC = $(addprefix $(BONUS_DIR)/, $(BONUS_FILES))
BONUS_CHECKER_OBJ = $(BONUS_CHECKER_SRC:$(BONUS_DIR)/%.c=$(OBJ_DIR)/bonus_%.o)
SHARED_OBJ = $(addprefix $(OBJ_DIR)/, $(SHARED_FILES:%.c=%.o))
BONUS_OBJ = $(BONUS_CHECKER_OBJ) $(SHARED_OBJ)
all: $(NAME)
$(NAME): $(OBJ)
$(CC) $(CFLAGS) $(OBJ) -o $(NAME)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(OBJ_DIR)/bonus_%.o: $(BONUS_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
bonus: $(BONUS_NAME)
$(BONUS_NAME): $(SHARED_OBJ) $(BONUS_CHECKER_OBJ)
$(CC) $(CFLAGS) $(BONUS_OBJ) -o $(BONUS_NAME)
clean:
rm -rf $(OBJ_DIR)
fclean: clean
rm -f $(NAME) $(BONUS_NAME)
re: fclean all
.PHONY: all bonus clean fclean re