-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (45 loc) · 1.17 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
NAME = pipex
NAME_BONUS = pipex_bonus
CC = gcc
INCLUDE = -I include
HEADER = pipex.h
FLAGS = -Wall -Wextra -Werror
LIBA = libft
SRCS = $(addprefix src/,\
main.c fork.c pipex.c make_command.c)\
get_next_line/get_next_line.c\
get_next_line/get_next_line_utils.c\
SRCS_BONUS = $(addprefix bonus/,\
main_bonus.c fork_bonus.c pipex_bonus.c make_command_bonus.c)\
get_next_line/get_next_line.c\
get_next_line/get_next_line_utils.c\
OBJS = ${SRCS:.c=.o}
OBJS_BONUS =${SRCS_BONUS:.c=.o}
%.o: %.c
$(CC) -o $(FLAGS) ${INCLUDE} -c $< -o $(<:.c=.o)
all: $(NAME)
$(NAME): $(OBJS)
@make re -C libft
@cp $(LIBA)/libft.a ./$(NAME)
gcc -o $(NAME) $(OBJS) ${LIBA}/libft.a ${INCLUDE}
bonus: $(OBJS_BONUS)
@make re -C libft
@cp $(LIBA)/libft.a ./$(NAME)
gcc -o $(NAME_BONUS) $(OBJS_BONUS) ${LIBA}/libft.a ${INCLUDE}
clean:
rm -f $(OBJS)
@make clean -C libft
bonus_clean:
rm -f $(OBJS_BONUS)
@make clean -C libft
fclean:
rm -f $(OBJS) $(NAME)
@make fclean -C libft
fclean_bonus:
rm -f $(OBJS_BONUS) $(NAME_BONUS)
@make fclean -C libft
re: fclean all
re_bonus:
fclean_bonus bonus
.PHONY:
all bonus bonus_clean fclean_bonus clean fclean re re_bonus