-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (57 loc) · 1.44 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
INCLUDE = -I ./includes
SOURCE = ./source/
SOURCE_UTILS = utils/
PIPE_UTILS = pipe_utils/
CFLAGS = -Wall -Wextra -Werror -g
P_UTILS = $(addprefix $(PIPE_UTILS), \
pipex_utils.c path_utils.c \
error_pipex.c free_pipex.c \
init.c shell.c init_arg.c convert.c \
)
UTILS = $(addprefix $(SOURCE_UTILS), \
ft_memcmp.c ft_strdup.c ft_strtjoin.c ft_strjoin.c ft_split.c \
ft_strlen.c ft_substr.c ft_strchr.c ft_strrchr.c ft_putstr_fd.c \
ft_strnstr.c ft_strtrim.c \
)
SRC = $(addprefix $(SOURCE), \
$(P_UTILS) $(UTILS)\
ft_pipex.c \
)
.c.o:
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
OBJ = $(SRC:%.c=%.o)
all: $(NAME)
$(NAME): $(OBJ)
rm -rf $(NAME)
$(CC) $(CFLAGS) $(OBJ) -o $(NAME)
clean:
rm -rf $(OBJ)
rm -rf ./a.out
fclean: clean
rm -rf $(NAME)
re: fclean all
.PHONY: all bonus clean fclean re
push:fclean
rm -rf file2 test
git add .
read -p "Message:" message; \
git commit -m "$$message"; \
git push
c:fclean
rm -rf file2
$(CC) $(CFLAGS) $(INCLUDE) $(SRC) -o $(NAME)
cat file1
./pipex file1 "tr a b" "tr e ' '" file2
cat file2
valgrind:fclean
rm -rf file2
$(CC) $(CFLAGS) $(INCLUDE) -g $(SRC) -o $(NAME)
valgrind --leak-check=full --show-leak-kinds=all --trace-children=yes ./pipex file1 "ls -l" "wc -l" file2
error:fclean
rm -rf file2
$(CC) $(CFLAGS) $(INCLUDE) -g $(SRC) -o $(NAME)
valgrind --leak-check=full --show-leak-kinds=all ./pipex file1 "casa" "testea" file2
t:re
../pipex-tester/run.sh