-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
61 lines (48 loc) · 1.39 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
#SETUP
NAME = pipex
CC = gcc
FLAGS = -Wall -Wextra -Werror
RM = rm -rf
#FILES AND PATH
HEADER_SRCS = pipex.h pipex_bonus.h
HEADER_DIR = includes/
HEADER = $(addprefix $(HEADER_DIR), $(HEADER_SRCS))
MPATH_SRCS = pipex.c childs.c error.c free.c
MPATH_DIR = mandatory/
MPATH = $(addprefix $(MPATH_DIR), $(MPATH_SRCS))
OBJ_M = $(MPATH:.c=.o)
BPATH_SRCS = pipex_bonus.c error_bonus.c here_doc_bonus.c\
files_bonus.c free_bonus.c child_bonus.c
BPATH_DIR = bonus/
BPATH = $(addprefix $(BPATH_DIR), $(BPATH_SRCS))
OBJ_B = $(BPATH:.c=.o)
FUNC_SRCS = ft_strncmp.c ft_strdup.c ft_split.c ft_strjoin.c
FUNC_DIR = functions/
FUNC = $(addprefix $(FUNC_DIR), $(FUNC_SRCS))\
gnl/get_next_line_utils.c gnl/get_next_line.c
OBJ_F = $(FUNC:.c=.o)
#COMMANDS
%.o: %.c $(HEADER) Makefile
@${CC} ${FLAGS} -c $< -o $@
$(NAME): $(OBJ_F) $(OBJ_M)
@$(CC) $(OBJ_F) $(OBJ_M) -o $(NAME)
@echo -e "$(GREEN)$(NAME) created!$(DEFAULT)"
all: $(NAME)
bonus: $(OBJ_F) $(OBJ_B)
@$(CC) $(OBJ_F) $(OBJ_B) -o $(NAME)
@echo -e "$(GREEN)$(NAME) created!$(DEFAULT)"
clean:
@$(RM) $(OBJ_M)
@$(RM) $(OBJ_F)
@$(RM) $(OBJ_B)
@echo -e "$(YELLOW)object files deleted!$(DEFAULT)"
fclean: clean
@$(RM) $(NAME)
@echo -e "$(RED)all deleted!$(DEFAULT)"
re: fclean all
.PHONY: all clean fclean bonus re
#COLORS
RED = \033[1;31m
GREEN = \033[1;32m
YELLOW = \033[1;33m
DEFAULT = \033[0m