-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
71 lines (56 loc) · 1.38 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
NAME = push_swap
CC = cc
CFLAGS = -Wall -Werror -Wextra
LIBFT = ./Libft/libft.a
SRC_DIR = ./src
SRC := sort_functions/sort_function.c \
sort_functions/sort_function2.c \
algo_3_5_numbers.c \
check_error.c \
find_min_max.c \
free_stack.c \
init_stack.c \
main.c \
parsing.c \
final_algo.c \
count_operation.c
SRC := $(addprefix $(SRC_DIR)/, $(SRC))
OBJ_DIR = obj
OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
DEPS := $(OBJ:.o=.d)
DEPS += ./Libft/*.d
PINK = \033[1;95m
RED = \033[0;91m
CYAN = \033[0;96m
MAGENTA = \033[1;35m
RESET = \033[0m
MAKEFLAGS += --no-print-directory
all: $(NAME)
@echo "$(PINK)Push Swap OK$(RESET)"
$(NAME): $(OBJ)
@$(MAKE) -C ./Libft
@$(CC) $(CFLAGS) $(OBJ) $(LIBFT) -o $(NAME)
@echo "$(YELLOW)Compiling: $< $(DEF_COLOR)"
.EXTRA_PREREQS:= $(abspath $(lastword $(MAKEFILE_LIST)))
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
@echo "$(MAGENTA)Compiling: $< $(DEF_COLOR)"
norminette:
norminette $(SRC_DIR)
norminette Libft/
norminette ./includes/
clean:
@echo "$(CYAN)Removing: $(OBJ) $(OBJ_DIR) $(DEF_COLOR)"
@$(MAKE) -C ./Libft clean
@rm -rf $(OBJ_DIR)
@rm -f ./Libft/*.d
@rm -f Libft/GNL/*.d
@rm -f Libft/ft_printf/*.d
fclean: clean
@$(MAKE) -C ./Libft fclean
@rm -f $(NAME)
@echo "$(RED)libft.a remove$(DEF_COLOR)"
@echo "$(RED)$(NAME) remove$(DEF_COLOR)"
re: fclean all
-include $(DEPS)