-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (55 loc) · 1.92 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: paola <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/05/14 18:05:45 by paola #+# #+# #
# Updated: 2024/05/21 14:22:12 by paola ### ########.fr #
# #
# **************************************************************************** #
NAME = push_swap
# compilation and flag
CC = gcc
CFLAGS = -Wall -Wextra -Werror
# Directories
SRC_DIR = ./src
OBJ_DIR = ./obj
INCLUDE = ./include
# files sources and objects
SRC_FILES = error_free.c \
free.c \
split_modified.c \
push_command.c \
push_swap_command.c \
push_swap_init.c \
reverse_rotate_command.c \
rotate_command.c \
stack_utils.c \
stack_init.c \
swap_command.c \
tiny_sort.c
OBJ_FILES = $(addprefix $(OBJ_DIR)/,$(SRC_FILES:.c=.o))
# Libft files
LIBFT_DIR = ./libft
LIBFT_LIB = $(LIBFT_DIR)/lib
LIBFT = libft.a
# Executable
MAIN_DIR = ./prog
all: $(NAME)
$(NAME): $(OBJ_FILES) $(LIBFT_LIB)/$(LIBFT)
$(CC) $(CFLAGS) $(MAIN_DIR)/*.c $(OBJ_FILES) -I $(INCLUDE) -o $@ -L $(LIBFT_LIB) -lft
$(LIBFT_LIB)/$(LIBFT): $(LIBFT_DIR)
@make -C $(LIBFT_DIR)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) -I $(INCLUDE) -c $< -o $@
clean:
@rm -rf $(OBJ_DIR)/*.o
@make -C $(LIBFT_DIR) clean
fclean: clean
@rm -rf $(OBJ_DIR)
@make -C $(LIBFT_DIR) fclean
re: fclean all
.PHONY: all clean fclean re