-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (55 loc) · 2.02 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rmei <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/08/21 12:07:28 by rmei #+# #+# #
# Updated: 2024/09/04 13:28:24 by rmei ### ########.fr #
# #
# **************************************************************************** #
#### -- VARIABLES -- ####
# Utils
UTILS_SRC = index.c moves.c stack.c
UTILS_SRC := $(addprefix src/shared_utils/, ${UTILS_SRC})
# Push Swap
PSWAP_SRC = main.c sort.c
PSWAP_SRC := $(addprefix src/push_swap/, ${PSWAP_SRC})
PSWAP_SRC += $(UTILS_SRC)
PSWAP_OBJS = $(PSWAP_SRC:%.c=%.o)
NAME = push_swap
# Checker
CHECKER_SRC = main.c sort.c
CHECKER_SRC := $(addprefix src/checker/, ${CHECKER_SRC})
CHECKER_SRC += $(UTILS_SRC)
CHECKER_OBJS = $(CHECKER_SRC:%.c=%.o)
CHECKER = checker
# External libraries
LIBFT = lib/libft
# Compiler and linker flags
CPPFLAGS = -I./include
CFLAGS = -Wall -Werror -Wextra -g
LDFLAGS = -L./$(LIBFT) -lft
#### -- RULES -- ####
all: __lib $(NAME)
bonus: __lib $(CHECKER)
# Create external libraries #
__lib:
make -C $(LIBFT)
# Create executables
$(NAME): $(PSWAP_OBJS)
cc $^ $(LDFLAGS) -o $@
$(CHECKER): $(CHECKER_OBJS)
cc $^ $(LDFLAGS) -o $@
%.o: %.c
cc $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# Manage object files and executables #
clean:
make clean -C $(LIBFT)
rm -f $(PSWAP_OBJS) $(CHECKER_OBJS)
fclean:
make fclean -C $(LIBFT)
rm -f $(PSWAP_OBJS) $(NAME) $(CHECKER_OBJS) $(CHECKER)
re: fclean all bonus
.PHONY: all clean fclean re