-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (50 loc) · 1.61 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
NAME = minishell
SRC = src
INC = include
OBJ = obj
LIB = lib
CC = clang
CFLAGS = -Wall -Wextra -Werror -Wpedantic -Wconversion
RM = rm -rf
FTDIR = libft
LIBFT = ft
MAKELIBFT = $(MAKE) -C $(FTDIR)
HFILES = tokenizer.h parse.h node.h exec.h minishell.h builtin.h
BUILTIN_C = cd.c echo.c env.c exit.c export.c pwd.c unset.c
PARSING_C = interpolation.c interpolation2.c parse.c syntax.c token.c\
tokenizer.c tokenizer_utils.c
EXEC_C = cmd.c exec.c pipe.c redir.c heredoc.c pipe_utils.c
CFILES = main.c node.c eprint.c environment.c signal_handlers.c
BUILTIN_DIR = $(SRC)/builtins
PARSING_DIR = $(SRC)/parsing
EXEC_DIR = $(SRC)/exec
BUILTIN_SRC = $(addprefix $(BUILTIN_DIR)/, $(BUILTIN_C))
PARSING_SRC = $(addprefix $(PARSING_DIR)/, $(PARSING_C))
EXEC_SRC = $(addprefix $(EXEC_DIR)/, $(EXEC_C))
OFILES = $(CFILES:.c=.o) $(BUILTIN_C:.c=.o) $(PARSING_C:.c=.o) $(EXEC_C:.c=.o)
HEADERS = $(addprefix $(INC)/, $(HFILES))
OBJS = $(addprefix $(OBJ)/, $(OFILES))
SRCS = $(addprefix $(SRC)/, $(CFILES)) $(BUILTIN_SRC) $(PARSING_SRC) $(EXEC_SRC)
VPATH = $(SRC) $(BUILTIN_DIR) $(PARSING_DIR) $(EXEC_DIR)
$(OBJ)/%.o: %.c
$(CC) $(CFLAGS) -I. -I$(INC) -c $< -o $@
all: CFLAGS += -O2 -DNDEBUG
all: $(NAME)
$(NAME): $(OBJ) $(OBJS)
@$(MAKELIBFT)
$(CC) $(OBJS) -L$(FTDIR) -l$(LIBFT) -L$(LIB) -lreadline -lcurses -o $(NAME)
$(OBJ):
@mkdir -p $(OBJ)
debug: CFLAGS += -g
debug: $(NAME)
clean:
@$(MAKELIBFT) clean
@$(RM) $(OBJS)
fclean: clean
@$(MAKELIBFT) fclean
@$(RM) $(NAME)
re: fclean all
norme:
@$(MAKELIBFT) norme
@norminette $(SRCS) $(HEADERS)
.PHONY: all clean fclean re norme debug