-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
140 lines (102 loc) · 3.57 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
CC=gcc
CFLAGS = -O0 -Wall
LIBS = -larb -lflint -lmpfr -lgmp -lpthread
# Directory to keep object files:
ODIR = obj
IDIR = include
# _OBJ = time_sum.o mainfile.o
# OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
_DEPS = mul_cpx_separatefile.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
.PHONY: all
all: time_sum mainfile separatefile inlined locality \
indirect_addressing_1 indirect_addressing_2 \
indirect_addressing_alt write_hdd write_ssd \
valgrind_test valgrind_test_no_init \
valgrind_test_no_free valgrind_test_double_free \
invalid_access
# Rule to generate object files:
# $(ODIR)/%.o: %.c $(DEPS)
# $(CC) -c -o $@ $< $(CFLAGS) -I$(IDIR)
$(ODIR)/time_sum.o: time_sum.c
$(CC) -c -o $@ $< $(CFLAGS)
## Inlining
$(ODIR)/mainfile.o: mainfile.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/inlined.o: inlined.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/mul_cpx_separatefile.o: mul_cpx_separatefile.c
$(CC) -flto -c -o $@ $< $(CFLAGS)
$(ODIR)/separatefile.o: separatefile.c $(DEPS)
$(CC) -flto -c -o $@ $< $(CFLAGS) -I$(IDIR)
## Locality
$(ODIR)/locality.o: locality.c
$(CC) -c -o $@ $< $(CFLAGS)
## Indirect addressing
$(ODIR)/indirect_addressing_1.o: indirect_addressing_1.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/indirect_addressing_2.o: indirect_addressing_2.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/indirect_addressing_alt.o: indirect_addressing_alt.c
$(CC) -c -o $@ $< $(CFLAGS)
## Writing to HDD and SSD
$(ODIR)/write_hdd.o: write_hdd.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/write_ssd.o: write_ssd.c
$(CC) -c -o $@ $< $(CFLAGS)
## Valgrind
$(ODIR)/valgrind_test.o: valgrind_test.c
$(CC) -c -o $@ $< -g $(CFLAGS)
$(ODIR)/valgrind_test_no_init.o: valgrind_test_no_init.c
$(CC) -c -o $@ $< -g $(CFLAGS)
$(ODIR)/valgrind_test_no_free.o: valgrind_test_no_free.c
$(CC) -c -o $@ $< -g $(CFLAGS)
$(ODIR)/valgrind_test_double_free.o: valgrind_test_double_free.c
$(CC) -c -o $@ $< -g $(CFLAGS)
## GDB
$(ODIR)/invalid_access.o: invalid_access.c
$(CC) -c -o $@ $< -g $(CFLAGS)
time_sum: $(ODIR)/time_sum.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
## Inlining
mainfile: $(ODIR)/mainfile.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
inlined: $(ODIR)/inlined.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
separatefile: $(ODIR)/separatefile.o $(ODIR)/mul_cpx_separatefile.o $(DEPS)
$(CC) -flto -o $@ $^ $(CFLAGS) $(LIBS)
## Locality
locality: $(ODIR)/locality.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
## Indirect addressing:
indirect_addressing_1: $(ODIR)/indirect_addressing_1.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
indirect_addressing_2: $(ODIR)/indirect_addressing_2.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
indirect_addressing_alt: $(ODIR)/indirect_addressing_alt.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
## Writing to HDD and SSD
write_hdd: $(ODIR)/write_hdd.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
write_ssd: $(ODIR)/write_ssd.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
## Valgrind
valgrind_test: $(ODIR)/valgrind_test.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
valgrind_test_no_init: $(ODIR)/valgrind_test_no_init.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
valgrind_test_no_free: $(ODIR)/valgrind_test_no_free.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
valgrind_test_double_free: $(ODIR)/valgrind_test_double_free.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
## GDB
invalid_access: $(ODIR)/invalid_access.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean # Avoid conflict with a file of the same name
clean:
rm -f $(ODIR)/*.o time_sum mainfile separatefile inlined \
locality indirect_addressing_1 indirect_addressing_2 \
indirect_addressing_alt write_hdd write_ssd \
valgrind_test valgrind_test_no_init \
valgrind_test_no_free valgrind_test_double_free \
invalid_access $(IDIR)/*~