-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (76 loc) · 2.77 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ayarmaya <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/07/02 21:28:06 by ayarmaya #+# #+# #
# Updated: 2024/10/10 02:50:00 by ayarmaya ### ########.fr #
# #
# **************************************************************************** #
NAME := minishell
CC := gcc
CFLAGS := -Wall -Wextra -Werror
RM := rm -f
RMDIR := rm -rf
LIBFT := libft/libft.a
UNAME_S := $(shell uname -s)
HEADERS := -I./include -Ilibft/include
LIBS := $(LIBFT) -lreadline -ltermcap
ifeq ($(UNAME_S), Darwin)
READLINE_PATH := $(shell brew --prefix readline)
HEADERS += -I$(READLINE_PATH)/include
LIBS += -L$(READLINE_PATH)/lib
endif
SRCDIR := src
SRCS := src/main.c \
src/init.c \
src/signal.c \
src/utils.c \
src/parsing/expand_variables.c \
src/parsing/parsing.c \
src/parsing/command_check_1.c \
src/parsing/command_check_2.c \
src/parsing/arguments.c \
src/parsing/instances.c \
src/parsing/addons.c \
src/parsing/utils_1.c \
src/parsing/utils_2.c \
src/parsing/utils_3.c \
src/exec/exec.c \
src/exec/fork_and_process.c \
src/exec/redirection.c \
src/exec/pipes.c \
src/exec/find_command_path.c \
src/exec/heredoc.c \
src/exec/utils.c \
src/builtin/builtin.c \
src/builtin/cd.c \
src/builtin/echo.c \
src/builtin/env.c \
src/builtin/exit.c \
src/builtin/export.c \
src/builtin/pwd.c \
src/builtin/unset.c \
src/builtin/handle_var_env/cd_env.c \
src/builtin/handle_var_env/export_update_env.c \
src/builtin/handle_var_env/unset_remove_env_var.c \
OBJDIR := obj
OBJS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SRCS))
all : $(NAME)
$(NAME) : $(OBJS) $(LIBFT)
$(CC) $(OBJS) $(LIBS) -o $(NAME)
$(LIBFT) :
make -C libft
$(OBJDIR)/%.o : $(SRCDIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(HEADERS) -c $< -o $@
clean:
$(RMDIR) $(OBJDIR)
make -C libft clean
fclean : clean
$(RM) $(NAME)
make -C libft fclean
re : fclean all
.PHONY : all clean fclean re