-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (51 loc) · 1.84 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
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: opelman <[email protected]> +#+ #
# +#+ #
# Created: 2024/04/08 12:25:41 by opelman #+# #+# #
# Updated: 2024/09/13 14:09:30 by opelman ######## odam.nl #
# #
# **************************************************************************** #
NAME := push_swap
FLAGS := -Wall -Werror -Wextra
LINKS := -L./libft -lft
SRC_DIR := src
SRC := $(shell find $(SRC_DIR) -name '*.c')
OBJ_DIR := obj
OBJ := $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC))
all: $(NAME)
$(NAME): $(OBJ) $(LIBFT)
@cc -o $(NAME) $(FLAGS) $(OBJ) $(LINKS) && \
echo "\e[32mmade $(NAME)\e[0m";
obj/%.o: src/%.c
mkdir -p $(dir $@)
cc -c $(FLAGS) $(HEADERS) $< -o $@
$(LIBFT):
$(MAKE) -C libft
$(MAKE) clean -C libft
re:
@$(MAKE) fclean all -s
debug:
$(MAKE) fclean FLAGS="$(FLAGS) -g -fsanitize=address" all
clean:
@if [ -d "obj" ]; then \
rm -fr obj; \
rm -fr ./src/libft/obj; \
echo "\e[31mremoved object files\e[0m"; \
else \
echo "\e[32mno object files to clean\e[0m"; \
fi
fclean:
@if [ -d "obj" ]; then \
$(MAKE) clean -s; \
fi
@if [ -f "push_swap" ]; then \
rm -f $(NAME); \
echo "\e[31mremoved push_swap\e[0m"; \
else \
echo "\e[32mno program file to clean\e[0m"; \
fi
phony: all re debug clean fclean