-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (56 loc) · 1.27 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
NAME = pipex
CC = gcc
C_FLAGS = -Wall -Werror -Wextra -g
F_SAN = -g -fsanitize=address
SRC_FILES = pipex.c \
parsing.c \
error_handling.c \
children.c \
check_access.c
ifdef WITH_BONUS
SRC_FILES = pipex_bonus.c \
parsing_bonus.c \
error_handling_bonus.c \
children_bonus.c \
process_bonus.c \
init_bonus.c \
check_access_bonus.c \
free_bonus.c
endif
SRC_DIR = src
ifdef WITH_BONUS
SRC_DIR = bonus
endif
OBJ_DIR = obj
OBJ = $(addprefix $(OBJ_DIR)/, $(SRC_FILES:.c=.o))
INCLUDES = -Iinclude -Ilibft/include
LIBFT = libft/libft.a
all: $(NAME)
$(LIBFT):
@cd libft && make
$(NAME): $(OBJ) $(LIBFT)
@$(CC) $(C_FLAGS) $^ $(INCLUDES) -o $@
@echo pipex made!
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
@$(CC) $(C_FLAGS) $(INCLUDES) -c $< -o $@
bonus: fclean
@$(MAKE) WITH_BONUS=1 all
clean:
@rm -rf $(OBJ_DIR)
@$(MAKE) -C libft clean
@echo "cleaned!"
fclean: clean
@rm -rf $(NAME)
@echo "fcleaned!"
depclean:
@rm -rf $(LIBFT)
@echo "cleaned dependencies"
re: fclean all
rere: fclean depclean all
mem:
memdetect/memdetect.sh . $(GCC_FLAGS) $(LIBFT) $(INCLUDES) --exclude test.c try_outs.c bonus -a "infile cat \"wc -l\" outfile"
run: all
./pipex infile "cat" "ls -la" outfile
.PHONY: all re clean fclean bonus rere