-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·62 lines (44 loc) · 1.02 KB
/
Copy pathMakefile
File metadata and controls
executable file
·62 lines (44 loc) · 1.02 KB
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
NAME := pipex
OBJ_DIR := ./obj
SRC_DIR := ./src
INC_DIR := ./include \
./libft/include
CFLAGS = -Wextra -Wall -Werror
ifdef DEBUG
CFLAGS +=-g
endif
INCLUDE := $(addprefix -I,$(INC_DIR))
LIBS := ./libft/libft.a
SRCS := command.c \
error_handling.c \
heredoc.c \
main.c \
pipeloop.c \
pipex_utils.c \
pipex_split.c \
OBJS := $(addprefix $(OBJ_DIR)/,$(SRCS:.c=.o))
DEP := $(OBJS:%.o=%.d)
#===============================================#
#=================== RECIPES ===================#
#===============================================#
-include $(DEP)
all: $(NAME)
$(OBJ_DIR):
mkdir -p $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
$(NAME): $(OBJS)
$(MAKE) -C ./libft
$(CC) $(CFLAGS) $(OBJS) $(LIBS) $(HEADERS) -o $(NAME)
clean:
@rm -rf $(OBJ_DIR)
@$(MAKE) -C ./libft clean
fclean: clean
@rm -f $(NAME)
@$(MAKE) -C ./libft fclean
re: clean all
debug:
$(MAKE) DEBUG=1
rebug: fclean
$(MAKE) debug
.PHONY: all, clean, fclean, re