-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (56 loc) · 2.4 KB
/
Makefile
File metadata and controls
62 lines (56 loc) · 2.4 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
NAME = minishell
CC = cc
CFLAGS = -g -Wall -Werror -Wextra #-fsanitize=address
SRCPATH = src/
LIBFTPATH = ./libft
SRC = $(addprefix $(SRCPATH), main.c parser/utils_prep.c utils.c parser/load_tokens.c parser/content_analyse.c\
parser/syntax.c \
lexer/lexer.c lexer/lexer_utils1.c lexer/lexer_utils2.c parser/parser.c \
parser/parser_utils.c parser/parser_utils_2.c parser/parser_utils_3.c \
executer/executer.c executer/executer_redirections.c executer/input_handling.c executer/executer_utils.c expander/expander.c\
expander/expander_utils.c expander/expander_utils2.c expander/expander_varinvar.c parser/get_path.c /executer/builtins/built_in.c executer/builtins/built_in_utils.c \
executer/builtins/env.c executer/builtins/echo.c executer/builtins/echo_utils.c executer/builtins/export.c \
executer/builtins/export_utils.c executer/builtins/unset.c executer/builtins/cd.c executer/builtins/pwd.c executer/builtins/exit.c signals.c)
OBJ = $(addprefix _bin/,$(notdir $(SRC:.c=.o)))
DOWNLOADFOLDER = dwnlds
INCFLAG = -Iinclude -Ilibft -I$(DOWNLOADFOLDER)/readline_out/include
LINK = -lreadline -Llibft -lft -L$(DOWNLOADFOLDER)/readline_out/lib
LIBFT = ./libft/libft.a
all: $(NAME)
#-L$(DOWNLOADFOLDER)/readline_out/lib
$(NAME): $(SRC) $(LIBFT) $(DOWNLOADFOLDER)
$(CC) $(CFLAGS) $(SRC) $(INCFLAG) -o $(NAME) $(LINK)
LSANLIB = /LeakSanitizer/liblsan.a
lsan: CFLAGS += -ILeakSanitizer -Wno-gnu-include-next
lsan: LINK += -LLeakSanitizer -llsan -lc++
lsan: fclean $(LSANLIB)
lsan: all
$(LSANLIB):
@if [ ! -d "LeakSanitizer" ]; then git clone https://github.com/mhahnFr/LeakSanitizer.git; fi
@$(MAKE) -C LeakSanitizer
s: $(NAME)
./$(NAME)
clean:
rm -f $(OBJ)
make clean -C $(LIBFTPATH)
fclean: clean
rm -f ./$(NAME)
make fclean -C $(LIBFTPATH)
re: fclean
$(MAKE) all
$(LIBFT):
@git submodule init libft
@git submodule update libft
@cd libft && make && make clean
$(DOWNLOADFOLDER):
mkdir -p $(DOWNLOADFOLDER)
curl -s https://ftp.gnu.org/gnu/readline/readline-8.1.2.tar.gz --output $(DOWNLOADFOLDER)/readline-8.1.2.tar.gz
tar xfz $(DOWNLOADFOLDER)/readline-8.1.2.tar.gz -C $(DOWNLOADFOLDER)
cd $(DOWNLOADFOLDER)/readline-8.1.2; ./configure --prefix=$(PWD)/dwnlds/readline_out; cd ../../
make -C $(DOWNLOADFOLDER)/readline-8.1.2
make install -C $(DOWNLOADFOLDER)/readline-8.1.2
$(LSAN):
git clone https://github.com/mhahnFr/LeakSanitizer.git
$(LSANLIB): $(LSAN)
$(MAKE) -C LeakSanitizer
.PHONY: all, run, clean, fclean, re