-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·306 lines (261 loc) · 7.59 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# =========================================================================
# Makefile for BEET
# (c) Tobias Schoofs, 2018
# =========================================================================
CC = @gcc
CXX = @g++
AR = @ar
LNKMSG = @printf "linking $@\n"
CMPMSG = @printf "compiling $@\n"
FLGMSG = @printf "CFLAGS: $(CFLAGS)\nLDFLAGS: $(LDFLAGS)\n"
INSMSG = @printf ". setenv.sh"
CFLAGS = -g -O3 -Wall -std=c99 -fPIC -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L
LDFLAGS = -L./lib
INC = -I./include -I./test -I./src -I./
LIB = lib/libbeet.so
libs=-lm -ldl -lpthread -ltsalgo
SRC = src/beet
HDR = include/beet
TST = test
COM = common
SMK = test/smoke
STRS = test/stress
TOOLS = tools
BENCH = bench
BIN = bin
LOG = log
RSC = rsc
OUTLIB = lib
OBJ = $(SRC)/lock.o \
$(SRC)/error.o \
$(SRC)/page.o \
$(SRC)/rider.o \
$(SRC)/ins.o \
$(SRC)/node.o \
$(SRC)/tree.o \
$(SRC)/config.o \
$(SRC)/iter.o \
$(SRC)/index.o \
$(SRC)/version.o
DEP = $(HDR)/types.h \
$(SRC)/lock.h \
$(SRC)/page.h \
$(SRC)/rider.h \
$(SRC)/node.h \
$(SRC)/ins.h \
$(SRC)/tree.h \
$(SRC)/iterimp.h \
$(HDR)/config.h \
$(HDR)/iter.h \
$(HDR)/index.h
default: lib
all: default tests bench tools
tools: bin/beet
tests: smoke stress
bench: $(BIN)/writebench \
$(BIN)/readbench
smoke: $(SMK)/pagesmoke \
$(SMK)/ridersmoke \
$(SMK)/nodesmoke \
$(SMK)/treesmoke \
$(SMK)/embeddedsmoke \
$(SMK)/contreesmoke \
$(SMK)/indexsmoke \
$(SMK)/hostsmoke \
$(SMK)/rscsmoke \
$(SMK)/rangesmoke \
$(SMK)/range2smoke
stress: $(STRS)/riderstress
debug: CFLAGS += -g
debug: default
debug: tools
install: $(OUTLIB)/libbeet.so $(BIN)/beet
cp $(OUTLIB)/libbeet.so /usr/local/lib/
cp -r include/beet /usr/local/include/
cp bin/beet /usr/local/bin
run:
flags:
$(FLGMSG)
.SUFFIXES: .c .o
.c.o: $(DEP)
$(CMPMSG)
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
.cpp.o: $(DEP)
$(CMPMSG)
$(CXX) $(CFLAGS) $(INC) -c -o $@ $<
# Tests and demos
# Tools
# Library
lib: lib/libbeet.so
lib/libbeet.so: $(OBJ) $(DEP)
$(LNKMSG)
$(CC) -shared \
-o $(OUTLIB)/libbeet.so \
$(OBJ) \
$(libs)
# Tests and demos
$(TST)/tstprogress: $(TST)/tstprogress.o $(TST)/progress.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(TST)/tstprogress \
$(TST)/progress.o \
$(TST)/tstprogress.o
$(SMK)/pagesmoke: lib $(SMK)/pagesmoke.o $(COM)/math.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/pagesmoke \
$(SMK)/pagesmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/ridersmoke: lib $(SMK)/ridersmoke.o $(COM)/math.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/ridersmoke \
$(SMK)/ridersmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/nodesmoke: lib $(SMK)/nodesmoke.o $(COM)/math.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/nodesmoke \
$(SMK)/nodesmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/treesmoke: lib $(SMK)/treesmoke.o $(COM)/math.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/treesmoke \
$(SMK)/treesmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/embeddedsmoke: lib $(SMK)/embeddedsmoke.o $(COM)/math.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/embeddedsmoke \
$(SMK)/embeddedsmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/contreesmoke: lib $(SMK)/contreesmoke.o $(COM)/cmd.o \
$(COM)/bench.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/contreesmoke \
$(SMK)/contreesmoke.o \
$(COM)/cmd.o \
$(COM)/bench.o \
$(LIB) \
$(libs)
$(SMK)/indexsmoke: lib $(SMK)/indexsmoke.o $(COM)/math.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/indexsmoke \
$(SMK)/indexsmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(OUTLIB)/libcmp.so: $(COM)/cmp.o
$(LNKMSG)
$(CC) -shared \
-o $(OUTLIB)/libcmp.so \
$(COM)/cmp.o
$(SMK)/hostsmoke: lib $(SMK)/hostsmoke.o $(COM)/math.o \
$(OUTLIB)/libcmp.so
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/hostsmoke \
$(SMK)/hostsmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/rscsmoke: lib $(SMK)/rscsmoke.o $(COM)/math.o \
$(OUTLIB)/libcmp.so
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/rscsmoke \
$(SMK)/rscsmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/rangesmoke: lib $(SMK)/rangesmoke.o $(COM)/math.o \
$(OUTLIB)/libcmp.so
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/rangesmoke \
$(SMK)/rangesmoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(SMK)/range2smoke: lib $(SMK)/range2smoke.o $(COM)/math.o \
$(OUTLIB)/libcmp.so
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(SMK)/range2smoke \
$(SMK)/range2smoke.o \
$(COM)/math.o \
$(LIB) \
$(libs)
$(STRS)/riderstress: lib $(STRS)/riderstress.o \
$(COM)/math.o $(COM)/bench.o $(COM)/cmd.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(STRS)/riderstress \
$(STRS)/riderstress.o \
$(COM)/math.o \
$(COM)/bench.o \
$(COM)/cmd.o \
$(LIB) \
$(libs)
# Bench
$(BIN)/writebench: lib $(BENCH)/writebench.o \
$(OUTLIB)/libcmp.so $(COM)/bench.o $(COM)/cmd.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(BIN)/writebench \
$(BENCH)/writebench.o \
$(COM)/bench.o \
$(COM)/cmd.o \
$(LIB) \
$(libs)
$(BIN)/readbench: lib $(BENCH)/readbench.o \
$(OUTLIB)/libcmp.so $(COM)/bench.o $(COM)/cmd.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(BIN)/readbench \
$(BENCH)/readbench.o \
$(COM)/bench.o \
$(COM)/cmd.o \
$(LIB) \
$(libs)
# Tools
$(BIN)/beet: lib $(TOOLS)/beet.o \
$(COM)/cmd.o
$(LNKMSG)
$(CC) $(LDFLAGS) -o $(BIN)/beet \
$(TOOLS)/beet.o \
$(COM)/cmd.o \
$(LIB) \
$(libs)
# Clean up
clean:
rm -f $(SRC)/*.o
rm -f $(SMK)/*.o
rm -f $(STRS)/*.o
rm -f $(COM)/*.o
rm -f $(BENCH)/*.o
rm -f $(TOOLS)/*.o
rm -f $(LOG)/*.log
rm -f $(RSC)/*.bin
rm -f $(RSC)/*.leaf
rm -f $(RSC)/*.noleaf
rm -f $(RSC)/roof
rm -f $(RSC)/config
rm -rf $(RSC)/idx??
rm -rf $(RSC)/idx???
rm -rf $(RSC)/emb
rm -f $(SMK)/pagesmoke
rm -f $(SMK)/ridersmoke
rm -f $(SMK)/nodesmoke
rm -f $(SMK)/treesmoke
rm -f $(SMK)/embeddedsmoke
rm -f $(SMK)/contreesmoke
rm -f $(SMK)/indexsmoke
rm -f $(SMK)/hostsmoke
rm -f $(SMK)/rscsmoke
rm -f $(SMK)/rangesmoke
rm -f $(SMK)/range2smoke
rm -f $(STRS)/riderstress
rm -f $(BIN)/writebench
rm -f $(BIN)/readbench
rm -f $(BIN)/beet
rm -f $(OUTLIB)/libbeet.so
rm -f $(OUTLIB)/libcmp.so