-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (63 loc) · 2.17 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
72
73
74
75
76
77
78
79
80
81
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lgaume <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/10/28 20:05:02 by lgaume #+# #+# #
# Updated: 2023/10/28 20:05:04 by lgaume ### ########.fr #
# #
# **************************************************************************** #
#Variables
NAME = libftprintf.a
HEADER = header
LIBFT = libft
SRC_DIR = c-files/
OBJ_DIR = obj/
CC = gcc
CFLAGS = -Wall -Werror -Wextra -I
RM = rm -f
AR = ar rcs
# Colors
DEF_COLOR = \033[0;39m
GRAY = \033[0;90m
RED = \033[0;91m
GREEN = \033[0;92m
YELLOW = \033[0;93m
BLUE = \033[0;94m
MAGENTA = \033[0;95m
CYAN = \033[0;96m
WHITE = \033[0;97m
#Sources
C-FILES = ft_printf ft_putstr ft_print_char ft_print_str ft_print_nbr ft_print_unsigned ft_print_hex ft_print_ptr
SRC = $(addprefix $(SRC_DIR), $(addsuffix .c, $(C-FILES)))
OBJ = $(addprefix $(OBJ_DIR), $(addsuffix .o, $(C-FILES)))
#Rules
OBJF = .cache_exists
all: $(NAME)
$(NAME): $(OBJ)
@make -C $(LIBFT)
@cp libft/libft.a .
@mv libft.a $(NAME)
@$(AR) $(NAME) $(OBJ)
$(OBJ_DIR)%.o: $(SRC_DIR)%.c | $(OBJF)
@$(CC) $(CFLAGS) $(HEADER) -c $< -o $@
$(OBJF):
@mkdir -p $(OBJ_DIR)
clean:
@$(RM) -rf $(OBJ_DIR)
@make clean -C $(LIBFT)
fclean: clean
@$(RM) -f $(NAME)
@$(RM) -f $(LIBFT)/libft.a
re: fclean all
norm:
@echo "$(RED)Launching norminette...$(DEF_COLOR)"
@echo "$(CYAN)Norminette of LIBFT"
@norminette $(LIBFT)
@echo "$(MAGENTA)Norminette of C-FILES"
@norminette $(SRC)
@echo "$(GREEN)Norminette of HEADER"
@norminette $(HEADER)
.PHONY: all clean fclean re norm