-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
104 lines (73 loc) · 2.73 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: cacharle <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/02/06 18:13:15 by cacharle #+# #+# #
# Updated: 2021/01/31 03:25:48 by charles ### ########.fr #
# #
# **************************************************************************** #
FT_PRINTF_PATH = ../ft_printf
CC = gcc
CCFLAGS = -Wall -Wextra -Wno-trigraphs # Adding -std=c99 causes crash
LDFLAGS = -L$(FT_PRINTF_PATH) -lftprintf
NAME = ft_printf_test
CHECK_LEAKS_NAME = check_leaks
RM = rm -f
MAKE = make
PYTHON = python3
# ifeq ($(shell $(PYTHON) --version | cut -d ' ' -f 2 | cut -d '.' -f 1),2)
# PYTHON = python3
# $(error You must have python3 installed)
# endif
SRC = main.c helper.c tests/pft_tests.c tests/moulitest_tests.c tests/printf_tester_tests.c \
tests/printf_tests_tests.c saved_tests.c generated.c
OBJ = $(SRC:.c=.o)
run: all
./$(NAME) | $(PYTHON) prettier.py
runbonus: allbonus run
verbose: all
./$(NAME) | $(PYTHON) prettier.py --verbose
verbosebonus: allbonus verbose
quiet: all
./$(NAME) | $(PYTHON) prettier.py --quiet
quietbonus: allbonus quiet
no_clear: all
./$(NAME) | $(PYTHON) prettier.py --no-clear
no_clearbonus: allbonus no_clear
interactive: all
./$(NAME) | $(PYTHON) prettier.py --interactive
interactivebonus: allbonus interactive
raw: all
./$(NAME)
rawbonus: allbonus raw
generate:
$(PYTHON) generate.py -n 100
generatebonus:
$(PYTHON) generate.py -n 100 --bonus
.PHONY: check_leaks
check_leaks:
$(CC) $(CCFLAGS) -g -o $(CHECK_LEAKS_NAME) check_leaks.c $(LDFLAGS)
valgrind ./$(CHECK_LEAKS_NAME) > /dev/null
check_leaks_verbose:
$(CC) $(CCFLAGS) -g -o $(CHECK_LEAKS_NAME) check_leaks.c $(LDFLAGS)
valgrind --leak-check=full ./$(CHECK_LEAKS_NAME) > /dev/null
all: $(NAME)
allbonus: CCFLAGS += -D FT_PRINTF_TEST_BONUS
allbonus: ft_printf_all ft_printf_bonus $(NAME)
$(NAME): ft_printf_all $(OBJ)
$(CC) $(CCFLAGS) -o $@ $(OBJ) $(LDFLAGS)
%.o: %.c header.h tests/tests.h
$(CC) $(CCFLAGS) -c -o $@ $<
clean:
$(RM) $(OBJ)
fclean: clean
$(RM) $(NAME)
$(MAKE) -C $(FT_PRINTF_PATH) fclean
re: fclean all
ft_printf_all:
$(MAKE) -C $(FT_PRINTF_PATH) all
ft_printf_bonus:
$(MAKE) -C $(FT_PRINTF_PATH) bonus