-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (64 loc) · 2.27 KB
/
Makefile
File metadata and controls
76 lines (64 loc) · 2.27 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
# Project: minishell
#______command and their flags______#
RM = rm -rf
CFLAGS = -Wall -Wextra -Werror
#______directories______#
OBJ_DIR = obj
SRC_DIR = src
INCLUDES = -Iincludes
ifeq ($(shell uname), Linux)
INC = -L/usr/local/lib -I/usr/local/include -lreadline
endif
ifeq ($(shell uname), Darwin)
INC = -lreadline -I$(HOME)/readline/include/readline -L$(HOME)/readline/lib
INCP = -I$(HOME)/readline/include/readline
endif
LIB_INCLUDES = -Ilibft/includes
#______colors______#
GREEN = \033[0;32m
RED = \033[0;31m
YELLOW = \033[0;33m
BLUE = \033[0;34m
CYAN = \033[0;36m
BOLD = \033[1m
NC = \033[0m
#______mandatory and bonus files______#
FILES = main.c tokenizing.c ft_ownsplit.c check_errors.c signals.c syntax_error.c\
expanding.c here_doc.c here_doc_norm.c list_of_cmds.c list_of_cmds_norm.c\
create_env.c garbage_collector.c builtins.c exec.c syntax_error_norm.c\
expanding_norm.c expanding_norm_two.c open_files.c ft_ownsplit.c\
ft_ownsplit_norm.c ft_ownsplit_count.c ft_ownsplit_tools.c path_init.c\
exec_utils.c builtin_unset.c builtin_export.c builtin_echo.c builtin_exit.c\
builtin_pwd.c builtin_cd.c builtin_env.c set_reset_io.c signals_processes.c
#______patterns and substitutions______#
SOURCES = $(FILES:%.c=$(SRC_DIR)/%.c)
OBJECTS = $(SOURCES:$(SRC_DIR)%.c=$(OBJ_DIR)%.o)
#______static library name______#
NAME = minishell
LIB = libft
#______________Rules______________#
$(NAME): $(OBJECTS) $(LIB)/libft.a
@$(CC) $(CFLAGS) $^ $(INCLUDES) $(LIB_INCLUDES) $(INC) -o $@ #-fsanitize=address
@echo "${GREEN}${BOLD}minishell is ready ✅${NC}"
# impicit rule for mandatory
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(OBJ_DIR)
@$(CC) $(CFLAGS) -c $< $(INCLUDES) $(LIB_INCLUDES) $(INC) -o $@ 2> /dev/null || $(CC) $(CFLAGS) -c $< $(INCLUDES) $(LIB_INCLUDES) $(INCP) -o $@
@echo "${GREEN}compiling ...⏳ ${RED}{${CYAN}$<${RED}}${NC}"
$(LIB)/%.a:
@echo "${YELLOW}${BOLD}compiling libft ...⏳${NC}"
@$(MAKE) all -C $(LIB)
re: fclean all
all: $(NAME)
bonus:
@echo "${RED}${BOLD}No Bonus turned on 👌${NC}"
#______cleaning______#
clean:
@echo "${RED}${BOLD}cleaning ...🧹${NC}"
@$(RM) $(OBJ_DIR)
@$(MAKE) -C $(LIB) fclean
@echo "${GREEN}${BOLD}cleaned ✅${NC}"
fclean: clean
@echo "${RED}${BOLD}fleaning ...🧹${NC}"
@$(RM) $(NAME)
@echo "${GREEN}${BOLD}fcleaned ✅${NC}"