-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
66 lines (56 loc) · 2.65 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: haryu <haryu@student.42seoul.kr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/06/02 18:36:54 by haryu #+# #+# #
# Updated: 2022/07/06 18:52:03 by cgim ### ########.fr #
# #
# **************************************************************************** #
NAME = minishell
MAKE = make
CC = gcc
CFLAGS = -Wall -Werror -Wextra
SRCS_DIR = ./src/
SRCS := $(wildcard $(SRCS_DIR)*.c)
INCLUDES_DIR = ./includes/
LIB_DIR = ./library/
OBJS := $(SRCS:.c=.o)
LIBFT_DIR = ${addprefix $(LIB_DIR), libft/}
LIBFT_AFILE = libft.a
LIBFTA = ${addprefix $(LIBFT_DIR), $(LIBFT_AFILE)}
READLINE_INCLUDE_DIR = ${addprefix $(INCLUDES_DIR), readline}
sky :=$(shell tput setaf 6)
reset :=$(shell tput sgr0)
all : $(NAME)
clean :
$(MAKE) clean -C $(LIBFT_DIR)
@rm -rf $(SRCS_DIR)*.o
@rm -rf $(SRCS_DIR)*.dSYM
@rm -rf ./temp
$(info $(shell tput setaf 1)============= $(NAME) clean =============$(reset))
fclean :
$(MAKE) fclean -C $(LIBFT_DIR)
@rm -rf $(SRCS_DIR)*.o
@rm -rf $(SRCS_DIR)*.dSYM
@rm -rf $(NAME)
@rm -rf ./temp
$(info $(shell tput setaf 1)============= $(NAME) fclean =============$(reset))
re :
make fclean
make all
$(info $(shell tput setaf 1)============= $(NAME) recompile =============$(reset))
debug :
make all CFLAGS+="-Wall -Werror -Wextra -g3 -fsanitize=address"
%.o :%.c
$(CC) $(CFLAGS) -I $(INCLUDES_DIR) -I $(READLINE_INCLUDE_DIR) -I $(LIBFT_DIR) -c $< -o $@
$(NAME) : $(OBJS)
$(info $(shell tput setaf 1)============= $(NAME) =============$(reset))
$(MAKE) bonus -C $(LIBFT_DIR)
$(info $(sky)============= libft.a =============$(reset))
$(CC) $(CFLAGS) $(LDFLAGS) -I$(INCLUDES_DIR) -I$(READLINE_INCLUDE_DIR) -I$(LIBFT_DIR) $(LIBFTA) -lreadline $^ -o $@
$(info $(shell tput setaf 1)============= $(NAME) =============$(reset))
@sh makefolder.sh
.PHONY : all bonus clean fclean re debug