-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
106 lines (87 loc) · 3.95 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
105
106
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rcastelo <rcastelo@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/02/05 15:32:17 by rlandolt #+# #+# #
# Updated: 2024/03/21 12:37:47 by rcastelo ### ########.fr #
# #
# **************************************************************************** #
NAME = minishell
SRC_PATH = ./sources
SRC = $(SRC_PATH)/main.c \
$(SRC_PATH)/Parsing/shell_split/shell_split.c \
$(SRC_PATH)/Parsing/check_analyzer/check_analyzer.c \
$(SRC_PATH)/Parsing/string_expander/string_expander.c \
$(SRC_PATH)/Parsing/string_contracter/string_contracter.c \
$(SRC_PATH)/Parsing/string_utils/split.c \
$(SRC_PATH)/Parsing/token_type/classify_token.c \
$(SRC_PATH)/Parsing/token_type/tok_array.c \
$(SRC_PATH)/Parsing/tokenize/tokenize.c \
$(SRC_PATH)/Parsing/tokens_check/tokens_check.c \
$(SRC_PATH)/Setup/create_pipes/create_pipes.c \
$(SRC_PATH)/Setup/obtain_commands/obtain_commands.c \
$(SRC_PATH)/Setup/obtain_documents/obtain_read_documents.c \
$(SRC_PATH)/Setup/obtain_documents/obtain_write_documents.c \
$(SRC_PATH)/Setup/obtain_operators/obtain_operators.c \
$(SRC_PATH)/Setup/list_process_ids/list_process_ids.c \
$(SRC_PATH)/Utils/string_utils/string_utils.c \
$(SRC_PATH)/Utils/string_utils/string_utils2.c \
$(SRC_PATH)/Utils/string_utils/str_fd.c \
$(SRC_PATH)/Utils/string_utils/itoa.c \
$(SRC_PATH)/Utils/get_next_line/get_next_line.c \
$(SRC_PATH)/Utils/get_next_line/get_next_line_utils.c \
$(SRC_PATH)/Utils/free_all/free_session.c \
$(SRC_PATH)/Utils/prints/print_session.c \
$(SRC_PATH)/Utils/string_utils/str_sort.c \
$(SRC_PATH)/Tasks/Builtins/builtin_exec/builtin_writeto.c \
$(SRC_PATH)/Task/ambient_variable_expansion/ambient_variable_expansion.c \
$(SRC_PATH)/Tasks/organize_after_expansion/organize_after_expansion.c \
$(SRC_PATH)/Tasks/check_commands/check_bin_path.c \
$(SRC_PATH)/Tasks/check_commands/checkbin_utils.c \
$(SRC_PATH)/Tasks/perform_tasks/perform_tasks.c \
$(SRC_PATH)/Tasks/close_opened_fds/close_opened_fds.c \
$(SRC_PATH)/Tasks/open_taskfiles/open_taskfiles.c \
$(SRC_PATH)/Tasks/clean_quotes/clean_quotes.c \
$(SRC_PATH)/Tasks/perform_redirects/perform_redirects.c \
$(SRC_PATH)/Tasks/Builtins/check_builtin/check_builtin.c \
$(SRC_PATH)/Tasks/Builtins/chgdir/chgdir.c \
$(SRC_PATH)/Tasks/Builtins/chgdir/setup_cd.c \
$(SRC_PATH)/Tasks/Builtins/env/menvp.c \
$(SRC_PATH)/Tasks/Builtins/env/menvp_input.c \
$(SRC_PATH)/Tasks/Builtins/env/menvp_utils.c \
$(SRC_PATH)/Tasks/Builtins/env/parse_export.c \
$(SRC_PATH)/Tasks/Builtins/env/export_operations.c \
$(SRC_PATH)/Tasks/Builtins/echo/echo.c \
$(SRC_PATH)/Tasks/Builtins/exit/exit.c \
$(SRC_PATH)/Signals/received_signals/received_signals.c\
$(SRC_PATH)/Signals/main_signals/main_signals.c\
$(SRC_PATH)/Signals/task_signals/task_signals.c\
$(SRC_PATH)/Signals/ignore_signals/ignore_signals.c\
SANITIZER = -g -fsanitize=address
CC = cc
CFLAGS = -Wall -Wextra -Werror
OBJ =$(addprefix objects/, $(notdir $(SRC:.c=.o)))
all: $(NAME)
$(NAME): $(OBJ)
$(CC) $(CFLAGS) -o $(NAME) $(OBJ) -lreadline
objects/%.o: */%.c| objects
cc $(CFLAGS) -c $< -o $@
objects/%.o: */*/*/%.c | objects
cc $(CFLAGS) -c $< -o $@
objects/%.o: */*/*/*/%.c | objects
cc $(CFLAGS) -c $< -o $@
objects:
mkdir objects
print-%:
@echo $* = $($*)
clean:
rm -rf $(OBJ) objects
fclean: clean
rm -f $(NAME)
debug: CFLAGS += ${SANITIZER}
debug: re
re: fclean all
.PHONY: all, clean, fclean, re