-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
115 lines (96 loc) · 3.15 KB
/
makefile
File metadata and controls
115 lines (96 loc) · 3.15 KB
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
105
106
107
108
109
110
111
112
113
114
115
# **************************************************************************** #
# #
# ::: :::::::: #
# makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: pmoghadd <pmoghadd@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/10/11 18:45:17 by pmoghadd #+# #+# #
# Updated: 2022/11/24 12:28:36 by pmoghadd ### ########.fr #
# #
# **************************************************************************** #
OBJ_DIR = object_files
CFLAGS = -Wall -Wextra -Werror -g
NAME = minishell
READLINE = -I $(HOME)/goinfre/.brew/opt/readline/include/ -L $(HOME)/goinfre/.brew/opt/readline/lib/ -lreadline
DEBUG = -fsanitize=address
LIBFT = ./libs/libft/
SRCS = ./srcs/parsing/parsing_brain.c \
./srcs/parsing/initialize.c \
./srcs/parsing/lexical_scan.c \
./srcs/parsing/expand.c \
./srcs/parsing/shell_split.c \
./srcs/parsing/utils.c \
./srcs/parsing/utils2.c \
./srcs/parsing/check_input.c \
./srcs/parsing/check_input_utils.c \
./srcs/parsing/quotes.c \
./srcs/execution/execution.c \
./srcs/execution/inout_files.c \
./srcs/execution/env_init.c \
./srcs/execution/env_utils.c \
./srcs/execution/path.c \
./srcs/execution/fds.c \
./srcs/builtins/cd.c \
./srcs/builtins/echo.c \
./srcs/builtins/env.c \
./srcs/builtins/exit.c \
./srcs/builtins/export.c \
./srcs/builtins/export_add.c \
./srcs/builtins/pwd.c \
./srcs/builtins/unset.c \
./srcs/main.c \
./srcs/error.c \
./srcs/free.c \
./srcs/welcome_msg.c
OBJS = $(SRCS:.c=.o)
NC := \033[0m
B_RED := \033[1;31m
RED := \033[0;31m
PURPLE := \033[0;35m
B_BLUE := \033[1;34m
BLUE := \033[0;34m
FLAGS_OS := -lreadline
SUBM_STATE := $(shell find libs/libft -type f)
ifeq ($(DEBUG),1)
FSAN = -fsanitize=address
else
FSAN =
endif
ifeq ($(SUBM_STATE),)
SUBM_FLAG = submodule
else
SUBM_FLAG =
endif
all: $(SUBM_FLAG) libft minishell
submodule:
@git submodule init
@git submodule update
%.o : %.c
@echo "$(B_BLUE)Compiling: $(BLUE)$(notdir $<) 🔨$(NC)"
@$(CC) $(CFLAGS) -c $< -o $@
banner:
@echo "\n${PURPLE}======== Minishell ========$(NC)"
libft:
@echo "\n${BLUE}======== Libft ========${NC}"
@$(MAKE) -C $(LIBFT)
$(NAME): banner $(OBJS)
@$(CC) $(FLAGS_OS) $(CFLAGS) $(ADDUSER) $(OBJS) $(LIBFT)libft.a $(READLINE) $(FSAN) -o $(NAME)
# $(CDIR) $(TESTER)
# @mkdir object_files
# @mv $(OBJS) object_files
# e: all
# ./$(NAME)
test:
gcc -Wall -Werror -Wextra -g srcs/lltest.c libs/libft/libft.a -fsanitize=address
clean:
@rm -f $(OBJS)
@echo "${B_RED}🧹 Cleaning: ${RED} object files $(NC)"
fclean: clean
@rm -f philo
@echo "${B_RED}🧹 Cleaning: ${RED} $(NAME)$(NC)"
re: fclean all
cd includes
# bash fix.sh
# cd ..
.PHONY: all clean fclean re banner $(NAME) libft e submodule