-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (35 loc) · 1.09 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
NAME = pipex
CC = cc
CFLAGS = -Wall -Wextra -Werror $(INCLUDES)# -g3 -fsanitize=address,leak,undefined
RM = rm -f
LIBFT_DIR = ./libft
LIBFT = $(LIBFT_DIR)/libft.a
SRC = ./pipex.c ./src/pipex_errors.c ./src/pipex_exec.c ./src/pipex_path.c
OBJ = $(SRC:.c=.o)
NORMAL_FLAG = .built
BONUS_SRC =./pipex_bonus.c ./src_bonus/pipex_errors_bonus.c ./src_bonus/pipex_exec_bonus.c ./src_bonus/pipex_heredoc_bonus.c ./src_bonus/pipex_path_bonus.c
OBJ_BONUS = $(BONUS_SRC:.c=.o)
BONUS_FLAG = .bonus_built
INCLUDES = -I./includes -I$(LIBFT_DIR)/includes
all: $(NAME)
bonus: $(BONUS_FLAG)
$(BONUS_FLAG): $(LIBFT) $(OBJ_BONUS)
$(CC) $(CFLAGS) $(OBJ_BONUS) $(LIBFT) -o $(NAME)
$(RM) $(NORMAL_FLAG)
touch $(BONUS_FLAG)
$(LIBFT):
make -C $(LIBFT_DIR) --no-print-directory
$(NAME): $(LIBFT) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(LIBFT) -o $(NAME)
$(RM) $(BONUS_FLAG)
touch $(NORMAL_FLAG)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
make -C $(LIBFT_DIR) fclean --no-print-directory
$(RM) $(OBJ) $(OBJ_BONUS)
$(RM) $(NORMAL_FLAG) $(BONUS_FLAG)
fclean: clean
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re bonus