-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (102 loc) · 3.9 KB
/
Makefile
File metadata and controls
129 lines (102 loc) · 3.9 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jveirman <jveirman@student.s19.be> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/11/12 02:13:09 by jveirman #+# #+# #
# Updated: 2024/11/14 15:17:33 by jveirman ### ########.fr #
# #
# **************************************************************************** #
NAME = minishell
CC = gcc
RM = rm -rf
OUT = -o $(NAME)
# CFLAGS = -Wall -Wextra -Werror
CFLAGS = -Wall -Wextra -Werror -g -fsanitize=address
LIBFT = ./libft/libft.a
HEADER = ./includes/minishell.h
ifeq ($(shell uname), Linux)
else
CFLAGS += -I ~/.brew/opt/readline/include
LDFLAGS = -L ~/.brew/opt/readline/lib
endif
BUILT_IN = chdir chdir_utils echo env exit export_utils export pwd unset utils
EXEC = error exec_utils exec_utils2 exec here_doc_utils here_doc pipes redirection path_check
EXPANDER = expander special_variables
PARSING = cmd_array_builder parsing parse_utils parse_token_redirection parse_token_word
MINISHELL = env_utils exit main prompt check_cmd_line_structure check_cmd_line_utils init_shell free_helper global_utils
SIGNAL = listener
TOKEN = token_utils tokenizer handle_all_token_types
SRCS = $(addsuffix .c, $(addprefix sources/built_in/, $(BUILT_IN))) \
$(addsuffix .c, $(addprefix sources/exec/, $(EXEC))) \
$(addsuffix .c, $(addprefix sources/expander/, $(EXPANDER))) \
$(addsuffix .c, $(addprefix sources/parsing/, $(PARSING))) \
$(addsuffix .c, $(addprefix sources/shell/, $(MINISHELL))) \
$(addsuffix .c, $(addprefix sources/signal/, $(SIGNAL))) \
$(addsuffix .c, $(addprefix sources/token/, $(TOKEN)))
OBJS = $(SRCS:c=o)
#----------------- DEPENDENCIES ----------------#
MKFILES = art.mk
include $(MKFILES)
#===================================================================#
# TARGETS #
#===================================================================#
.SILENT:
.PHONY: help all art re clean fclean check-os dev redev run
all: check-os $(NAME)## Command to start all the compiling
clear
make art
dev: check-os $(NAME) job_s_done run## Command to start all the compiling with art skip
$(NAME): $(OBJS)
echo
make --no-print-directory all -C libft
$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(LIBFT) -lreadline -lncurses $(LDFLAGS)
job_s_done:
echo "\n\033[0;32mDone !\033[0m"
%.o: %.c
printf "Generating minishell objects:\t %-33.33s\r" $@
${CC} ${CFLAGS} -c $< -o $@
clean:
make --no-print-directory clean -C libft
printf "Libft simple clean: \033[0;32m✅\033[0m\n"
$(RM) $(OBJS)
printf "Minishell simple clean: \033[0;32m✅\033[0m\n"
echo "\033[0m"
fclean:
make --no-print-directory fclean -C libft/
printf "Libft full clean: \033[0;32m✅\033[0m\n"
$(RM) $(OBJS)
$(RM) $(NAME)
printf "Minishell full clean: \033[0;32m✅\033[0m"
echo
re: fclean all
redev: fclean dev
run:
./minishell
art: loading ## ASCII art for minishell
clear
echo $(ART_AFTER_COMPILE)
loading:
@ current_index=0; \
main_index=0; \
echo; \
for current_line in $(FULL_LINE); do \
for line in $(FULL_LINE); do \
printf "$$line"; \
sleep 0.01; \
current_index=$$((current_index + 1)); \
if [ $$current_index -eq 10 ]; then \
break; \
fi; \
done; \
current_index=0; \
printf "$$current_line"; \
main_index=$$((main_index + 1)); \
if [ $$main_index != 27 ]; then \
printf "\n"; \
fi; \
done
check-os:
echo "OS detected: $(shell uname)"