-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.64 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rde-lima <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/10/27 21:56:03 by rde-lima #+# #+# #
# Updated: 2022/05/26 17:32:05 by rde-lima ### ########.fr #
# #
# **************************************************************************** #
NAME = libftprintf.a
SRC = ft_printf_utils.c ft_printf.c
CC = clang
FLAGS = -Wall -Werror -Wextra
INC = -Iinclude
SRC_DIR = src
OBJ_DIR = obj
OBJ = $(addprefix $(OBJ_DIR)/, $(SRC:.c=.o))
all: $(NAME)
$(NAME): $(OBJ_DIR) $(OBJ)
@ar rc $(NAME) $(OBJ)
@ranlib $(NAME)
@echo "Compiled '$(NAME)' successfully!"
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)
$(OBJ): $(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@echo "Compiling '$<' with flags: '$(FLAGS)'"
@$(CC) $(FLAGS) $(INC) -c $< -o $@
@echo "Compiled '$@' successfully!"
clean:
@rm -rf $(OBJ_DIR)
@echo "Cleaned '$(OBJ_DIR)' successfully!"
fclean: clean
@rm -f $(NAME)
@echo "Cleaned '$(NAME)' successfully!"
re: fclean all
debug: FLAGS += -fsanitize=address -fno-omit-frame-pointer -g3
debug: fclean all
.PHONY: all clean fclean re debug