-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (45 loc) · 1.83 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yublee <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/02/19 14:55:22 by yublee #+# #+# #
# Updated: 2024/07/28 22:08:42 by abelov ### ########.fr #
# #
# **************************************************************************** #
NAME := minishell
CC := cc
INC_DIR = ./include
INCLUDE_FLAGS := -I. -I$(INC_DIR) -I/usr/include
OPTIMIZE_FLAGS := -O0
DEBUG_FLAGS := -g3 -gdwarf-3
MANDATORY_FLAGS := -Wall -Wextra -Werror -Wimplicit
CFLAGS = $(MANDATORY_FLAGS) $(DEBUG_FLAGS) $(OPTIMIZE_FLAGS) $(INCLUDE_FLAGS)
LIBFT_DIR = ./lib/ft
LIBFT_LIB = $(LIBFT_DIR)/libft.a
LIBS := $(LIBFT)
LINK_FLAGS := -L $(LIBFT_DIR) -lft
SRCS = src/main.c
BUILD_DIR = build
OBJS = $(SRCS:%.c=$(BUILD_DIR)/%.o)
all: $(NAME)
$(NAME): $(LIBFT_LIB) $(OBJS)
$(CC) -L$(LIBFT_DIR) $(OBJS) -g -o $@ -lft
$(LIBFT_LIB):
@$(MAKE) -C $(LIBFT_DIR) -j8
$(BUILD_DIR)/%.o: %.c
@if [ ! -d $(@D) ]; then mkdir -pv $(@D); fi
$(CC) $(CFLAGS) $(INCLUDE) -c $^ -o $@
clean:
$(RM) -rf $(BUILD_DIR)
@$(MAKE) -C $(LIBFT_DIR) clean
fclean: clean
$(RM) $(RMFLAGS) $(NAME)
@$(MAKE) -C $(LIBFT_DIR) fclean
re: fclean all
norm:
@norminette $(SRCS)
@$(MAKE) -C $(LIBFT_DIR) norm
.PHONY: all clean fclean re bonus norm