-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (66 loc) · 2.59 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
74
75
76
77
78
79
SRC_BONUS_DIR = src_bonus
BUILD_BONUS_DIR = build_bonus
SRC_DIR = src
BUILD_DIR = build
NAME = pipex
CFLAG = -Wall -Wextra -Werror -I./includes/ -g3
SRC_MAIN = ./bin/main/main.c \
./bin/pipex/bonus.c \
./bin/pipex/pipex.c \
./bin/print/print.c \
./bin/print/ft_printf.c \
./bin/print/print_functions.c \
./bin/print/print_functions2.c \
./bin/print/utils.c \
./bin/setup/args.c \
./bin/setup/setup.c \
./bin/setup/env.c \
./bin/utils/bool.c \
./bin/utils/exec.c \
./bin/utils/free.c \
./bin/utils/path.c \
./bin/utils/split.c \
./bin/utils/utils.c \
./bin/utils/get_next_line.c \
./bin/utils/get_next_line_utils.c \
SRC_BONUS = ./bin/main/main_bonus.c \
./bin/pipex/bonus.c \
./bin/pipex/pipex.c \
./bin/print/print.c \
./bin/print/ft_printf.c \
./bin/print/print_functions.c \
./bin/print/print_functions2.c \
./bin/print/utils.c \
./bin/setup/args.c \
./bin/setup/setup.c \
./bin/setup/env.c \
./bin/utils/bool.c \
./bin/utils/exec.c \
./bin/utils/free.c \
./bin/utils/path.c \
./bin/utils/split.c \
./bin/utils/utils.c \
./bin/utils/get_next_line.c \
./bin/utils/get_next_line_utils.c \
OBJ_MAIN = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRC_MAIN))
OBJ_BONUS = $(patsubst $(SRC_BONUS_DIR)/%.c, $(BUILD_BONUS_DIR)/%.o, $(SRC_BONUS))
CC = cc
all: $(NAME)
$(NAME): $(OBJ_MAIN)
@mkdir -p $(dir $@)
$(CC) $(OBJ_MAIN) -o $(NAME) $(CFLAG)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAG) -c $< -o $@
bonus: $(OBJ_BONUS)
@mkdir -p $(dir $(NAME))
$(CC) $(OBJ_BONUS) -o $(NAME) $(CFLAG)
$(BUILD_BONUS_DIR)/%.o: $(SRC_BONUS_DIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAG) -c $< -o $@
clean:
@rm -rf $(BUILD_DIR) $(BUILD_BONUS_DIR)
fclean: clean
@rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re