-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (87 loc) · 3.21 KB
/
Makefile
File metadata and controls
116 lines (87 loc) · 3.21 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
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
105
106
107
108
109
110
111
112
113
114
115
116
SDIR = src
EDIR = exe
ODIR = obj
TDIR = test
DDIR = demo
PDIR = perf_comparison
CC = gcc
FLAGS = -I src -Wall -g -fprofile-arcs -ftest-coverage
MODULES = gc page heap metadata mover stack_scanner hash_table linked_list
MODULESTEST = gc page heap metadata mover stack_scanner
OBJS = $(patsubst %,$(ODIR)/%.o,$(MODULES))
TESTS = $(patsubst %,$(EDIR)/test_%,$(MODULESTEST))
INLUPP2 = cart.o inventory.o ask.o general_TUI.o
INLUPP2_OBJS = $(patsubst %,$(DDIR)/inlupp2/%,$(INLUPP2))
$(ODIR)/%.o: $(SDIR)/%.c $(SDIR)/%.h
$(CC) $(FLAGS) $< -c -o $@
$(EDIR)/%: $(SDIR)/%.c $(OBJS)
$(CC) $(FLAGS) $^ -o $@
$(EDIR)/test_%: $(TDIR)/test_%.c $(OBJS)
$(CC) $(FLAGS) $^ -lcunit -o $@
$(PDIR)/%: $(PDIR)/%.c $(OBJS)
$(CC) $(FLAGS) $^ -lcunit -o $@
test_%: $(EDIR)/test_%
valgrind --gen-suppressions=all --error-exitcode=1 --leak-check=full --suppressions=./test/Cond_jump.supp --track-origins=yes --show-leak-kinds=all ./$^
test_cov_%: test_%
gcovr -b obj -e src/hash_table -e src/linked_list
gcovr obj -e src/hash_table -e src/linked_list
test_all: $(TESTS)
$(patsubst %,make test_% && ,$(MODULESTEST)) true
test_cov_all: $(TESTS)
make clean
make test_all
gcovr -b obj -e src/hash_table -e src/linked_list
gcovr obj -e src/hash_table -e src/linked_list
gcovr obj -e src/hash_table -e src/linked_list -x cov/cov.xml
$(DDIR)/inlupp2/%.o: $(DDIR)/inlupp2/%.c $(DDIR)/inlupp2/%.h
$(CC) $(FLAGS) $< -c -o $@
$(DDIR)/inlupp2/store: $(DDIR)/inlupp2/store.c $(OBJS) $(INLUPP2_OBJS)
$(CC) $(FLAGS) $^ -o $@
perf_alloc: $(PDIR)/alloc
./$(PDIR)/alloc
rm -rf $(PDIR)/*.gcno
rm -rf $(PDIR)/*.gcda
python3 ./$(PDIR)/perf_allocs.py
perf_gc: $(PDIR)/GC
./$(PDIR)/GC
rm -rf $(PDIR)/*.gcno
rm -rf $(PDIR)/*.gcda
python3 ./$(PDIR)/perf_GC.py
perf_gc_vs_free: $(PDIR)/GC_vs_free
./$(PDIR)/GC_vs_free
rm -rf $(PDIR)/*.gcno
rm -rf $(PDIR)/*.gcda
python3 ./$(PDIR)/perf_GC_vs_free.py
perf_lls: $(PDIR)/linked_lists.c $(PDIR)/linked_list_malloc.c $(OBJS)
$(CC) $(FLAGS) $^ -lcunit -o $(PDIR)/linked_lists
./$(PDIR)/linked_lists
rm -rf $(PDIR)/*.gcno
rm -rf $(PDIR)/*.gcda
python3 ./$(PDIR)/perf_linked_lists.py
graphs:
python3 ./$(PDIR)/perf_allocs.py
python3 ./$(PDIR)/perf_GC.py
python3 ./$(PDIR)/perf_GC_vs_free.py
python3 ./$(PDIR)/perf_linked_lists.py
demo: $(DDIR)/inlupp2/store
valgrind --gen-suppressions=all --error-exitcode=1 --leak-check=full --suppressions=./test/Cond_jump.supp --track-origins=yes --show-leak-kinds=all ./$(DDIR)/inlupp2/store
inv_clear:
make -C demo/inlupp2 inv_clear
stock: $(DDIR)/inlupp2/store
rm -f $(DDIR)/inlupp2/inventory.bin
touch $(DDIR)/inlupp2/inventory.bin
gcc $(DDIR)/inlupp2/make_stock.c -o $(DDIR)/inlupp2/make_stock
valgrind --error-exitcode=1 --leak-check=full --track-origins=yes --show-leak-kinds=all ./$(DDIR)/inlupp2/make_stock
valgrind --gen-suppressions=all --error-exitcode=1 --leak-check=full --suppressions=./test/Cond_jump.supp --track-origins=yes --show-leak-kinds=all ./$(DDIR)/inlupp2/store < demo/inlupp2/Stock.txt
clean:
rm -rf exe/*
rm -rf obj/*
rm -rf cov/*
rm -f gmon.out
rm -rf $(PDIR)/alloc
rm -rf $(PDIR)/GC
rm -rf $(PDIR)/GC_vs_free
rm -rf $(PDIR)/linked_lists
make -C demo/inlupp2 clean
.PHONY: clean test_% demo inv_clear
.PRECIOUS: $(ODIR)/%.o $(EDIR)/test_% $(EDIR)/%