-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (86 loc) · 2.86 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: vvaas <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/01/18 10:57:27 by maldavid #+# #+# #
# Updated: 2023/12/14 19:01:26 by vvaas ### ########.fr #
# #
# **************************************************************************** #
NAME = ./minishell
SRCS = src/core/main.c \
src/core/init.c \
src/core/env.c \
src/core/env2.c \
src/core/errors.c \
src/core/memory.c \
src/core/interactive.c \
src/core/prompt_manager.c \
src/core/prompt_manager2.c \
src/utils/ft_joinfree.c \
src/utils/ft_freesplit.c \
src/utils/ft_strdup_malloc.c \
src/utils/ft_changedir.c \
src/utils/ft_iswhitespace.c \
src/exec/command.c \
src/exec/ft_execve.c \
src/exec/r_in.c \
src/exec/r_out.c \
src/exec/r_utils.c \
src/exec/c_pipe.c \
src/exec/env_utils.c \
src/exec/builtin/ft_exit.c \
src/exec/builtin/ft_cd.c \
src/exec/builtin/ft_pwd.c \
src/exec/builtin/ft_echo.c \
src/exec/builtin/ft_env.c \
src/exec/builtin/ft_export.c \
src/exec/builtin/ft_unset.c \
src/exec/environment.c \
src/parser/parser.c \
src/parser/AST/ast_visitor.c \
src/parser/AST/ast_visitor2.c \
src/parser/AST/ast_visitor3.c \
src/parser/AST/sanitizer.c \
src/parser/AST/ast.c \
src/parser/AST/node.c \
src/parser/AST/node2.c \
src/parser/AST/lexer.c \
src/parser/AST/lexer2.c \
OBJ_DIR = objs
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.c=.o))
CC = clang
CFLAGS = -Wall -Wextra -Werror -I third_party/libft -I include
DEBUG ?= false
MODE = "release"
TOOLCHAIN ?= clang
ifeq ($(TOOLCHAIN), gcc)
CC = gcc
endif
ifeq ($(DEBUG), true)
CFLAGS += -g -D DEBUG
MODE = "debug"
endif
RM = rm -rf
$(OBJ_DIR)/%.o: %.c
@echo "\e[1;32m[compiling "$(MODE)" {"$(CC)"}...]\e[1;00m "$<
@$(CC) $(CFLAGS) $(COPTS) -c $< -o $@
all: libft $(NAME)
libft:
@make -C third_party/libft
$(NAME): $(OBJ_DIR) $(OBJS)
@echo "\e[1;32m[linking "$(MODE)" {"$(CC)"}...]\e[1;00m "$@
@$(CC) -o $(NAME) $(OBJS) third_party/libft/libft.a -lreadline
@echo "\e[1;32m[build finished]\e[1;00m"
$(OBJ_DIR):
@mkdir -p $(sort $(addprefix $(OBJ_DIR)/, $(dir $(SRCS))))
clean:
@$(RM) $(OBJ_DIR)
fclean: clean
@$(RM) $(NAME)
re: fclean all
norminette:
norminette | grep Error | wc -l
.PHONY: all clean fclean re