-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (43 loc) · 1.7 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ladloff <ladloff@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/10/31 13:16:40 by ladloff #+# #+# #
# Updated: 2023/06/15 20:22:25 by ladloff ### ########.fr #
# #
# **************************************************************************** #
SHELL := /bin/sh
NAME := libftprintf.a
SRC_DIR := ./src
BUILD_DIR := ./build
INCLUDE_DIR := ./include
LIBFT_DIR := ./lib/libft
SRC_FILES := ft_printf.c \
ft_printf_utils.c
OBJ_FILES := $(patsubst %.c,$(BUILD_DIR)/%.o,$(SRC_FILES))
CFLAGS := -Wall -Wextra -Werror -Wpedantic -MMD -MP
CPPFLAGS := -I$(INCLUDE_DIR) -I$(LIBFT_DIR)/include
.PHONY: all lib clean fclean re cleanlib fcleanlib relib
all: lib $(NAME)
lib:
$(MAKE) -C $(LIBFT_DIR)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(@D)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
-include $(OBJ_FILES:.o=.d)
$(NAME): $(OBJ_FILES)
cp $(LIBFT_DIR)/libft.a $(NAME)
ar -rcs $(NAME) $(OBJ_FILES)
clean:
rm -rf $(BUILD_DIR)
fclean: clean
$(RM) $(NAME)
re: fclean all
cleanlib:
$(MAKE) clean -C $(LIBFT_DIR)
fcleanlib:
$(MAKE) fclean -C $(LIBFT_DIR)
relib: fcleanlib lib