-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (30 loc) · 1.07 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
NAME = minishell
SRC = main.c builtins.c utils.c expander.c ft_countwords1.c ft_split1.c ft_createlist.c ft_subsplit.c env.c executor.c ft_ischarofset.c ft_trimone.c \
reader.c reader_utils.c reader_utils2.c gnl.c expander2.c cmdlst_create.c cmdlst_utils.c exec_cmd.c redirect.c utils2.c debug.c free_exit.c cmdlst_utils2.c utils3.c
SRC_DIR = ./Src/
OBJ_DIR = ./Src/.obj/
SRCP = $(addprefix $(SRC_DIR),$(SRC))
OBJP = $(addprefix $(OBJ_DIR),$(notdir $(SRCP:.c=.o)))
CFLAGS = -Wall -Wextra -Werror -fPIE -g
LIB = ./Src/MyLib/mylib.a
all: lib $(NAME)
lib:
@echo "\033[32mCompiling $(NAME) 🚀"
make -s -C Src/MyLib
$(OBJ_DIR)%.o: $(SRC_DIR)%.c
@mkdir -p $(OBJ_DIR)
@$(CC) $(CFLAGS) -c $< -o $@
$(NAME): $(OBJP)
@gcc $(CFLAGS) $(OBJP) $(LIB) -lreadline -o $(NAME)
@echo "Compiled ✅\033[0;37m"
clean:
@echo "\033[0;31mCleaning objects 🧹"
@rm -rf $(OBJ_DIR)
@make clean -s -C Src/MyLib
fclean: clean
@echo "\033[0;31mRemoving $(NAME) 🗑\033[0;37m"
@rm -rf $(NAME)
@make fclean -s -C Src/MyLib
re: fclean all
.SILENT: $(OBJ) lib
.PHONY: all lib clean fclean re