-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·73 lines (60 loc) · 2.1 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
67
68
69
70
71
72
73
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: f██████ <f██████@student.42lyon.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/01/03 12:33:02 by f██████ #+# #+# #
# Updated: 2022/04/09 17:02:53 by f██████ ### ########lyon.fr #
# #
# **************************************************************************** #
SRC_DIR = ./sources
INC_DIR = ./includes
NAME = pipex
NAME_BONUS = pipex_bonus
CC = gcc
FLAGS = -Wall -Wextra -Werror #-fsanitize=address
HEADER_FILE = $(INC_DIR)/pipex.h
LIBFT_PATH = ./libft/libft.a
SRCS = $(addprefix $(SRC_DIR)/, \
main.c \
init_struct.c \
pipe_exec.c \
step_exec.c \
analyze_input.c \
analyze_output.c \
analyse_cmds.c \
path_tools.c \
here_doc.c \
error.c \
cleaning.c \
)
SRCS_BONUSOFF = $(addprefix $(SRC_DIR)/, \
bonus_off.c \
)
SRCS_BONUSON = $(addprefix $(SRC_DIR)/, \
bonus_on.c \
)
OBJS = $(SRCS:.c=.o)
OBJS_BONUSOFF = $(SRCS_BONUSOFF:.c=.o)
OBJS_BONUSON = $(SRCS_BONUSON:.c=.o)
all: lib $(NAME) $(NAME_BONUS)
$(NAME) : $(OBJS) $(OBJS_BONUSOFF) $(LIBFT_PATH)
$(CC) $(FLAGS) $(OBJS) $(OBJS_BONUSOFF) $(LIBFT_PATH) -o $(NAME)
%.o: %.c $(HEADER_FILE)
$(CC) $(FLAGS) -c $< -o $@ -I $(INC_DIR)
bonus: lib $(NAME_BONUS)
$(NAME_BONUS) : $(OBJS) $(OBJS_BONUSON) $(LIBFT_PATH)
$(CC) $(FLAGS) $(OBJS) $(OBJS_BONUSON) $(LIBFT_PATH) -o $(NAME_BONUS)
clean:
make clean -C ./libft
rm -f $(OBJS) $(OBJS_BONUSOFF) $(OBJS_BONUSON)
fclean: clean
make fclean -C ./libft
rm -f $(NAME)
rm -f $(NAME_BONUS)
re: fclean all
lib:
make -C ./libft
.PHONY: all bonus clean fclean re lib