-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (56 loc) · 1.7 KB
/
Makefile
File metadata and controls
72 lines (56 loc) · 1.7 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
NAME := microshell
# BUILTIN_DIR := src/builtin/
# ENV_DIR := src/env/
# EXEC_DIR := src/exec/
# EXPANDER_DIR := src/expander/
# LEXER_DIR := src/lexer/
LIST_SRCS := minishell.c \
$(wildcard $(BUILTIN_DIR)*.c) \
$(wildcard $(ENV_DIR)*.c) \
$(wildcard $(EXEC_DIR)*.c) \
$(wildcard $(EXPANDER_DIR)*.c) \
$(wildcard $(LEXER_DIR)*.c)
SRC_DIRS := src/ src/builtin/ src/env/ src/lexer/ src/exec/ src/expander/
OBJ_DIR := obj/
INC_DIR := inc/
SRCS := minishell.c \
echo.c cd.c env.c exit.c export.c pwd.c unset.c \
command_executor.c env_lst_to_array.c util.c \
lexer.c lexer_helper.c lexer_util.c \
expander.c expander_helper.c expander_util.c \
env_lst.c\
OBJS := $(addprefix $(OBJ_DIR), $(SRCS:.c=.o))
# INCS := $(addprefix $(INC_DIR),$(LIST_SRCS:.c=.h))
LIBFT_DIR := src/libft
LIBFT := $(LIBFT_DIR)/libft.a
CC := cc
CFLAGS := -Wall -Wextra -Werror
#DEBUG_FLAGS := -g -fsanitize=address
LDFLAGS := -lreadline
IFLAGS := -I$(LIBFT_DIR)/include -I$(INC_DIR)
ERASE := \033[2K\r
PINK := \033[35m
BLUE := \033[34m
GREEN := \033[32m
END := \033[0m
all: $(NAME)
$(OBJ_DIR)%.o: $(SRC_DIRS)%.c
@$(CC) $(CFLAGS) $(IFLAGS) $(LDFAGS) -c $< -o $@
@printf "$(ERASE)$(BLUE) > Compilation :$(END) $<"
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)
$(LIBFT):
@$(MAKE) -C $(LIBFT_DIR)
$(NAME): $(LIBFT) $(OBJ_DIR) $(OBJS)
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(LDFLAGS) $(IFLAGS) -o $(NAME) $(OBJS) $(LIBFT)
@printf "$(ERASE)$(GREEN)$@ made\n$(END)"
clean:
@rm -rf $(OBJ_DIR)
@$(MAKE) -C $(LIBFT_DIR) clean
@printf "$(PINK)remove obj dir\n$(END)"
fclean: clean
@rm -f $(NAME)
@$(MAKE) -C $(LIBFT_DIR) fclean
@printf "$(PINK)remove lib.a\n$(END)"
re: fclean all
.PHONY: all clean fclean re