-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (74 loc) · 2.42 KB
/
Makefile
File metadata and controls
95 lines (74 loc) · 2.42 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hrothery <hrothery@student.42wolfsburg.de> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/01/21 15:18:52 by cfabian #+# #+# #
# Updated: 2022/05/20 10:41:17 by hrothery ### ########.fr #
# #
# **************************************************************************** #
NAME = minishell
SRC = src
SRCS = $(SRC)/builtins.c \
$(SRC)/builtin_parser.c \
$(SRC)/builtin_utils.c \
$(SRC)/env_list.c \
$(SRC)/error_msg.c \
$(SRC)/exec_utils.c \
$(SRC)/export.c \
$(SRC)/export_list.c \
$(SRC)/free.c \
$(SRC)/gnl_delimit.c \
$(SRC)/heredoc.c \
$(SRC)/init_export_list.c \
$(SRC)/lexer.c \
$(SRC)/list_to_string.c \
$(SRC)/main.c \
$(SRC)/parser.c \
$(SRC)/piping.c \
$(SRC)/quotes_and_envvars.c \
$(SRC)/redirection.c \
$(SRC)/signals.c \
$(SRC)/unset.c
OBJ = obj
OBJS = $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SRCS))
CC = gcc
RL_MAC = -I $(HOME)/goinfre/.brew/opt/readline/include/ -L $(HOME)/goinfre/.brew/opt/readline/lib/
CFLAGS = -Wall -Werror -Wextra
RM = rm -f
LIB = libft.a
INCLUDES = minishell.h libft.h
all: $(NAME)
fix:
./fix.sh
$(OBJ):
mkdir $(OBJ)
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ)
@$(CC) $(CFLAGS) -c $< -o $@ -g
ifeq ($(shell uname), Linux)
$(NAME): $(LIB) $(OBJS)
$(CC) $(OBJS) $(LIB) -g -o $(NAME) -lreadline $(CFLAGS)
endif
ifeq ($(shell uname), Darwin)
$(NAME): $(LIB) $(OBJS)
$(CC) $(OBJS) $(LIB) -g -o $(NAME) -lreadline $(CFLAGS) $(RL_MAC)
endif
$(LIB):
@make -C ./libft/
mv ./libft/$(LIB) ./$(LIB)
cp ./libft/libft.h ./libft.h
clean:
$(RM) $(OBJ)/*
$(RM) $(NAME)
fclean: clean
$(RM) $(NAME) $(LIB)
make -C libft fclean
re: fclean all
norm:
@norminette $(SRC)/*.c $(INCLUDES)
@make norm -C ./libft/
memcheck: all
valgrind --leak-check=full ./minishell
.PHONY: all clean fclean re norm memcheck